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/TMS320F280049C: Linker problem for section with the same size as struct

Part Number: TMS320F280049C

Tool/software: TI C/C++ Compiler

Hi All,

I have a weird problem regarding my linking and for now I am assuming it is a alignment problem but to my understanding there should not be a problem.

I have 4 sections in the Linker cmd file for dividing the first 2 sectors of the flash in 5 sections (one for code, the others for definition of certain structs)

FLASHB0_SECT_1 : origin = 0x080002, length = 0x001F72
FLASHB0_SECT_2 : origin = 0x081F74, length = 0x000038
FLASHB0_SECT_3 : origin = 0x081FAC, length = 0x000040
FLASHB0_SECT_4 : origin = 0x081FEC, length = 0x000004
FLASHB0_SECT_5 : origin = 0x081FF0, length = 0x000010

The section definition is then done using the alignment ALIGN(4) because of the necessary 64 bit alignment for ECC.

StructSectionName2 : > FLASHB0_SECT_2, PAGE = 0, ALIGN(4)
StructSectionName3 : > FLASHB0_SECT_3, PAGE = 0, ALIGN(4)
StructSectionName4 : > FLASHB0_SECT_4, PAGE = 0, ALIGN(4)
StructSectionName5 : > FLASHB0_SECT_5, PAGE = 0, ALIGN(4)

The Structs are placed in the corresponding section using:

#pragma DATA_SECTION("StructSectionNameX ");

StructX StructXInstance;

So that should work for my understanding but I get the following Linker errors regarding placement fails:

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. run placement with alignment/blocking fails for section "StructSectionName3" size 0x40page 0. Available memory ranges:
FLASHB0_SECT_3 size: 0x40 unused: 0x40 max hole: 0x40

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. run placement with alignment/blocking fails for section "StructSectionName2" size 0x38page 0. Available memory ranges:
FLASHB0_SECT_2 size: 0x38 unused: 0x38 max hole: 0x38

It seems like the size of FLASHB0_SECT_4 results in a 128 Bit unalignment which cannot be resolved because  why else wouldn't the size 0x40 section fit in the 0x40 hole.

Why isn't it possible to place the blocks 64 Bit aligned? Did I miss something in the documentation?

Best regards

Wolfgang

  • Okay the problem seems to be that the structs were defined as static members of a class. As global variables it works.

    I would still be interested why it is not working in that case if anybody could explain.

    Thanks and best regards

    Wolfgang

  • Is your program organized as a project in Code Composer Studio?  If so, I'd appreciate if you would zip it up according to the instructions in the article Sharing Projects, then attach the zip file to your next post.  

    Thanks and regards,

    -George