Forums

LPC2478 IAR Bootloader/IAP

Started by mike_schwarzer March 13, 2010
Dear Group,

I hope someone could help me with following troubles:
I'm trying to implement a Firmware Update Funktion to my Application.
I use the LPC2478 and IAR Workbench.

My first try was to use IAP direct withhin my application, of course,
the IAP Functions themself where put to a 'special' Flash Region
(Thanks to Mark for giving me the correct #pragma Option).

On that way i could update 'nearly' update my application, but
one Sector dont gets erased and a blanckcheck diddnt return, but
runs in an prefetch abort.

So I'm now trying to build a 'standalone' bootloader.
My Setup for that is:
1.
Bootloader uses Int Vector Table in Flash (0x00000000)
2.
On Start it checks for new 'Code'
2a.
If there is new Code, it will flash it.

Then it try to copy the Application INT Vektors to RAM (0x40000000)
Maps the Ram Vector Table
and should start Apllication.

I use following Code to Copy the Int Vectors:

#define INTVECT_RAM_ADDR 0x00000000
#define APP_START_ADDR 0x00007000
typedef void (*JUMP_ADDR)(void);
.........
__disable_interrupt();
//---- Wenn Nein, vorhandene Application starten
pSrc = (pInt32U)APP_START_ADDR; // Flash Int. Vektoren
pDst = (pInt32U)INTVECT_RAM_ADDR; // RAM Int Vektoren

for (int j=0;j<(64/4);j++)
{
*pDst++ = *pSrc++; !!!!!!!!!! DATA ABORT
}
//---- Memory Mapping f Int's auf RAM stellen
MEMMAP = 2;

//Application anspringen
JUMP_ADDR StartApp =(JUMP_ADDR) APP_START_ADDR;
StartApp();

But as soon as i Copy the first Int Vector Word (Reset Vector)
I get an Data Abort Exeption.

Any Idea why???

mfg
Mike

An Engineer's Guide to the LPC2100 Series

--- In l..., "mike_schwarzer" wrote:
> #define INTVECT_RAM_ADDR 0x00000000
> #define APP_START_ADDR 0x00007000
> typedef void (*JUMP_ADDR)(void);
> .........
> __disable_interrupt();
> //---- Wenn Nein, vorhandene Application starten
> pSrc = (pInt32U)APP_START_ADDR; // Flash Int. Vektoren
> pDst = (pInt32U)INTVECT_RAM_ADDR; // RAM Int Vektoren
>
> for (int j=0;j<(64/4);j++)
> {
> *pDst++ = *pSrc++; !!!!!!!!!! DATA ABORT
> }
> //---- Memory Mapping f Int's auf RAM stellen
> MEMMAP = 2;
>
> //Application anspringen
> JUMP_ADDR StartApp =(JUMP_ADDR) APP_START_ADDR;
> StartApp();
>
> But as soon as i Copy the first Int Vector Word (Reset Vector)
> I get an Data Abort Exeption.
>
> Any Idea why???
>
> mfg
> Mike
>
Hi Mike

If you want to copy to RAM you need

#define INTVECT_RAM_ADDR 0x40000000 (and not 0x00000000)

Regards

Mark

http://www.uTasker.com

Thanks Mark,

Sch....
I think meanwhile get realy confused about that.

> Hi Mike
> If you want to copy to RAM you need
> #define INTVECT_RAM_ADDR 0x40000000 (and not 0x00000000)

I have written complete Application with Graphic, Double Buffering,
Multiprotocol CAN, external SD-Ram, Nand, ....

And these stupid part of Code makes me creacy, thanks for your
peasant and help.

mfg
Mike

--- In l..., "mike_schwarzer" wrote:
>
> Thanks Mark,
>
> Sch....
> I think meanwhile get realy confused about that.
>
> > Hi Mike
> > If you want to copy to RAM you need
> > #define INTVECT_RAM_ADDR 0x40000000 (and not 0x00000000)
>
> I have written complete Application with Graphic, Double Buffering,
> Multiprotocol CAN, external SD-Ram, Nand, ....
>
> And these stupid part of Code makes me creacy, thanks for your
> peasant and help.
Can I have a peasant as well ?? ;-)

http://en.wikipedia.org/wiki/Peasant

>
> mfg
> Mike
>