How to modify linker script

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

How to modify linker script

Jump to solution
2,483 Views
marco_palestro
Contributor II

Hi,
I need to allocate some code and data on specific flash addresses in my MCUXpresso project (using Kinetis K32), but I couldn't find the documentation about the linker script definition and the toolchain;

Can anybody explain which is the linker script syntax and #pragma required to customize code and data segments, or point to the relevant documentation?

Thanx in advance!

Marco

0 Kudos
Reply
1 Solution
2,478 Views
ErichStyger
Specialist I

Hi @marco_palestro ,

The linker is the GNU linker, and you can find documentation for example here: https://ftp.gnu.org/old-gnu/Manuals/ld-2.9.1/html_chapter/ld_3.html 

To place objects at specific locations you can use something like this:

unsigned char __attribute__((section (".myBufSection"))) buf[128];

See https://mcuoneclipse.com/2012/11/01/defining-variables-at-absolute-addresses-with-gcc/  for some examples.

I hope this helps,

Erich

View solution in original post

3 Replies
2,443 Views
marco_palestro
Contributor II

Thanx everybody, problem solved!

2,466 Views
diego_charles
NXP TechSupport
NXP TechSupport

Hi @marco_palestro 

Complementing the @ErichStyger help! you can additionally check this post from the community  that recommends MCUxpresso documentation and examples .

Relocating Code and Data Using the MCUXpresso IDE

If you have any issues, please let us know.

Diego

 

2,479 Views
ErichStyger
Specialist I

Hi @marco_palestro ,

The linker is the GNU linker, and you can find documentation for example here: https://ftp.gnu.org/old-gnu/Manuals/ld-2.9.1/html_chapter/ld_3.html 

To place objects at specific locations you can use something like this:

unsigned char __attribute__((section (".myBufSection"))) buf[128];

See https://mcuoneclipse.com/2012/11/01/defining-variables-at-absolute-addresses-with-gcc/  for some examples.

I hope this helps,

Erich