linker script and compilers.....

May 03, 2010 4 Replies

Hi, I was trying to setup an environment to compile programs for an STM32. One of the steps is to write a linker script. Now my question is: what does the linker script depend on? I think that it depends on the the compiler used. But, how can I write from scratch a new linker script? I suppose I have to know which are the sections present in my object file. But they are so much dependent on the compiler?



Thanks,


-- Carlo


--- news://freenews.netfront.net/ - complaints: snipped-for-privacy@netfront.net ---


Yes - it is very dependent on the compiler being used, although you don't mention the compiler you are actually using.

Normal practice would be to start with a linker script from an example project provided with your compiler (or from the microcontroller vendors site, or otherwise found elsewhere) that targets the microcontroller you are using. If the microcontroller derivative is the same (same memory map) then the chances are you won't even have to modify it.

[just noticed this was posted to gnu.gcc too, so I would guess you are using GCC].
Regards, Richard. + http://www.FreeRTOS.org Designed for Microcontrollers. More than 7000 downloads per month. + http://www.SafeRTOS.com Certified by T=DCV as meeting the requirements for safety related systems= =2E

Sorry for crossposting. Yes, I would use ARM EABI Lite version of the CodeSourcery G++. Thank you for your reply. And it is a nice coincidence because I'm trying to put FreeRTOS on STM32 using Eclipse + CodeSourcery + openOCD.

Regards,

-- Carlo

--- news://freenews.netfront.net/ - complaints: snipped-for-privacy@netfront.net ---

rs

ou

In which case, maybe this link will help you:

formatting link

--=20

Regards, Richard.

  • formatting link
    Designed for Microcontrollers. More than 7000 downloads per month.

  • formatting link
    Certified by T=DCV as meeting the requirements for safety related systems= =2E

It depends on the compiler used (you need to know what section names to expect) and on the linker used (you need to know the syntax and semantics for linker scripts).

1) Read the manuals for the linker and compiler. 2) Look at existing linker scripts.

Yes.

Yes.

Grant Edwards grant.b.edwards Yow! Gee, I feel kind of at LIGHT in the head now, gmail.com knowing I can't make my satellite dish PAYMENTS!

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required