Forum: ARM programming with GCC/GNU tools RAM_RUN: bug in "lpc21isp.exe"?

von Matthias (Guest)

Rate this post
0 useful
not useful

I am having troubles loading a small (test-)program into the RAM of my
LPC2106 using "lpc21isp.exe" V1.31: the program can not be executed.
When compiling the program for ROM (setting RUN_MODE=ROM_RUN in the
Makefile), everything works fine. The program is based on the WinARM
example "lpc2106_blink_switch".

Anyone who had similar problems and knows a workaround?

I suspect that "lpc21isp.exe" might be the reason for this, because a
manual read back of the LPC2106 memory contents using the Bray Terminal
shows correct content at address 0x00000000 (ROM), but only random
numbers at address 0x40000000 (RAM). Apart from this, when looking at
the debug output from "lpc21isp.exe", the ROM programming session shows
"meaningful" UUE data being transmitted, whereas the RAM programming
session seems to transmit only zeros (the log looks like "Sending

Details: I have put a copy of Output-Log, Readback memory content and
Project files (both for working ROM_RUN and non-working RAM_RUN mode)
to: http://www.steiner-online.at/lpc2106/rambug.zip

Thanks in advance,

von Martin Thomas (Guest)

Rate this post
0 useful
not useful
Sorry, no direct answer to your question from my side since I have not
tried lpc21isp with upload to RAM. Did you try the version 1.37? It's
called lpc21isp_beta.exe in my WinARM collection located in WinARM\bin.
Did you search in the lpc21isp yahoo-group messages
(http://groups.yahoo.com/group/lpc21isp/ )? The yahoo-group might be a
better place for your "support-request".
As an alternative you might try the Philips programming-tool or the tool
from Embedded System Academy.

Martin Thomas

von Matthias (Guest)

Rate this post
0 useful
not useful
Martin Thomas wrote:
> ...
> As an alternative you might try the Philips programming-tool or the tool
> from Embedded System Academy.
> ...

Thanks Martin for your help.
The Philips Flash-Utility does not support programming into the RAM. But
with the tool from Embedded System Academy I found out what is going
The ISP command handler uses the RAM memory locations
0x40000000-0x40000217 and 0x4000fee0-0x4000ffff.
During programming into RAM, the handler seems to overwrite these
locations with a mixture of the programming data and its own runtime
data (thereby killing itself).

Prevent the linker from placing data into these locations by defining a
somewhat smaller RAM memory in the linker script (in my case the file
"LPC2106-RAM.ld") using the instruction:
RAM (rw) : ORIGIN = 0x40000300, LENGTH = 0x0000fb00
Then "lpc21isp.exe" V1.31 successfully transmits and executes the


von Matthias (Guest)

Rate this post
0 useful
not useful
Matthias wrote:
> RAM (rw) : ORIGIN = 0x40000300, LENGTH = 0x0000fb00

For interrupts to work correctly in RAM_RUN mode with LPC2106, you might
want to include something like the following two sections in your code:

Assembler startup code (e.g. in crt0.S) >>>>>>>>>>>>>>>>>>>>>>>>>
//If the program is running from SRAM, copy the interrupt vector area to
the start of the SRAM:
#ifdef RAM_RUN
  ldr   r1,=Vectors     // Copy source: vectors placed by linker
  ldr   r2,=0x40000000  // Copy destination start: SRAM start address
  ldr   r3,=0x40000040  // Copy destination end
  cmp   r2,r3           // check if data to move
  ldrne r0,[r1],#4      // copy it
  strne r0,[r2],#4
  bne   vectorcopyloop  // loop until done
<<<<<<<<<<<<<<<<<<<<<<<<< END assembler startup code (e.g. in crt0.S)

C++ Source code >>>>>>>>>>>>>>>>>>>>>>>>>
#ifdef RAM_RUN
  *Lpc2106::SCB_MEMMAP=0x02; //use exception vectors from SRAM (at
  *Lpc2106::SCB_MEMMAP=0x01; //use exception vectors from Flash (at
<<<<<<<<<<<<<<<<<<<<<<<<< END C++ Source code


Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]

Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.