Forums

Questions about linker script with gnuarm and lpc2000

Started by Baldur Gislason December 16, 2006
I've noticed some sample lpc2000 linker scripts for the gnu tools I
see on the internet have the memory defined something like this:
MEMORY
{
flash : ORIGIN = 0, LENGTH = 262143 /* FLASH ROM
*/
ram_isp_low(A) : ORIGIN = 0x40000120, LENGTH = 223 /* variables
used by Philips ISP bootloader */
ram : ORIGIN = 0x40000200, LENGTH = 15559 /*
free RAM area */
ram_isp_high(A) : ORIGIN = 0x40003FE0, LENGTH = 32 /* variables
used by Philips ISP bootloader */
}

While others just have it like this:
MEMORY
{
ROM (rx) : ORIGIN = 0x00000000, LENGTH = 0x0003E000
RAM (rw) : ORIGIN = 0x40000000, LENGTH = 0x00004000
}

Difference being some seem to mark portions of the ram and rom off
limits to the program as they are supposedly reserved for the bootloader.
Which is correct? Is there really some RAM that I must not use in my
program?

Baldur

An Engineer's Guide to the LPC2100 Series

At 09:55 PM 12/16/06 +0000, Baldur Gislason wrote:
>I've noticed some sample lpc2000 linker scripts for the gnu tools I
>see on the internet have the memory defined something like this:
>MEMORY
>{
> flash : ORIGIN = 0, LENGTH > 262143 /* FLASH ROM
> */
> ram_isp_low(A) : ORIGIN = 0x40000120, LENGTH > 223 /* variables
>used by Philips ISP bootloader */

You only need to reserve the above if you are running from RAM after
downloading over the serial port. If you download to flash then the
flashed application is free to use it since the ISP will be finished with
it by the time the flashed program gets control.

> ram : ORIGIN = 0x40000200, LENGTH > 15559 /*
>free RAM area */
> ram_isp_high(A) : ORIGIN = 0x40003FE0, LENGTH > 32 /* variables
>used by Philips ISP bootloader */

It's only necessary to reserve the above if you either
a) plan to use IAP (programming flash while running), as far as I
remember IAP doesn't not use the low memory but it's worth double checking
the documentation.
b) Will download to RAM from the serial port ISP since the bootloader
ISP uses the IAP services to program the flash.

Robert

Another sign of the end of civilization, our technical magazines are
getting chatty
From an EETimes product descriptions 2006/08/09
".... systems that can sample gobs of inputs simultaneously"
Now just what is the technical definition for gobs again?
http://www.aeolusdevelopment.com/
Alright, according to the doc the IAP uses only the top 32 bytes.

Baldur

On Sat, Dec 16, 2006 at 05:15:38PM -0500, Robert Adsett wrote:
> At 09:55 PM 12/16/06 +0000, Baldur Gislason wrote:
> >I've noticed some sample lpc2000 linker scripts for the gnu tools I
> >see on the internet have the memory defined something like this:
> >MEMORY
> >{
> > flash : ORIGIN = 0, LENGTH > > 262143 /* FLASH ROM
> > */
> > ram_isp_low(A) : ORIGIN = 0x40000120, LENGTH > > 223 /* variables
> >used by Philips ISP bootloader */
>
> You only need to reserve the above if you are running from RAM after
> downloading over the serial port. If you download to flash then the
> flashed application is free to use it since the ISP will be finished with
> it by the time the flashed program gets control.
>
> > ram : ORIGIN = 0x40000200, LENGTH > > 15559 /*
> >free RAM area */
> > ram_isp_high(A) : ORIGIN = 0x40003FE0, LENGTH > > 32 /* variables
> >used by Philips ISP bootloader */
>
> It's only necessary to reserve the above if you either
> a) plan to use IAP (programming flash while running), as far as I
> remember IAP doesn't not use the low memory but it's worth double checking
> the documentation.
> b) Will download to RAM from the serial port ISP since the bootloader
> ISP uses the IAP services to program the flash.
>
> Robert
>
> Another sign of the end of civilization, our technical magazines are
> getting chatty
> From an EETimes product descriptions 2006/08/09
> ".... systems that can sample gobs of inputs simultaneously"
> Now just what is the technical definition for gobs again?
> http://www.aeolusdevelopment.com/
>
>
> Yahoo! Groups Links
Baldur Gislason wrote:
>
> Alright, according to the doc the IAP uses only the top 32 bytes.
>

From the LPC2138 User Manual:

"20.4.11 RAM used by ISP command handler
ISP commands use on-chip RAM from 0x4000 0120 to 0x4000 01FF. The user
could use this area, but the contents may be lost upon reset. Flash
programming commands use the top 32 bytes of on-chip RAM. The stack is
located at RAM top - 32. The maximum stack usage is 256 bytes and it
grows downwards."

As such, I keep 0x40000000..0x400001ff reserved and 0x120 reserved at
the top of RAM (0x40007ee0..0x40007fff). Small loss...
TomW
--
Tom Walsh - WN3L - Embedded Systems Consultant
http://openhardware.net http://cyberiansoftware.com http://openzipit.org
"Windows? No thanks, I have work to do..."
----------------