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.

Linker: automatic section splitting (cgtools 5.2.10 for C28x)



Hello,

I'm trying to use the linker to place objects in one of two memory ranges EEPROM1 and EEPROM2. In the MEMORY part of the linker command file they are defined as:

PAGE 2: /* EEPROM */
   EEPROM1     : origin = 0x1000, length = 0x1B00
   EEPROM2     : origin = 0x3000, length = 0x2000

In the SECTIONS part of the linker command file I use them as follows

   eeprom : >> EEPROM1 | EEPROM2, PAGE = 2

The objects to be placed in section "eeprom" are all defined in one C file in the following way:

#pragma DATA_SECTION(foo,"eeprom")
char foo[10];

According to section 7.8.6 of spru513c.pdf I would expect  the objects of section "eeprom" to be placed in EEPROM1 or EEPROM2 as long as there is enough space there. Unfortunately, when linking I get the error

   run placement fails for object "eeprom", size 0x21c8 (page 2).  Available
   ranges:
   EEPROM1      size: 0x1b00       unused: 0x1b00       max hole: 0x1b00
   EEPROM2      size: 0x2000       unused: 0x2000       max hole: 0x2000   

as soon as the size of section "eeprom" exceeds the size of EEPROM2.

I would appreciate any help on how to distribute the contents of section "eeprom" to EEPROM1 and EEPROM2.

Another option would be to define one memory range EEPROM starting at 0x1000 with length 0x4000. With only one memory range I would need a way to tell the linker not to use the address range from 0x1b00 to 0x2000. Any ideas on how to achieve this?

Regards

Johannes

 

 

  • In order to be split by the linker, the data objects need to be in separate linker input sections.  Otherwise, the linker sees only one monolithic section and cannot split it.  If you put all of the objects in the same data section, the assembler will combine them all into one large linker input section.  You can keep them separate by giving each object its own unique subsection of "eeprom", or by putting each object it a separate C file.  For example:

    #pragma DATA_SECTION(foo,"eeprom:foo")
    char foo[10]; #pragma DATA_SECTION(foo,"eeprom:bar") char bar[10];
  • Thank you for the quick and helpful response.

    Johannes