Data Flash Access Library (T04) integration into E2Studio GNU

Hi,

Does anyone have success by using the new Data Flash Library functions for the GNU compiler in E2studio ?

I get these faults when I try to compile:

In file included from ../src/STrfHost.c:31:0:
../src/pfdl.a:1:1: error: expected identifier or '(' before '!' token
!<arch>
^
../src/pfdl.a:2:1: error: stray '`' in program
/ 1361278445 0 0 0 212 `
^
../src/pfdl.a:3:1: warning: null character(s) ignored [enabled by default]
RSION_STRINGELFpfdl_version.o/ 1361278445 0 0 100666 792 `
^
../src/pfdl.a:3:7: error: stray '\1' in program
ELFpfdl_version.o/ 1361278445 0 0 100666 792 `
^
../src/pfdl.a:3:7: error: stray '\30' in program
../src/pfdl.a:3:9: warning: null character(s) ignored [enabled by default]
ELFpfdl_version.o/ 1361278445 0 0 100666 792 `
^
../src/pfdl.a:3:7: error: stray '\1' in program
ELFpfdl_version.o/ 1361278445 0 0 100666 792 `
^
../src/pfdl.a:3:7: error: stray '\30' in program
../src/pfdl.a:3:13: warning: null character(s) ignored [enabled by default]
ELFpfdl_version.o/ 1361278445 0 0 100666 792 `
^
../src/pfdl.a:3:7: error: stray '\1' in program
ELFpfdl_version.o/ 1361278445 0 0 100666 792 `
^
../src/pfdl.a:3:7: error: stray '\30' in program
../src/pfdl.a:3:17: warning: null character(s) ignored [enabled by default]
ELFpfdl_version.o/ 1361278445 0 0 100666 792 `

Any help would be appreciated

Thanks

Anders

  • Hi Anders,

    My suggestion:

    + Get the latest Data Flash Access Library from RENESAS' European Download pages

    www2.renesas.eu/.../5020.

    The RENESAS_FDL_RL78_T04E_Vx.xx.zip unzipps into an Exe-file that lets you choose device and compiler version before copying the library onto your harddisk.

    + No matter what compiler you use, you have to create a least an additional linker section in codememory. Using e²studio and GNURL this is done in menu Project -> Properties -> C/C++ Build -> Settings -> Tool Settings -> Linker -> Sections.

    Add a section named "PFDL_COD" with Start Address "follow on from previous section" .text.

    You can also create an additional data section in RAM, say PFDL_DAT, where you keep a mirror of your EE data - but this is not mandatory.

    In GNURL you would place a global variable array like this

    char EE_Mirror[100] __attribute__ ((section (".PFDL_DAT")));

    + You have to tell the linker where to look for the library file "pfdl.a". In e²studio please add this file path in

    Project -> Properties -> C/C++ Build -> Settings -> Tool Settings -> Linker -> Input.

    I'll come back to the coding part in another post.

    Regards

    Ralf

  • In reply to Rutronik-Ralf:

    Hello Ralf

    The code is already avaliable in another post?

    Thanks

  • In reply to ofrison:

    Here are the linker settings for the R5F100LEAFB on my YRPBRL78G13.

    Note the linker sections for the library:

    + PFDL_COD following on from previous section .text

    + .data, Start address of the .data section in RAM has been reconfigured to 0xFF30A leaving FEF00 to FF309 free for the self programming library as requested in user's manual of RL78/G13, chapter 3.1 Memory Space, see note1 below figure of memory map

    + PFDL_reserve starting from fixed address 0xFFE20, see note below figure of memory map in user's manual of RL78/G13

    The code could look something like this (please pardon magic numbers and clumsyness). After erasing the data flash the program writes the numbers 0..19 into the first 20 bytes of the dataflash. The first 100 bytes of the data flash are copied into EE_Mirror.

    #include "iodefine.h"
    #include "pfdl.h"

    volatile pfdl_u08 EE_Mirror[100] __attribute__ ((section (".PFDL_DAT")));
    char a;

    void ErrorHandler(void);

    int main(void)
    {
        pfdl_descriptor_t pfdl_d;
        pfdl_request_t    pfdl_request;
        pfdl_status_t     pfdl_status;

        // prepare descriptor and open PFDL
        pfdl_d.fx_MHz_u08 = 32;                // system frequency in MHz
        pfdl_d.wide_voltage_mode_u08 = 0x01;   // according to Vdd
        PFDL_Open(&pfdl_d);

        pfdl_request.command_enu = PFDL_CMD_ERASE_BLOCK;
        pfdl_status = PFDL_Execute(&pfdl_request);
        if( (pfdl_status != PFDL_OK) && (pfdl_status != PFDL_BUSY)) ErrorHandler();
        // wait for execution to complete
        while(pfdl_status == PFDL_BUSY)
        {
          pfdl_status = PFDL_Handler();
        }
        if(pfdl_status != PFDL_OK) ErrorHandler();

        // specify request and execute it
        pfdl_request.index_u16 = 0;
        pfdl_request.bytecount_u16 = 100;
        pfdl_request.data_pu08 = (pfdl_u08*) &EE_Mirror;
        pfdl_request.command_enu = PFDL_CMD_READ_BYTES;
        pfdl_status = PFDL_Execute(&pfdl_request);
        if( (pfdl_status != PFDL_OK) && (pfdl_status != PFDL_BUSY)) ErrorHandler();
        // wait for execution to complete
        while(pfdl_status == PFDL_BUSY)
        {
          pfdl_status = PFDL_Handler();
        }
        if(pfdl_status != PFDL_OK) ErrorHandler();

        for (a=0; a<20; a++)
        {
            EE_Mirror[a]=a;
        }

        pfdl_request.index_u16 = 0;
        pfdl_request.bytecount_u16 = 20;
        pfdl_request.data_pu08 = (pfdl_u08*) &EE_Mirror;
        pfdl_request.command_enu = PFDL_CMD_WRITE_BYTES;
        pfdl_status = PFDL_Execute(&pfdl_request);
        if( (pfdl_status != PFDL_OK) && (pfdl_status != PFDL_BUSY)) ErrorHandler();
        // wait for execution to complete
        while(pfdl_status == PFDL_BUSY)
        {
          pfdl_status = PFDL_Handler();
        }
        if(pfdl_status != PFDL_OK) ErrorHandler();

        for (a=1; a<20; a++)
        {
            EE_Mirror[a]=0;
        }

        pfdl_request.index_u16 = 0;
        pfdl_request.bytecount_u16 = 100;
        pfdl_request.data_pu08 = (pfdl_u08*) &EE_Mirror;
        pfdl_request.command_enu = PFDL_CMD_READ_BYTES;
        pfdl_status = PFDL_Execute(&pfdl_request);
        if( (pfdl_status != PFDL_OK) && (pfdl_status != PFDL_BUSY)) ErrorHandler();
        // wait for execution to complete
        while(pfdl_status == PFDL_BUSY)
        {
          pfdl_status = PFDL_Handler();
        }
        if(pfdl_status != PFDL_OK) ErrorHandler();
        while (1) {
        }
      return 0;
    }

    void ErrorHandler(void)
    {
    }

  • In reply to Rutronik-Ralf:

    Hello Ralf

    Thanks for the quick answer.

    I tested the code and it really works very well.

    Congratulations.

    Regards.

  • In reply to Rutronik-Ralf:

    Hi,

    To the RL78/D1A is the same procedure?

    Regards.

  • In reply to ofrison:

    Hi Ralf,

    I have a problem with the processor R5F104LEA series RL78/G14.

    Here are the linker settings

    This program code

    int main(void)
    {
    // TODO: add application code here
    pfdl_descriptor_t pfdl_d;
    pfdl_request_t pfdl_request;
    pfdl_status_t pfdl_status;

    // prepare descriptor and open PFDL
    pfdl_d.fx_MHz_u08 = 32; // system frequency in MHz
    pfdl_d.wide_voltage_mode_u08 = 0x01; // according to Vdd
    PFDL_Open(&pfdl_d);

    while (1) {
    }
    return 0;
    }

    When Building my project (name - "Spectrum") I get the following errors:

    'Invoking: Linker'
    'Building target: spectrum.x'
    rl78-elf-ld -o "spectrum.x" ./src/hardware_setup.o ./src/interrupt_handlers.o ./src/reset_program.o ./src/spectrum.o ./src/vector_table.o "C:\Documents and Settings\Evgenii\My Documents\e2studio\workspace\spectrum\lib\pfdl.a" libspectrum.a -T"C:\Documents and Settings\Evgenii\My Documents\e2studio\workspace\spectrum\HardwareDebug\spectrum_HardwareDebug_auto.gsi" -M=spectrum.map -e_PowerON_Reset -L"C:\Documents and Settings\Evgenii\My Documents\e2studio\workspace\spectrum\HardwareDebug" -L"C:\Renesas\e2studio\GNURL7~1.02-\rl78-elf\rl78-elf\lib" -L"C:\Renesas\e2studio\GNURL7~1.02-\rl78-elf\lib\gcc\rl78-elf\4.8-GNURL78_v13.02" --start-group -lspectrum -lgcc -lstdc++ --end-group
    rl78-elf-ld: section .vects loaded at [00000004,0000007f] overlaps section .vec loaded at [00000000,00000005]
    C:\Documents and Settings\Evgenii\My Documents\e2studio\workspace\spectrum\HardwareDebug\libspectrum.a(gcrt0.o): In function `start':
    (.text+0x2): undefined reference to `_stack'
    C:\Documents and Settings\Evgenii\My Documents\e2studio\workspace\spectrum\HardwareDebug\libspectrum.a(gcrt0.o): In function `start':
    (.text+0x9): undefined reference to `_datastart'
    C:\Documents and Settings\Evgenii\My Documents\e2studio\workspace\spectrum\HardwareDebug\libspectrum.a(gcrt0.o): In function `start':
    (.text+0xc): undefined reference to `_romdatastart'
    C:\Documents and Settings\Evgenii\My Documents\e2studio\workspace\spectrum\HardwareDebug\libspectrum.a(gcrt0.o): In function `start':
    (.text+0x11): undefined reference to `_romdatacopysize'
    C:\Documents and Settings\Evgenii\My Documents\e2studio\workspace\spectrum\HardwareDebug\libspectrum.a(gcrt0.o): In function `start':
    (.text+0x29): undefined reference to `_bssstart'
    C:\Documents and Settings\Evgenii\My Documents\e2studio\workspace\spectrum\HardwareDebug\libspectrum.a(gcrt0.o): In function `start':
    (.text+0x31): undefined reference to `_bsssize'
    C:\Documents and Settings\Evgenii\My Documents\e2studio\workspace\spectrum\HardwareDebug\libspectrum.a(gcrt0.o): In function `start':
    (.text+0x4c): undefined reference to `etext'
    C:\Documents and Settings\Evgenii\My Documents\e2studio\workspace\spectrum\HardwareDebug\libspectrum.a(gcrt0.o): In function `start':
    (.text+0x65): undefined reference to `exit'
    C:\Documents and Settings\Evgenii\My Documents\e2studio\workspace\spectrum\HardwareDebug\libspectrum.a(gcrt0.o): In function `rl78_run_preinit_array':
    (.text+0x69): undefined reference to `_preinit_array_start'
    C:\Documents and Settings\Evgenii\My Documents\e2studio\workspace\spectrum\HardwareDebug\libspectrum.a(gcrt0.o): In function `rl78_run_preinit_array':
    (.text+0x6c): undefined reference to `_preinit_array_end'
    C:\Documents and Settings\Evgenii\My Documents\e2studio\workspace\spectrum\HardwareDebug\libspectrum.a(gcrt0.o): In function `rl78_run_init_array':
    (.text+0x74): undefined reference to `_init_array_start'
    C:\Documents and Settings\Evgenii\My Documents\e2studio\workspace\spectrum\HardwareDebug\libspectrum.a(gcrt0.o): In function `rl78_run_init_array':
    (.text+0x77): undefined reference to `_init_array_end'
    C:\Documents and Settings\Evgenii\My Documents\e2studio\workspace\spectrum\HardwareDebug\libspectrum.a(gcrt0.o): In function `rl78_run_fini_array':
    (.text+0x7f): undefined reference to `_fini_array_start'
    C:\Documents and Settings\Evgenii\My Documents\e2studio\workspace\spectrum\HardwareDebug\libspectrum.a(gcrt0.o): In function `rl78_run_fini_array':
    (.text+0x82): undefined reference to `_fini_array_end'
    ./src/reset_program.o: In function `L0':
    C:\Documents and Settings\Evgenii\My Documents\e2studio\workspace\spectrum\HardwareDebug/../src/reset_program.asm:59:(.text+0xb): relocation truncated to fit: R_RL78_DIR16S against symbol `mdata' defined in .data section in spectrum.x
    ./src/spectrum.o: In function `main':
    C:\Documents and Settings\Evgenii\My Documents\e2studio\workspace\spectrum\HardwareDebug/../src/spectrum.cpp:37:(.text+0xa): relocation truncated to fit: R_RL78_DIR16S against symbol `__gxx_personality_sj0' defined in .text.__gxx_personality_sj0 section in C:\Renesas\e2studio\GNURL7~1.02-\rl78-elf\rl78-elf\lib\libstdc++.a(eh_personality.o)
    C:\Documents and Settings\Evgenii\My Documents\e2studio\workspace\spectrum\HardwareDebug/../src/spectrum.cpp:46: undefined reference to `PFDL_Open(pfdl_descriptor_t*)'
    C:\Renesas\e2studio\GNURL7~1.02-\rl78-elf\rl78-elf\lib\libstdc++.a(eh_personality.o): In function `__gxx_personality_sj0':
    (.text.__gxx_personality_sj0+0x2a): relocation truncated to fit: R_RL78_DIR16S against symbol `__gxx_personality_sj0' defined in .text.__gxx_personality_sj0 section in C:\Renesas\e2studio\GNURL7~1.02-\rl78-elf\rl78-elf\lib\libstdc++.a(eh_personality.o)
    C:\Renesas\e2studio\GNURL7~1.02-\rl78-elf\rl78-elf\lib\libstdc++.a(eh_personality.o): In function `__gxx_personality_sj0':
    (.text.__gxx_personality_sj0+0x3d): relocation truncated to fit: R_RL78_DIR16S against `.L179'
    C:\Renesas\e2studio\GNURL7~1.02-\rl78-elf\rl78-elf\lib\libstdc++.a(eh_personality.o): In function `__gxx_personality_sj0':
    (.text.__gxx_personality_sj0+0xb92): relocation truncated to fit: R_RL78_DIR16S against symbol `typeinfo for __cxxabiv1::__forced_unwind' defined in .rodata._ZTIN10__cxxabiv115__forced_unwindE[_ZTIN10__cxxabiv115__forced_unwindE] section in C:\Renesas\e2studio\GNURL7~1.02-\rl78-elf\rl78-elf\lib\libstdc++.a(eh_exception.o)
    C:\Renesas\e2studio\GNURL7~1.02-\rl78-elf\rl78-elf\lib\libstdc++.a(eh_personality.o): In function `__gxx_personality_sj0':
    (.text.__gxx_personality_sj0+0xb9e): relocation truncated to fit: R_RL78_DIR16S against symbol `typeinfo for __cxxabiv1::__foreign_exception' defined in .rodata._ZTIN10__cxxabiv119__foreign_exceptionE[_ZTIN10__cxxabiv119__foreign_exceptionE] section in C:\Renesas\e2studio\GNURL7~1.02-\rl78-elf\rl78-elf\lib\libstdc++.a(eh_exception.o)
    C:\Renesas\e2studio\GNURL7~1.02-\rl78-elf\rl78-elf\lib\libstdc++.a(eh_personality.o): In function `__cxa_call_unexpected':
    (.text.__cxa_call_unexpected+0x3): relocation truncated to fit: R_RL78_DIR16S against symbol `__gxx_personality_sj0' defined in .text.__gxx_personality_sj0 section in C:\Renesas\e2studio\GNURL7~1.02-\rl78-elf\rl78-elf\lib\libstdc++.a(eh_personality.o)
    C:\Renesas\e2studio\GNURL7~1.02-\rl78-elf\rl78-elf\lib\libstdc++.a(eh_personality.o): In function `__cxa_call_unexpected':
    (.text.__cxa_call_unexpected+0x16): relocation truncated to fit: R_RL78_DIR16S against `.L241'
    C:\Renesas\e2studio\GNURL7~1.02-\rl78-elf\rl78-elf\lib\libstdc++.a(eh_personality.o): In function `__cxa_call_unexpected':
    (.text.__cxa_call_unexpected+0x160): relocation truncated to fit: R_RL78_DIR16S against symbol `typeinfo for std::bad_exception' defined in .rodata._ZTISt13bad_exception[_ZTISt13bad_exception] section in C:\Renesas\e2studio\GNURL7~1.02-\rl78-elf\rl78-elf\lib\libstdc++.a(eh_exception.o)
    C:\Renesas\e2studio\GNURL7~1.02-\rl78-elf\rl78-elf\lib\libstdc++.a(eh_personality.o): In function `__cxa_call_unexpected':
    (.text.__cxa_call_unexpected+0x18d): relocation truncated to fit: R_RL78_DIR16S against symbol `vtable for std::bad_exception' defined in .rodata._ZTVSt13bad_exception[_ZTVSt13bad_exception] section in C:\Renesas\e2studio\GNURL7~1.02-\rl78-elf\rl78-elf\lib\libstdc++.a(eh_exception.o)
    C:\Renesas\e2studio\GNURL7~1.02-\rl78-elf\rl78-elf\lib\libstdc++.a(eh_personality.o): In function `__cxa_call_unexpected':
    (.text.__cxa_call_unexpected+0x197): additional relocation overflows omitted from the output
    C:\Documents and Settings\Evgenii\My Documents\e2studio\workspace\spectrum\HardwareDebug\libspectrum.a(mcount.o): In function `_monstartup':
    (.text+0x66a): undefined reference to `ffs'
    C:\Documents and Settings\Evgenii\My Documents\e2studio\workspace\spectrum\HardwareDebug\libspectrum.a(svfprintf.o): In function `_svfprintf_r':
    (.text+0xecd): undefined reference to `__fpclassifyf'
    C:\Documents and Settings\Evgenii\My Documents\e2studio\workspace\spectrum\HardwareDebug\libspectrum.a(svfprintf.o): In function `_svfprintf_r':
    (.text+0x1e2e): undefined reference to `__fpclassifyf'
    make: *** [spectrum.x] Error 1

    What could be the problem?