Yahoo Groups archive

Lpc2000

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

Message

Re: [lpc2000] problem write in flash

2004-11-15 by Charles Manning

Read the appnote this explains how to do things properly.

If your code is in ARM mode (most likely scenario) then you need some 
mechansim to jump to the IAP code which is in Thumb mode.

I use a bit of assempber code that looks like:

   .text
   .code 32

@ void DoIAPCommand(unsigned *inBuf, unsigned *outBuf)
    .global DoIAPCommand

DoIAPCommand
     stmfd r13!,{r0-r12,r14}
     bl iap_jump
     ldmfd r13!{r0-r12,r14}
     mov pc,lr

iap_jump:
      ldr r12,=0x7ffffff1
      bx r12

The DoIAPCommand can then be called from C.


On Tuesday 16 November 2004 10:24, Robert Adsett wrote:
> At 05:59 PM 11/12/04 +0000, you wrote:
> >Excuse to be still in the same issue, but already upgrad the boot
> >loader  revision 6.3, and change the file .ld and the problem
> >persist!!! in first comand "iap_entry(command, result);" the arm stop!!!
> >
> >I'm using LPC2129, that have 256K flash and 16K ram.
> >
> >Anyone can help me??
>
> I see no one else has piped up.  I can't help much since I haven't worked
> on it myself but maybe I can add a pointer.
>
> <snip>
>
> >I changed the following:
>
> <snip>
>
> >#define IAP_LOCATION 0x7ffffff1
> >
> >
> >void savesetup(struct SETUP *setup){
> >    typedef void (*IAP)(unsigned int [],unsigned int[]);
> >    unsigned int command[5];
> >    unsigned int result[2];
> >    IAP iap_entry;
> >
> >         //One copy of the structure in RAM
> >
> >         //struct SETUP setup;
> >
> >         //Pointer to the non volatile copy
> >
> >         //struct SETUP *nonvolatile;
> >         //nonvolatile = (struct SETUP*)0x38000; // Points to page 14 in
> > Flash (LPC2129)
> >
> >         //copy to RAM (if you need)
> >
> >         //setup=*nonvolatile;
> >
> >
> >         disableIRQ();
> >         disableFIQ();
> >
> >         iap_entry=(IAP) IAP_LOCATION;
> >         // get part ID
> >         command[0]=54;
> >         result[0]=0;
> >         escreve_UART0("SEIL AL ");
> >         iap_entry(command, result); // I do this just for a laugh
>
> I seem to remember there being something about Thumb mode being involved
> here.  Either having to call as a thumb routine or from a thumb
> routine.  Check the user manual, also take a look through past posts there
> has been a fair amount of discussion on the topic.
>
> And if someone were to jump in and clarify...
>
> Robert
>
> " 'Freedom' has no meaning of itself.  There are always restrictions,
> be they legal, genetic, or physical.  If you don't believe me, try to
> chew a radio signal. "
>
>                          Kelvin Throop, III
>
>
>
>
>
> Yahoo! Groups Links
>
>
>

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.