Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

In-Application Programming

2004-05-03 by Stephen Pelc

> From: "Milos Prokic" <mproki@...>
> Subject: In-Application Programming
> I'm interested in trying the in-application programming feature
> of the LPC2100. I was wondering if anyone has tried it. Any
> pointers regarding the issue, maybe even some sample code will be
> of great help.
Everything we needed for the LPC2106 is in the datasheet and App 
Note AN10256. Our Forth Stamp board (available "Real Soon Now": 
LPC2106, USB and user programmable CPLD) reprograms itself very 
reliably over USB.

We copy a small program (about 3kb) to RAM, execute it from RAM 
and then reboot the system using the watchdog.

Our interface to the IAP routines from ARM mode is this:

5 cells buffer: IAPcmd	\ -- addr ; max 5 cells
\ *G Command input buffer for IAP routines.
3 cells buffer: IAPres	\ -- addr ; max 3 cells
\ *G Result output buffer from IAP routines.

l: ^IAP
  IAPentry 1 or ,			\ entry address, Thumb 
mode

code IAP	\ *cmd *res --
\ *G The primitive to call the IAP routines.
  str	link, [ rsp, # -4 ] !
  ldr   r0, [ psp ], # 4		\ R0 = *cmd
  mov   r1, tos				\ R1 = *res
  ldr   r5, ^IAP			\ get entry address
  stmfd rsp ! { r2-r12 }
  mov   link, pc			\ link set to after BX
  bx    r5
  ldmfd rsp ! { r2-r12 }
  ldr   tos, [ psp ], # 4		\ restore TOS
  ldr   pc, [ rsp ], # 4		\ return
end-code

Stephen

--
Stephen Pelc, stephen@...
MicroProcessor Engineering Ltd - More Real, Less Time
133 Hill Lane, Southampton SO15 5AF, England
tel: +44 23 80 631441, fax: +44 23 80 339691
web: http://www.mpeltd.demon.co.uk - free VFX Forth downloads

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.