User`s manual
RX600 & RX200 Series Simple Flash API for RX
R01AN0544EU0250 Rev.2.50 Page 6 of 33
March 4, 2014
2.10 Adding Middleware to Your Project
Follow the steps below to add the middleware’s code to your project.
1. Copy the ‘r_flash_api_rx’ directory (packaged with this application note) to your project directory.
2. Add src\r_flash_api_rx.c to your project.
3. Add an include path to the 'r_flash_api_rx' directory.
4. Add an include path to the 'r_flash_api_rx\src' directory.
5. Copy the reference configuration file 'r_flash_api_rx_config_reference.h' from the ‘ref’ folder to your project
and rename it r_flash_api_rx_config.h.
6. Configure middleware for your system through just copied r_flash_api_rx_config.h.
7. Add a #include for r_flash_api_rx_if.h in any source files that need to use the Flash API.
The following steps are only required if you are programming or erasing ROM. If you are only operating on data flash,
then these steps can be ignored. These steps are discussed with more detail in Section 2.13.
8. Make a ROM section named ‘PFRAM’.
9. Make a RAM section named ‘RPFRAM’.
10. Configure your linker such that code allocated in the ‘FRAM’ section will actually be executed in RAM.
11. After reset, make sure the Flash API code is copied from ROM to RAM. This can be done by calling the
R_FlashCodeCopy() function.
2.11 Limitations
1. This code is not re-entrant but does protect against multiple concurrent function calls.
2. During ROM operations neither ROM nor DF can be accessed. If using ROM BGO then make sure code runs
from RAM.
3. During DF operations the DF cannot be accessed but ROM can be accessed normally.
2.12 Memory Requirements
The ROM and RAM requirements will vary depending upon which configuration options are enabled. For example,
when ROM programming is enabled the amount of RAM required is significantly higher because Flash API code must
be run from RAM. This means that the code will have to be stored in ROM when the MCU is programmed and then it
will have to be copied to RAM when the user application is executed. The table below gives memory requirements for
several different commonly used configurations.
Three different configurations are shown:
1. Default
a. This is how the Flash API is configured by default. ROM operations are enabled without BGO. Data
flash operations are enabled without BGO. Lock bits are ignored. Flash to flash transfers are disabled.
2. Data Flash BGO Only (Virtual EEPROM mode)
a. This is a configuration that is used when users only want to perform data flash operations. This is
common when using the Virtual EEPROM code. ROM operations are disabled. Data flash operations
are enabled with BGO. Lock bits are ignored. Flash to flash transfers are enabled.
3. Data Flash BGO & ROM
a. The only feature that is not enabled is ROM BGO. ROM operations are enabled without BGO. Data
flash operations are enabled with BGO. Lock bits are not ignored. Flash to flash transfers are enabled.
Optimization was set to O2, Size for all tests.