modify data placement from RAM to SDRAM using the script icf file

Hello I am using e2 studio Version: 5.3.1.002 AND ssp1.2.2 with a custom board and a Synergy S5D9. And IAR compiler and lkinker . I get this error when I build the Project: Error[Lp011]: section placement failed unable to allocate space for sections/blocks with a total estimated minimum size of 0xa0f50 bytes (max align 0x8) in <[0x1ffe0000-0x2007ffff]> (total uncommitted space 0x9fe40).

I have shown in the *.map file, that the GUIX_XXXXX_especifications.o is placed in the SRAM región and it has grown a lot. I would like to place it in SDRAM región.

I m trying to do that, typing the S5D9.icf file. 

...

place at start of VECT_region  { ro section .vectors };
place in VECT_region           { ro section .vector.* };
place in ROMREG_region         { ro section .rom_registers };
place at start of FLASH_region { block VECT_INFO };
place in FLASH_region   { block LOCK_LOOKUP,
                          ro,
                          ro section .rodata,
                          block QSPI_NON_RETENTIVE_INIT_BLOCK,
                          block RAM_INIT_CODE,
                          block USB_DEV_DESC_BLK };
/* If DTC is used, put the DTC vector table at the start of SRAM.
This avoids memory holes due to 1K alignment required by it. */
place at start of RAM_region   { rw section .ssp_dtc_vector_table };                       
place in RAM_region     { rw,
                          rw section .noinit,
                          rw section .bss,
                          rw section .data,
                          block HW_LOCK,
                          rw section HEAP,
                          rw section .stack,
                          block RAM_CODE }
                 except { rw section .bss object GUIX_XXXXX_specifications.o };
place in DF_region      { ro section .data_flash };
place in SDRAM_region   { rw section .sdram, rw section .frame ,
                          rw section .bss object GUIX_XXXXX_specifications.o };
place in QSPI_region    { section .qspi_flash };
place in QSPI_region    { block QSPI_NON_RETENTIVE_BLOCK};
place in QSPI_region    { ro section .rodata object GUIX_XXXXX_resources.o };
place in RAM_region     { last section FREE_MEM};

...

But it doesn´t work. The map file doesn´t change.

Can you help me,please?

  • Hi aochoa,

    Were you now able to relocate data from RAM to SDRAM?

    JB
    RenesasRulz Forum Moderator

    https://renesasrulz.com/
    https://academy.renesas.com/
    https://en-us.knowledgebase.renesas.com/

  • In reply to JB:

    Not yet. I am waiting for some help from you.
    Regards
    Amaia
  • In reply to aochoa:

    Hi Amaia-
    Have you looked over the IAR Guide?
    supp.iar.com/.../EWARM_DevelopmentGuide.ENU.pdf

    Warren
  • In reply to WarrenM:

    This answerd didn't help me at all.
  • One way to do it is:-

    1) For the files in question change sections names, e.g.:-

    --section .bss=.guix_bss
    --section .data=.guix_data
    --section .rodata=.guix_rodata

    Right click on the file, select "Options", C/C++ Compiler->Extra Options.

    Then , check "override inherited settings", check "use command line options" and enter the text:-

     

    2) In the linker script, add the sections .guix_bss .guix_data and .guix_rodata where you want them to be located, and the initialisation method (the example below will place the .rodata into QSPI, and the .data and .bss into SDRAM) :-

    initialize manually { section .guix_data };
    initialize manually { section .guix_bss };
    do not initialize   { ro section .guix_rodata };

     

    place in SDRAM_region   { last rw section .sdram, rw section .frame, rw section .guix_data, rw section .guix_bss };                          
    place in QSPI_region    { section .qspi_flash, ro section .guix_rodata };

    3) The sections in SDRAM will need to be initialised. This has to be done after the BSP code has initialised the SDRAM itself (e.g. in tx_application_define_user()) :-

    #include "bsp_api.h"
    #include "string.h"

    #pragma section = ".guix_data"
    #pragma section = ".guix_data_init"

    #pragma section = ".guix_bss"

    void Guix_Data_Init(void);
    void tx_application_define_user(void * first_unused_memory);

    void Guix_Data_Init(void)
    {
            char * from;
            char * to;
            uint32_t section_size;
            
            from = __section_begin(".guix_data_init");
            to = __section_begin(".guix_data");
            section_size =  __section_size(".guix_data_init");

            memcpy(to, from, section_size);

            to = __section_begin(".guix_bss");
            section_size =  __section_size(".guix_bss");

            memset(to, 0, section_size);
    }

     

    void tx_application_define_user(void * first_unused_memory)
    {
        SSP_PARAMETER_NOT_USED(first_unused_memory);
            /* The ROM to RAM copy of ".guix_data" section and the zeroing of */
            /* ".guix_bss" section need to take palce after the SDRAM has been setup */
            /* by the BSP code */
        Guix_Data_Init();
    }

  • In reply to Jeremy:

    Hi Jeremy,

    Thank you for your answer. I think that I have a problem with the SSP versión and I don't know how to change the section names. I am using e2 studio Version: 5.3.1.002 AND ssp1.2.2  and this is what i am doing:

    I type :

    --section .bss=.gui_bss; --section .data =.guix_data; --section .rodata=.guix_rodata

     

    But when I buid the Project I get this error:

     

    Command line error: in "--section .data":

                Invalid section renaming argument

       IAR ANSI C/C++ Compiler V7.71.1.11731/W32 for ARM

       Copyright 1999-2016 IAR Systems AB.

       Standalone license - IAR Embedded Workbench for Renesas Synergy 7.71

    Info: Parallel threads used: 1

     

    Thank you

    Amaia

  • In reply to aochoa:

    You have a space between .data and the = in --section .data =.guix_data; . Also the section names don't end with ; so use :-

    --section .rodata=.guix_rodata --section .bss=.gui_bss --section .data=.guix_data
  • In reply to Jeremy:

    Hello
    When I put this code:
    from = __section_begin(".guix_data_init");
    to = __section_begin(".guix_data");
    section_size = __section_size(".guix_data_init");
    I get Syntax errors.
    Do you know how can I solve them?
    Thank you.
    Amaia

  • In reply to aochoa:

    What are the errors?
  • In reply to Jeremy:

    This is what I get:

    Thank you

    Amaia

  • In reply to aochoa:

    What are the actual errors output by the compiler?
  • In reply to Jeremy:

    Hello
    The compiler doesn't output any error or warning. It's only the E2Studio Editor.

    Amaia
  • In reply to aochoa:

    The IAR complier will be outputting an error, it just won't be the last thing in the complier output window. You will have to scroll up to see the error.
  • In reply to Jeremy:

    Either that, or the complier is actually building the project correctly, and the CODAN in e2studio doesn't understand the IAR compiler specific code.

    Can you post the output of the compiler.
  • In reply to Jeremy:

    If when you build the code it looks like this in e2studio 5.x :-

     

     

    i.e. in the CDT Build console the build completes (with 0 errors) so that the linker has produced the final output, then the compiler understands the code, and compiled it correctly. In the e2studio editor, the warnings about syntax errors :-

     

     

    are totally separate, the e2studio (eclipse) CODAN that analyses the code doesn't understand the IAR specific extentions being used, and is showing warnings, these warnings can be ignored.