This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Compiler/CC1310: How to linked a section at the end

Part Number: CC1310
Other Parts Discussed in Thread: SYSBIOS

Tool/software: TI C/C++ Compiler

Hello,

I'm modifying my cmd linker file and i would like a section to be linked after all the other but each time i try, my section is not the last one and there is always a section linked after (.cinit). Is there a way to linked a section at the end of the binary ?

Best regards,

Aurélien

  • Here is the output mapping :

    0001739c cryptoDriverTable
    000173c4 rfPatchTable
    000173d4 txPwrTbl
    000173e0 __ccfg
    00017438 version_header
    00017470 __TI_static_base__
    00017838 __TI_Handler_Table_Base
    00017844 __TI_Handler_Table_Limit
    00017878 __TI_CINIT_Base
    000178d8 __TI_CINIT_Limit
    0001e000 NV_FLASH
    1001a001 ti_sysbios_knl_Semaphore_pend__E

    Actually, i would like my version header put at the end, that is to say after 0x000178d8. is it possible.

    Regards,

    Aurélien
  • And here is the linker file :

    SECTIONS
    {
    .intvecs : > FLASH
    .text : > FLASH
    config_const { mac_user_config.obj(.const) } > FLASH

    .const : > FLASH
    .constdata : > FLASH
    .rodata : > FLASH
    .cinit : > FLASH
    .pinit : > FLASH
    .init_array : > FLASH
    .emb_text : > FLASH
    .ccfg : > FLASH
    .vheader : > FLASH

    GROUP > SRAM
    {
    .data
    .bss
    .vtable
    .vtable_ram
    vtable_ram
    .sysmem
    .nonretenvar
    } LOAD_END(heapStart)

    .stack : > SRAM (HIGH) LOAD_START(heapEnd)

    .shared_ram : > SHARED_RAM

    #if defined(USE_CACHE_RAM)
    .cache_ram : > CACHE_RAM
    #endif
    }

    But, when i'm using this linker file, the ICall_Init is not starting anymore ...
  • Which section do you want to be last?  Use the HIGH location specifier, as you already do with .stack,

    user5061660 said:
    .stack : > SRAM (HIGH) LOAD_START(heapEnd)

    to make that section the last one in that memory range.

    Thanks and regards,

    -George

  • Hi,

    I would like the .vheader to be the last one. This is my version header, and i would like to compute my crc on all the binary part that is before. If i use (HIGH), it will be put exactly at the end of the section with unused bytes before, and i don't want this.

    Regards,

    Aurélien

  • Hello,

    When i'm using this :

    #define FLASH_BASE 0x00001000
    #define FLASH_BASE_SIZE 0x1D000
    [...]
    FLASH (RX) : origin = FLASH_BASE, length = FLASH_BASE_SIZE
    [...]
    .vheader : > FLASH (HIGH)

    And this in my code :

    const volatile sVERSION_HEADER version_header __attribute__((section(".vheader"))) = {

    I am always having an assert in Icall_init ... Is there an explanation ?

    Regards,

    Aurélien
  • user5061660 said:
    I would like the .vheader to be the last one. This is my version header, and i would like to compute my crc on all the binary part that is before. If i use (HIGH), it will be put exactly at the end of the section with unused bytes before, and i don't want this.

    Then the only method is to use GROUP.  Everything that must be before .vheader must be in the GROUP.  Then .vheader goes last.

    One possible downside ... You might see a diagnostic like this one ...

    warning: output section ".data" refers to load symbol "_nop" and hence cannot
       be compressed; compression "lzss" is ignored

    Long story short ... It means that the .data section could be made even smaller.  The linker attempted to apply a compression technique, but couldn't.  If you are meeting your memory size goals, then you can ignore this diagnostic.

    Thanks and regards,

    -George

  • user5061660 said:
    I am always having an assert in Icall_init ... Is there an explanation ?

    I'm not sure what you mean by an assert.  What do you see that makes you think something is wrong?  How do you see it?

    Thanks and regards,

    -George

  • Hi,

    Thank you very much. Indeed i used the GROUP method and it works perfectly. Regarding the assert, it was due to my code :)

    Best regards,

    Aurélien
  • Hello,

    I have done as you recommanded and indeed vheader goes to the end but i'm having this kind of warnings as you've already said :

    output section ".data:ti_sysbios_BIOS_Module__state__V" refers to load symbol "ti_sysbios_BIOS_startFunc__I" and hence cannot be compressed; compression "lzss" is ignored

    output section ".data" refers to load symbol "ICall_enterCSImpl" and hence cannot be compressed; compression "lzss" is ignored

    I think i'm not losing so much flash because the two sections that are not compressed are not so big but if you know how to avoid these warnings feel free to share :)

    Regards,

    Aurélien
  • user5061660 said:
    if you know how to avoid these warnings feel free to share :)

    Do not put the sections .cinit and .data in the same GROUP.  The same is true of any other section referred to by .cinit.

    The full explanation of this situation is long and detailed.  Please see this thread for a start.

    Thanks and regards,

    -George

  • Hi,

    Indeed, when I put .cinit in a different group, the warning disappears but ".cinit" goes to the end of the flash, just above my vheader section, and i don't want this :(

    I will take a look at the thread you shared.

    Thank you very much ;)

    Regards,

    Aurélien