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.

TMS320F2800157: Linker will not include .const section

Part Number: TMS320F2800157

Hi,

I'm new to fitting everthing into a defined part of Flash using the linker script.  I've got an TMS320F2800157 LaunchPad that the application needs to run from flash. 

The current linker script is below and I admit I've hacked it together to get this far.   My desire is to contain all the application in Flash and I don't feel that I need to control how it is stored in flash.  I am writing a bootloader running from RAM that can reflash it , but I plan just to wipe all of flash at once.  Thus I think I'm ok just handling all of flash as one block.

Using the script below, I'm getting the following error:

../280015x_generic_flash_lnk.cmd", line 28: warning #10097: memory range not found: FLASH_BANK0_SEC_127 on page 1
../280015x_generic_flash_lnk.cmd", line 28: error #10265: no valid memory range available for placement of ".const"
../280015x_generic_flash_lnk.cmd", line 28: error #10099-D: program will not fit into available memory, or the section contains a call site that requires a trampoline that can't be generated for this section. placement with alignment/blocking fails for section ".const" size 0x1db6 page 1

Linker script below:

MEMORY
{
   BEGIN            : origin = 0x00080000, length = 0x00000002  
   BOOT_RSVD        : origin = 0x00000002, length = 0x00000126
   RAMM0            : origin = 0x00000128, length = 0x000002D8
   RAMM1            : origin = 0x00000400, length = 0x000003F8
   RAMLS0           : origin = 0x00008000, length = 0x00002000
   RAMLS1           : origin = 0x0000A000, length = 0x00001FF8
   BOOTROM          : origin = 0x3F8000, length = 0x7FC0 /* Boot Rom*/
   RESET            : origin = 0x003FFFC0, length = 0x00000002

   /* Flash sectors */
   FLASH_BANK0_SEC_0_127   : origin = 0x080002, length = 0x1FFEE  /* on-chip Flash */
   // FLASH_BANK0_SEC_127_RSVD : origin = 0x0A0FF0, length = 0x0010  /* Reserve and do not use for code as per the errata advisory "Memory: Prefetching Beyond Valid Memory" */
}

SECTIONS
{
    codestart        : > BEGIN
   .text            : >> FLASH_BANK0_SEC_0_127, ALIGN(8)
   .cinit           : > FLASH_BANK0_SEC_0_127, ALIGN(8)
   .switch          : > FLASH_BANK0_SEC_0_127, ALIGN(8)
   .reset           : > RESET,  TYPE = DSECT /* not used, */
   .stack           : > RAMM1
   .bss             : > RAMLS0
   .bss:output      : > RAMLS0
//   .init_array      : >> FLASH_BANK0_SEC_127, ALIGN(8)
   .const           : >> FLASH_BANK0_SEC_127 , ALIGN(8)
   .data            : > RAMLS0
   .sysmem          : > RAMLS0
  .bss:cio          : > RAMLS0


#if defined(__TI_EABI__)
   .TI.ramfunc      : LOAD = FLASH_BANK0_SEC_0_127,
                      RUN = RAMLS0,
                      LOAD_START(RamfuncsLoadStart),
                      LOAD_SIZE(RamfuncsLoadSize),
                      LOAD_END(RamfuncsLoadEnd),
                      RUN_START(RamfuncsRunStart),
                      RUN_SIZE(RamfuncsRunSize),
                      RUN_END(RamfuncsRunEnd),
                      ALIGN(8)
#else
   .TI.ramfunc      : LOAD = FLASH_BANK0_SEC_0_127,
                      RUN = RAMLS0,
                      LOAD_START(_RamfuncsLoadStart),
                      LOAD_SIZE(_RamfuncsLoadSize),
                      LOAD_END(_RamfuncsLoadEnd),
                      RUN_START(_RamfuncsRunStart),
                      RUN_SIZE(_RamfuncsRunSize),
                      RUN_END(_RamfuncsRunEnd),
                      ALIGN(8)
#endif

    /*  Allocate IQ math areas: */
   IQmath           : > BOOTROM, type = NOLOAD, PAGE = 0
   IQmathTables     : > BOOTROM, type = NOLOAD, PAGE = 0
}

I've looked at the map file and found that the highest address used in flash is 00090268 and the flash extends to 0x9FFFF.  The .const segment needs 00001dc0.  How do I tell the linker to just add it to the block of flash?

Thanks in advance,

John

  • Hi John,

    Please update the .const section defined, there is an error in the naming.

    Wrong -   .const : >> FLASH_BANK0_SEC_127 , ALIGN(8)

    Correct - .const : >> FLASH_BANK0_SEC_0_127 , ALIGN(8)

    Thanks

    Aswin