EmbeddedRelated.com
Forums

linker script and compilers.....

Started by Carlo Caione May 3, 2010
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: news@netfront.net ---
On 03/05/2010 14:06, Carlo Caione wrote:
> 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? >=20 > Thanks, >=20 > --=20 > Carlo >=20 > --- news://freenews.netfront.net/ - complaints: news@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
On 03/05/2010 15:25, FreeRTOS info wrote:

> 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].
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: news@netfront.net ---
On 03/05/2010 14:59, Carlo Caione wrote:
> On 03/05/2010 15:25, FreeRTOS info wrote: >=20 >> 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 vendo=
rs
>> site, or otherwise found elsewhere) that targets the microcontroller y=
ou
>> 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]. >=20 > 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.=
In which case, maybe this link will help you: http://sites.google.com/a/stf12.net/developer-sw-fw/eclipse-demo --=20 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
On 2010-05-03, Carlo Caione <carlo.caione@gmail.com> wrote:

> 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.
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).
> But, how can I write from scratch a new linker script?
1) Read the manuals for the linker and compiler. 2) Look at existing linker scripts.
> I suppose I have to know which are the sections present in my object > file.
Yes.
> But they are so much dependent on the compiler?
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!