Code::Blocks Forums

User forums => Embedded development => Topic started by: pkrcel on November 11, 2008, 10:56:20 am

Title: Feeding linker script to LD, Sourcery G++ toolchain, Cortex-M3 target
Post by: pkrcel on November 11, 2008, 10:56:20 am
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
Title: Re: Feeding linker script to LD, Sourcery G++ toolchain, Cortex-M3 target
Post by: thomas 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.
Title: Re: Feeding linker script to LD, Sourcery G++ toolchain, Cortex-M3 target
Post by: pkrcel 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
Title: Re: Feeding linker script to LD, Sourcery G++ toolchain, Cortex-M3 target
Post by: thomas on November 11, 2008, 01:10:18 pm
Build targets are the "natural" thing for that, yes.
Title: Re: Feeding linker script to LD, Sourcery G++ toolchain, Cortex-M3 target
Post by: pkrcel 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: