Author Topic: Feeding linker script to LD, Sourcery G++ toolchain, Cortex-M3 target  (Read 13873 times)

Offline pkrcel

  • Multiple posting newcomer
  • *
  • Posts: 17
Hi there,
 I am migrating a simple project for my cortex-M3 target to C::B from Raisonance's RIDE.

So far I have been successful, but for one thign, I do not know how to feed the linker with a custom linker script.
By all means it is no custom but the standard linker script for ST Microelectronics STM32F10x ARM-Cortex-M3 devices.

I think I could do it with the "other options" tab under compiler/linker settings, and feed the linker with -T<scriptfile> (or better -WL,.T<scriptfile>, but I am somewhat confident there are other methods, since I may use two different scripts, and I would like not to use several build targets, and I am not all *that* keen on using C::B yet.

(To those who may wonder, my app is a very simple demo so basically all the code can reside in the taregt SRAM, since it's way less that 0x5000 in size).

Cheers
-Andy

EDIT: to many typos
« Last Edit: November 11, 2008, 11:21:17 am by pkrcel »

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Feeding linker script to LD, Sourcery G++ toolchain, Cortex-M3 target
« Reply #1 on: November 11, 2008, 12:12:50 pm »
If you don't want separate build targets, all that's left is using a global compiler variable for the script file's name. Look at the Wiki for a description of them.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline pkrcel

  • Multiple posting newcomer
  • *
  • Posts: 17
Re: Feeding linker script to LD, Sourcery G++ toolchain, Cortex-M3 target
« Reply #2 on: November 11, 2008, 12:35:13 pm »
Thanks a lot Thomas, I actually tried both ways and I defined LDSCRIPT gloabl variable, feeding -T$(LDSCRIPT) to the linker, this works clean&fast.

Althou, I have to reconsider using build targets...cause I have the ffeling It will be a bit more straightforward when I'll have to handle different board configurations.

Thanks again for your help

Cheers
-Andy

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Feeding linker script to LD, Sourcery G++ toolchain, Cortex-M3 target
« Reply #3 on: November 11, 2008, 01:10:18 pm »
Build targets are the "natural" thing for that, yes.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline pkrcel

  • Multiple posting newcomer
  • *
  • Posts: 17
Re: Feeding linker script to LD, Sourcery G++ toolchain, Cortex-M3 target
« Reply #4 on: November 11, 2008, 02:40:21 pm »
 :D

Hehe, at least I've figured it out..I guess chances I get a bit more used to C::B are fairly high.  :wink: