100% Linker Generated Section

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

100% Linker Generated Section

829 Views
emagii
Contributor II

We want to generate an application which starts with a header.
This header should be generated in the linker.

When I do that, I can see that the S-Record file contains the correct info,
but the map file says that the section is empty, and when I download to the target,
the section is missing.

MEMORY
{
   header: org = 0x00008000, len = 0x00000100
   ...
}

SECTIONS
{

    .header LOAD(ADDR(header)) : {
         __MAGIC_BEGIN = .;

         LONG(MAGIC);

         CRC = .;
         LONG(0x0);

         ...

         __MAGIC_END = .;

         LONG(MAGIC);

   } > header

}

I have figured out a way to replace the magic words by two assembler sections,
but would like to understand why the section is ignored.
The application reads from the header, so there should be dependencies.

0 Kudos
1 Reply

756 Views
stanish
NXP Employee
NXP Employee

Hi emagii,

Thanks for this question.

Indeed certain CodeWarrior linker keywords (such as LONG, BYTE, FILL...) influences just the output binary file (mot) and not the executable file/map file. 

Anyway if you intend on creating a section I'd suggest to create a dummy asm file (e.g. magic.s) and define magic words as:

.section .header1
.long 0x12345678
.section .header2
.long 0xDEADBEEF

and adjust the lcf file:

  .header LOAD(ADDR(header)) : {
        __MAGIC_BEGIN = .;
        *(.header1)

        CRC = .;
        LONG(0x0);

        __MAGIC_END = .;
 	*(.header2)
   } > header

when compiled you should see the section in .map and after .elf file loading the memory content should be as expected.

stanish_0-1645138182781.png

 

Hope it helps.

Stan

 

0 Kudos