EmbDev.net

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


von Matthias (Guest)


Rate this post
useful
not useful
Hello,

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
'M`````````````````````````").

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,
Matthias

von Martin Thomas (Guest)


Rate this post
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.
http://www.standardics.philips.com/support/documents/microcontrollers/zip/flash.isp.utility.lpc2000.zip
http://www.esacademy.com/software/flashmagic/fmfree.htm

Martin Thomas

von Matthias (Guest)


Rate this post
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
wrong:
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).

Solution:
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
program.

Matthias

von Matthias (Guest)


Rate this post
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) >>>>>>>>>>>>>>>>>>>>>>>>>
_mainCRTStartup:
//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
vectorcopyloop:
  cmp   r2,r3           // check if data to move
  ldrne r0,[r1],#4      // copy it
  strne r0,[r2],#4
  bne   vectorcopyloop  // loop until done
#endif
<<<<<<<<<<<<<<<<<<<<<<<<< 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
0x40000000)
#else
  *Lpc2106::SCB_MEMMAP=0x01; //use exception vectors from Flash (at
0x00000000)
#endif
<<<<<<<<<<<<<<<<<<<<<<<<< END C++ Source code

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.