Hi
i would really appreciate any kind of help, i am work on RL78 G13 MCU (specially R5F100LE microcontroller). my program is meant to save some data when the low voltage detection interrupt is fired, i am using Flash Data Library T04 ( PicoFDL) for writing and reading the data flash. all the reading and writing processes work fine and the error status return FDL_OK always. some thing i am confusing about is how to allocate the sections the Library needs (in both flash and ram (self-ram)), in my program i did not allocate any section in ram or flash and it works fine as saving in the flash and reading from it, but i always found that the uninitialized global variable (.bss) is corrupted while using the Flash Data Library T04 functions. so any one can help me with the define of these sections for CC-RL compiler and e2studio IDE or tell me what is the reason of the corrupted bss.
thanks
The only explicit section allocated by the PFDL is the code section:
For your device you must observe reserving the so-called Self-RAM area, which for the CC-RL tools is the linker option "-self":
thank you jimB for your reply, i really appreciate it.
the confusing thing about self-ram section is that : this application note says that about this section
https://www.renesas.com/us/en/document/apn/rl78g13-flash-data-library-type04-rev120?language=en
i ignored the previous note and tried to allocate the self-ram section using e2studio IDE but i got an error in memory section .dataR
i must missing some thing. so please if you can help or any one ,it will save my day.
thanks.
Hi,
For your device R5F100LE it is needed that you reserve a self-RAM area for flash library so the RAM used by your application does not overwrite the necessary self-RAM area. As shown on https://www.renesas.com/us/en/document/mat/rl78-family-self-ram-list-flash-self-programming-library-rev305 the range of this self-RAM area for using FDL in your device is FEF00H-FEF87H.
If you select 'self RAM area' for FDL T04 in RAM without section option, the self-RAM area will reserve 1K out of the 4K of total RAM of your device. (1K is the maximum size of all flash libraries which is for code flash library).
In order to allocate only the needed self-RAM size of FDL, which is 136 bytes, select 'None' and add these lines in your code:
#pragma address self_ram_area = 0xFEF00 volatile char self_ram_area[136];
The fact that it works fine so far is because your application is probably small enough and the self-RAM was not overwritten.
Hope it makes sense.
Regards
AZ
i don't know how to thank you for your support and your sufficient reply. it works like rocket with me after adding the lines you told me. thank you again,you've made my day.
Great! Glad to help.