Renesas RL78 Family Open Source FAT File System M3S-TFAT-Tiny: Introduction Guide

Introduction

This document explains the usage of the Open Source FAT File System M3S-TFAT-Tiny for RL78 Family (hereafter referred to as "TFAT library") along with a sample program.

Please refer to the User's Manual to understand how to use the software library. The User's Manual is included in this application note.

Additionally, a Sound Playback/Record demonstration software for the YRDKRL78G14 has been prepared as a sample application program for the TFAT Library.

Please refer to the following URL for details:

RL78/G14 Sound Playback/Compression Demonstration for RL78/G14 CPU Board - Sample Code | Renesas (Document NO.: R20AN0194)

Target Device

RL78/G14, RL78/G23

When using this application note with other Renesas MCUs, careful evaluation is recommended after making modifications to comply with the alternate MCU.

1. Structure of application note

This application note includes the following files:

Table 1 Structure of application note
name description
r20an0159xx0201-rl78-tfat <DIR> Sample code folder
Workspace (workspace) <DIR>
Document (doc) <DIR>
English (en) <DIR>
r20uw0078ej0200-tfat.pdf User's Manual
r20an0159ej0201-rl78-tfat.pdf Introduction Guide (this document)
Japanese (ja) <DIR>
r20uw0078jj0200-tfat.pdf User's Manual
r20an0159jj0201-rl78-tfat.pdf Introduction Guide
libsrc <DIR>
tfat <DIR>
src <DIR> Library Source Dir
r_TinyFAT.c Library Source file
r_TinyFAT.h Library header file
r_version.c Version data define file
include <DIR> Include File Dir
r_tfat_lib.h Library header file
r_stdint.h Integer type define header file
r_mw_version.h Version data header file

2. Specification of library

2.1 Specification of TFAT library

Following are some of the main specifications of the TFAT library.

Table 2 Specification of TFAT library
Item Specifications
Base program Fatfs (R0.06)
Supported FAT Type FAT12, FAT16, FAT32
Filename Support 8.3 format (8 lettered filename & 3 lettered extension)
Long file name format is not supported.
Number of drives supported 1
Logical Sector size 512byte
Filesystem format function None

2.2 Structure of software stack

The following is the structure of the software stack of the TFAT library.

Application

initialize

libraries API

FAT file system

TFAT Library

Driver I/F

convert I/F

device driver

H/W

Memory media

Figure 2-1 structure of software stack of the TFAT library

3. Development environment

The TFAT library can run with the following development environments. When developing, please choose a newer version than the ones listed below.

3.1 CC-RL (C compiler)

3.1.1 Version information

The TFAT library has version information as strings. Users can access this version information using the extern variable defined in the header file (r_tfat_lib.h).

define: extern const mw_version_tR_tfat_version;

3.1.2 ROM size / RAM size / Stack size

The TFAT library requires the following ROM/RAM/Stack size:

Table 3 ROM/RAM size
kind size
ROM(.text,.const) about 9KB
RAM(.bss) 4byte
Stack size [Note] about 230byte

Note: Stack size is dependent on user-defined functions.

At least one variable of the structure FATFS is always required for FileSystem Work Area allocation. The FIL and DIR structures will be needed as per the requirement. The number of FIL variables needed is equal to the number of files that will be opened simultaneously by the user. If two files are to be opened simultaneously, then two FIL structure variables will be needed, resulting in total memory consumption of 32 x 2 = 64 Bytes. This is also the case with DIR and other structure variables.

Table 4 structure size
Structure Memory for one structure variable [byte]
FATFS 558
FIL 32
DIR 18
FILINFO 22

3.1.3 Performance

The access time for the TFAT library to read/write to a memory card is shown below.

Table 5 Performance
Test Condition Time
RL78/G14 Time to write 1MByte data file.
(File Open, Data write,File close)
About 4.1 Sec
Time to read 1MByte data file.
(File Open, Data read,File close)
About 2.0 Sec
RL78/G23 Time to write 1MByte data file.
(File Open, Data write,File close)
About 4.7 Sec
Time to read 1MByte data file.
(File Open, Data read,File close)
About 2.1 Sec

Details of the test conditions are provided below.

Table 6 Measurement condition
Detail of Test Condition Contents
RL78/G14 CPU Clock(fCLK) 32MHz
Memory Transcend SD 2GB
FAT type FAT32
Cluster size 2048byte
Driver software Renesas MMC driver (R20AN0158EJ0101)
Source data area when data write. Internal ROM (Mirror area)
Destination data area when data read. Internal RAM
RL78/G23 CPU Clock(fCLK) 32MHz
Memory Transcend SD 2GB
FAT type FAT32
Cluster size 2048byte
Driver software Renesas MMC driver (R20AN0158EJ0200)
Source data area when data write. Internal ROM (Mirror area)
Destination data area when data read. Internal RAM

3.1.4 Notes

3.2 IAR C/C++ Compiler for Renesas RL78 (C compiler)

The TFAT library can run with the following development environment. Please choose a newer version than the ones listed below.

3.2.1 Version information

The TFAT library has version information as strings. Users can access this version information using the extern variable defined in the header file (r_tfat_lib.h).

define: extern const mw_version_tR_tfat_version;

3.2.2 ROM size / RAM size / Stack size

The TFAT library requires the following ROM/RAM/Stack size:

Table 7 ROM/RAM size
kind size
ROM (Code) about 7.5KB
RAM (Data) 0byte
Stack size [Note] about 220byte

Note: Stack size is dependent on user-defined functions.

At least one variable of the structure FATFS is always required for FileSystem Work Area allocation. The FIL and DIR structures will be needed as per the requirement. The number of FIL variables needed is equal to the number of files that will be opened simultaneously by the user. If two files are to be opened simultaneously, then two FIL structure variables will be needed, resulting in total memory consumption of 32 x 2 = 64 Bytes. This is also the case with DIR and other structure variables.

Table 8 structure size
Structure Memory for one structure variable [byte]
FATFS 558
FIL 32
DIR 18
FILINFO 22

3.2.3 Performance

The access time for the TFAT library to read/write to a memory card is shown below.

Table 9 Performance
Test Condition Time
RL78/G14 Time to write 1MByte data file.
(File Open, Data write,File close)
About 5.5 Sec
Time to read 1MByte data file.
(File Open, Data read,File close)
About 2.0 Sec
RL78/G23 Time to write 1MByte data file.
(File Open, Data write,File close)
About 4.5 Sec
Time to read 1MByte data file.
(File Open, Data read,File close)
About 2.0 Sec

Details of the test conditions are provided below.

Table 10 Measurement condition
Detail of Test Condition Contents
RL78/G14 CPU Clock(fCLK) 32MHz
Memory Transcend MMC 256MB
FAT type FAT32
Cluster size 2048byte
Driver software Renesas MMC driver (R20AN0158EJ0101)
Source data area when data write. Internal ROM (Mirror area)
Destination data area when data read. Internal RAM
RL78/G23 CPU Clock(fCLK) 32MHz
Memory SanDisk SD 2GB
FAT type FAT32
Cluster size 2048byte
Driver software Renesas MMC driver (R20AN0158EJ0200)
Source data area when data write. Internal ROM (Mirror area)
Destination data area when data read. Internal RAM

3.2.4 Notes

3.3 LLVM for Renesas RL78 (C compiler)

The TFAT library can run with the following development environment.

3.3.1 Version information

The TFAT library has version information as strings. Users can access this version information using the extern variable defined in the header file (r_tfat_lib.h).

define: extern const mw_version_tR_tfat_version;

3.3.2 ROM size / RAM size / Stack size

The TFAT library requires the following ROM/RAM/Stack size:

Table 11 ROM/RAM size
kind size
ROM(.textf.const) about 11KB
RAM(.bss) 4byte
Stack size [Note] about 212byte

Note: Stack size is dependent on user-defined functions.

At least one variable of the structure FATFS is always required for FileSystem Work Area allocation. The FIL and DIR structures will be needed as per the requirement. The number of FIL variables needed is equal to the number of files that will be opened simultaneously by the user. If two files are to be opened simultaneously, then two FIL structure variables will be needed, resulting in total memory consumption of 32 x 2 = 64 Bytes. This is also the case with DIR and other structure variables.

Table 12 structure size
Structure Memory for one structure variable [byte]
FATFS 558
FIL 32
DIR 18
FILINFO 22

3.3.3 Performance

The access time for the TFAT library to read/write to a memory card is shown below.

Table 13 Performance
Test Condition Time
RL78/G23 Time to write 1MByte data file.
(File Open, Data write,File close)
About 3 Sec
Time to read 1MByte data file.
(File Open, Data read,File close)
About 2.5 Sec

Details of the test conditions are provided below.

Table 14 Measurement condition
Detail of Test Condition Contents
RL78/G23 CPU Clock(fCLK) 32MHz
Memory Team microSD 2GB
FAT type FAT32
Cluster size 2048byte
Driver software Renesas MMC driver (R20AN0158EJ0201)
Source data area when data write. Internal ROM (Mirror area)
Destination data area when data read. Internal RAM

3.3.4 Notes

3.4 Sample project

The sample program that uses the TFAT-IAR version is in the following Application note.

Document title: Sound Playback/Compression demonstration software for RL78/G14 CPU board (Document number: R20AN0194)

Please download the sample code by clicking the following URL:

RL78/G14 Sound Playback/Compression Demonstration for RL78/G14 CPU Board - Sample Code | Renesas

4. Usage of Libraries

Please include a library file and a header file in a project.

The TFAT library does not contain the driver for a memory media (SD card and a USB memory). Please prepare the driver for a memory media by the user side in accordance with the hardware in use.

Please set the driver of the memory media by the Memory driver interface of the TFAT library. Please refer to a user's manual about the Memory driver interface.

5. Library version information

Ver change
2.03 Supported LLVM.
M3S-TFAT-Tiny: Included in the installation guide [R20AN0159EJ0201].
2.02 Supported CC-RL.
M3S-TFAT-Tiny: Included in the installation guide [R20AN0159EJ0104].
2.01 M3S-TFAT-Tiny: Included in the installation guide [R20AN0159EJ0103].
2.00 M3S-TFAT-Tiny: Included in the installation guide [R20AN0159EJ0102].

Website and Support

Renesas Electronics Website: http://www.renesas.com/

Inquiries: http://www.renesas.com/contact/

All trademarks and registered trademarks are the property of their respective owners.

Revision History

Rev. Date Page Description Summary
2.01 Nov 09, 2022 10 Supported LLVM.
Added LLVM for Renesas RL78 to 3. Development environment.
2.00 Jul 14, 2021 Delete CS+ for CA,CX
Supported e² studio.
Supported RL78/G23
Changed the library provision form from Lib. Format to C source.
1.04 Oct 01, 2015 Changed CubeSuite+ to CS+ for CA,CX
Supported CS+ for CC.
Deleted sample program.
1.03 Sep 01, 2014 Supported IAR Embedded Workbench.
1.02 Nov 08, 2013 Changed document title
Changed the structure of sections
Added Fatfs copyright to library source
Product structure is changed.
1.01 Jan 31, 2013 C hanged into ZIP download form from installer form.
Change of development environment
Compiler version is corrected
Correction of library stack size
Performance is added.
Change of written contents of appendix
The connection information on a memory card conversion board and RL78/G14 CPU board is added.
A wiring schematic view and RL778/G14 CPU board appearance photograph are added.
1.00 Mar.31.12 First edition issued

PDF preview unavailable. Download the PDF instead.

r20an0159ej0201-rl78-tfat Renesas Electronics Corporation Adobe PDF Library 22.3.39

Related Documents

Preview Renesas RL78/G23, RL78/G22 Firmware Update Module Application Note
This application note details the firmware update module for Renesas RL78/G23 and RL78/G22 microcontrollers, explaining its specifications and API functions for easy incorporation into user applications. It covers various update methods, including half-face and full updates using internal or external flash memory, and provides guidance on using the Renesas Image Generator tool.
Preview CC-RL コンパイラ ユーザーズマニュアル - RL78 ファミリ開発用
ルネサス エレクトロニクス製 CC-RL コンパイラ (CC-RL) のユーザーズマニュアル。RL78 ファミリ用アプリケーション・システム開発におけるコンパイラの機能、コマンド、オプション、および注意事項について詳述。
Preview Renesas RL78/F12/F13/F14/F15 Starter Kit Quick Start Guide
A comprehensive quick start guide for the Renesas RL78/F12, RL78/F13, RL78/F14, and RL78/F15 starter kits. Learn how to install software, connect hardware, and begin development with IAR Embedded Workbench and CS+ for CC.
Preview CC-RL Compiler User's Manual
This user's manual provides a comprehensive guide to the CC-RL compiler for the RL78 family, covering its features, usage, and technical specifications for developing application systems.
Preview Renesas RX Family CAN API: Firmware Integration Technology Application Note
This Renesas application note details the CAN API for the RX Family microcontrollers, enabling efficient communication over the CAN bus. It covers API usage, features, target devices, compilers, and includes bundled source code for development.
Preview Renesas e2 Studio V2.1: Integrated Development Environment Update
Renesas announces the revision of its e2 studio Integrated Development Environment (IDE) to V2.1, featuring an Eclipse open-source base and support for RX, RL78, and RH850 families of MCUs. Details on features, compilers, and debugging emulators are provided.
Preview Renesas e2 studio: Porting Projects from Code Generator to Smart Configurator for RL78 MCUs
A detailed guide for migrating embedded software projects from Renesas' Code Generator to the Smart Configurator in e2 studio. Covers RL78 microcontroller projects, including project setup, peripheral configuration, and user code porting.
Preview CC-RH Compiler User's Manual for RH850 Family
Comprehensive user's manual for the CC-RH compiler, detailing its features, commands, and specifications for developing applications and systems for the RH850 family. Covers C and assembly language programming, optimization, linking, and file formats.