Flash Data Library T04 ( PicoFDL) issue


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.


Parents Reply
  • 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.