lpcware

simple linker script

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by IanB on Wed Aug 06 05:20:22 MST 2014
I'm learning how to use the linker.
All I want to do is put my vectors, crp word, and program in the right place, and some global variables in the RAM.

I can do this perfectly well using the .org statement in assembler, but I'd like to learn how to use the linker. I've been writing assembler for donkeys' years, and never had a linker before!

Will this work:

INCLUDE "G0003c_Debug_lib.ld"
INCLUDE "G0003c_Debug_mem.ld"

ENTRY(ResetISR)

SECTIONS
{
   .vectors : { *(.vectors) }
   . = 0x2FC;
   .crp : { KEEP(*(.crp)) }
   .text : { *(.text) }

   .data : { *(.data) } > RamLoc
}

If not, what more do I need?

(I don't need to initialise the variables, the code does that - I was always taught that assuming any startup state for variables was poor programming practice)

Outcomes