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:
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.
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)
- Integrated Development Environment: CS+ for CC V8.05.00, e2 studio 2021-04 (21.4.0)
- C compiler: CC-RL V1.10.00
- Code Generator tool: (CS+) Renesas Smart Configurator for RL78 V1.00.00.04, (e2 studio) Renesas Smart Configurator for RL78 21.4.0.v20210315-0928
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:
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.
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.
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.
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
- Library is using the following standard functions:
memset
,memcmp
,memcpy
.
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.
- Integrated Development Environment and C compiler: IAR Embedded Workbench for Renesas RL78 version 4.21.1
- C compiler: IAR C/C++ Compiler for RL78 version : 4.20.1.2260 (4.20.1.2260)
- Code Generator tool: Renesas Smart Configurator for RL78 Version: 1.0.1
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:
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.
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.
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.
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
- Library is using the following standard functions:
memset
,memcmp
,memcpy
.
3.3 LLVM for Renesas RL78 (C compiler)
The TFAT library can run with the following development environment.
- Integrated Development Environment: e2 studio 2022-07 (22.7.0)
- C compiler: LLVM for Renesas RL78 10.0.0.202207
- Code Generator tool: (e2 studio) Renesas Smart Configurator for RL78 22.7.0.v20220620-0602
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:
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.
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.
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.
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
- Library is using the following standard functions:
memset
,memcmp
,memcpy
.
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 |
Related Documents
![]() |
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. |
![]() |
CC-RL コンパイラ ユーザーズマニュアル - RL78 ファミリ開発用 ルネサス エレクトロニクス製 CC-RL コンパイラ (CC-RL) のユーザーズマニュアル。RL78 ファミリ用アプリケーション・システム開発におけるコンパイラの機能、コマンド、オプション、および注意事項について詳述。 |
![]() |
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. |
![]() |
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. |
![]() |
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. |
![]() |
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. |
![]() |
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. |
![]() |
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. |