Relocating code and data - unsure about differences between example linker file and default linker file

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

Relocating code and data - unsure about differences between example linker file and default linker file

Jump to solution
648 Views
gorakk
Contributor IV

I am working on placing some code into RAM.  Using: CodeWarrior 10.6, GCC C compiler, MQX 4.1.1, TWR-K60F120M

 

This document: Relocating Code and Data Using the CW GCC Linker File for Kinetis

 

shows the following .ld file example in section 4.3 Relocating Code in RAM - ‘.mydata’ has been added to the ‘.data’ section (line 8):

 

/* Initialized data sections goes into RAM, load LMA copy after code */ .data : AT(___ROM_AT) {      . = ALIGN(4);      _sdata = .; /* create a global symbol at data start */      *(.data) /* .data sections */      *(.data*) /* .data* sections */      *(.mydata) /* .mydata relocates a function on any RAM address */      . = ALIGN(4);      _edata = .; /* define a global symbol at data end */ } > m_data

 

But when I look at the .ld file for my project, the .data section is quite different:

 

    .data :     {         . = ALIGN(128);         /* create _sdata symbol which keep          relocation(execution) address of data start */         _sdata = .;         __VECTOR_TABLE_RAM_START = .;         KEEP(*(.vectors_ram))           . = ALIGN(512);         __BDT_BASE = .;         *(.usb_bdt)         __BDT_END = .;           . = ALIGN(0x4);         *(.exception)         . = ALIGN(0x4);         __exception_table_start__ = .;         __exception_table_end__ = .;           __START_DATA = .;         *(.data*)         *(.mydata)         __END_DATA = .;           . = ALIGN(0x4);         __START_SDATA = .;         *(.sdata*)         __END_SDATA = .;           . = ALIGN(0x4);         __SDA_BASE  = .;         __SDA_BASE_ = __SDA_BASE;           . = ALIGN(0x10);         /* create _edata symbol which keep          relocation(execution) address of data end */         _edata = .;     } > ram AT> rom

 

I added '*(.mydata)' on line 26 .  Is that the correct placement?  When I build the project and then look at the generated .map file it appears that the function is placed correctly in RAM but I would appreciate it if someone could verify the placement of '*(.mydata)' to the linker file.

Labels (1)
Tags (3)
0 Kudos
1 Solution
430 Views
Carlos_Mendoza
NXP Employee
NXP Employee

Hi Allen,

The .mydata section is correctly positioned. The *.ld file from the document belongs to a bareboard project, that is why you see some differences with the *.ld file from your MQX project.

Hope it helps!

Best Regards,

Carlos Mendoza

Technical Support Engineer

-----------------------------------------------------------------------------------------------------------------------

Note: If this post answers your question, please click the Correct Answer button. Thank you!

-----------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
1 Reply
431 Views
Carlos_Mendoza
NXP Employee
NXP Employee

Hi Allen,

The .mydata section is correctly positioned. The *.ld file from the document belongs to a bareboard project, that is why you see some differences with the *.ld file from your MQX project.

Hope it helps!

Best Regards,

Carlos Mendoza

Technical Support Engineer

-----------------------------------------------------------------------------------------------------------------------

Note: If this post answers your question, please click the Correct Answer button. Thank you!

-----------------------------------------------------------------------------------------------------------------------

0 Kudos