Yahoo Groups archive

Lpc2000

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

Thread

Working with two Applications (Boot and MainApp)

Working with two Applications (Boot and MainApp)

2004-07-28 by givc@yahoo.com

Hi everyone,

In the project I'm working on, I'm loading two separate applications 
to the LPC2119 Flash, the first one is the Boot Application and the 
2nd is the Main Application. I make the final binary file with a 
small App I made.

The Boot App is in first two sectors and the Main App has 13 sectors 
available from 3rd to 15th sector(not at the very beginning of 3rd 
sector because I save App Version, App Size and Checksum first and 
then the Main App Code). 

#define APPLICATION_ADDRESS ((unsigned char*) 0x00004010) 
#define APPLICATION_VERSION_ADDRESS ((unsigned long*)  0x00004000)
#define APPLICATION_SIZE_ADDRESS ((unsigned long*)  0x00004004)
#define APPLICATION_CHECKSUM_ADDRESS ((unsigned short*)  0x00004008)

From the BootApp the MainApp is called this way:

(defined and declared at the beginning)
typedef void (*tFuncP)();

(In Main() function...)
tFuncP pFunction;

pFunction = (tFuncP)(APPLICATION_ADDRESS);
(*pFunction)();

Ok, when I call the MainApp, the program restarts itself and the 
BootApp is executed again. DOES ANYONE KNOWS IF THERE'S SOMETHING 
TRICKY TO DO BEFORE BE ABLE TO CALL ANOTHER APPLICATION??

Both Applications have their own entry file(in asm) and I'm using 
MEMMAP to remap the vector table to the base of RAM. Before the 
MainApp is called i copy their first 64 bytes to the base of RAM so 
it has the MainApp Vector table.

Hope somebody can help me...

Thanks in advance!

Re: Working with two Applications (Boot and MainApp)

2004-07-29 by givc@yahoo.com

Nevermind... I found out that the problem was when the 2nd 
Application tried to set the VPB clock again. I just skip that 
setting in the 2nd app and it all works great!

--- In lpc2000@yahoogroups.com, givc@y... wrote:
> Hi everyone,
> 
> In the project I'm working on, I'm loading two separate 
applications 
> to the LPC2119 Flash, the first one is the Boot Application and 
the 
> 2nd is the Main Application. I make the final binary file with a 
> small App I made.
> 
> The Boot App is in first two sectors and the Main App has 13 
sectors 
> available from 3rd to 15th sector(not at the very beginning of 3rd 
> sector because I save App Version, App Size and Checksum first and 
> then the Main App Code). 
> 
> #define APPLICATION_ADDRESS ((unsigned char*) 0x00004010) 
> #define APPLICATION_VERSION_ADDRESS ((unsigned long*)  0x00004000)
> #define APPLICATION_SIZE_ADDRESS ((unsigned long*)  0x00004004)
> #define APPLICATION_CHECKSUM_ADDRESS ((unsigned short*)  
0x00004008)
> 
> From the BootApp the MainApp is called this way:
> 
> (defined and declared at the beginning)
> typedef void (*tFuncP)();
> 
> (In Main() function...)
> tFuncP pFunction;
> 
> pFunction = (tFuncP)(APPLICATION_ADDRESS);
> (*pFunction)();
> 
> Ok, when I call the MainApp, the program restarts itself and the 
> BootApp is executed again. DOES ANYONE KNOWS IF THERE'S SOMETHING 
> TRICKY TO DO BEFORE BE ABLE TO CALL ANOTHER APPLICATION??
> 
> Both Applications have their own entry file(in asm) and I'm using 
> MEMMAP to remap the vector table to the base of RAM. Before the 
> MainApp is called i copy their first 64 bytes to the base of RAM 
so 
Show quoted textHide quoted text
> it has the MainApp Vector table.
> 
> Hope somebody can help me...
> 
> Thanks in advance!

Re: Working with two Applications (Boot and MainApp)

2004-07-29 by Leighton Rowe

You're keeping the address list and the BootApp close together , 
which is a safe thing todo. Try see if u can call an application 
that's further down in the flash...say 0x0001c400. Success in this 
means that u can branch to any flash location u want.

I wasn't able to branch that far using C-code as all i got were 
prefetch abort errors...not sure why. I'm resorting to an assembly 
boot routine that's similar to the C Code u described. It works fine 
works fine as the PC can branch anywhere with ease.



--- In lpc2000@yahoogroups.com, givc@y... wrote:
> Nevermind... I found out that the problem was when the 2nd 
> Application tried to set the VPB clock again. I just skip that 
> setting in the 2nd app and it all works great!
> 
> --- In lpc2000@yahoogroups.com, givc@y... wrote:
> > Hi everyone,
> > 
> > In the project I'm working on, I'm loading two separate 
> applications 
> > to the LPC2119 Flash, the first one is the Boot Application and 
> the 
> > 2nd is the Main Application. I make the final binary file with a 
> > small App I made.
> > 
> > The Boot App is in first two sectors and the Main App has 13 
> sectors 
> > available from 3rd to 15th sector(not at the very beginning of 
3rd 
> > sector because I save App Version, App Size and Checksum first 
and 
> > then the Main App Code). 
> > 
> > #define APPLICATION_ADDRESS ((unsigned char*) 0x00004010) 
> > #define APPLICATION_VERSION_ADDRESS ((unsigned long*)  
0x00004000)
> > #define APPLICATION_SIZE_ADDRESS ((unsigned long*)  0x00004004)
> > #define APPLICATION_CHECKSUM_ADDRESS ((unsigned short*)  
> 0x00004008)
> > 
> > From the BootApp the MainApp is called this way:
> > 
> > (defined and declared at the beginning)
> > typedef void (*tFuncP)();
> > 
> > (In Main() function...)
> > tFuncP pFunction;
> > 
> > pFunction = (tFuncP)(APPLICATION_ADDRESS);
> > (*pFunction)();
> > 
> > Ok, when I call the MainApp, the program restarts itself and the 
> > BootApp is executed again. DOES ANYONE KNOWS IF THERE'S 
SOMETHING 
> > TRICKY TO DO BEFORE BE ABLE TO CALL ANOTHER APPLICATION??
> > 
> > Both Applications have their own entry file(in asm) and I'm 
using 
Show quoted textHide quoted text
> > MEMMAP to remap the vector table to the base of RAM. Before the 
> > MainApp is called i copy their first 64 bytes to the base of RAM 
> so 
> > it has the MainApp Vector table.
> > 
> > Hope somebody can help me...
> > 
> > Thanks in advance!

Re: Working with two Applications (Boot and MainApp)

2004-08-24 by embeddedjanitor

Having just done a bootloader thing like this I can give some 
comments.

The memory map I use is as follows:

0x0000 - 0x3FFFF = 16kB "boot monitor"
0x4000 - to top of flash = "application area"

When the device boots the "boot monitor" does a checksum check on 
the "application" and also checks for a serial break. If the checksum 
fails or there is a break then the monitor executes to allow the 
application area to be reflashed, otherwise the execution jumps to 
0x4000 (the start of the application).

The purpose of this is twofold: firstly it provides an upgrade 
mechanism and secondly it provides better checksumming than the 
Philips method.

The boot monitor is built as a fairly regular application. I don't 
use interrupts, but you could (you'd have to turn interrupts off 
before jumping to the app. I don't use thumb either, but again you 
could so long as you turn it off.

The application has a reasonably normal crt0.s. Since it is not at 
address 0, you need to use memmap for the vectors. Make sure that 
the .data and .bss are only located from address 0x40000040 up to 
keep the vector space for the vectors.

I found I had to craft my own ldscripts to get what I want.

The most important thing is to check the map files to make sure 
everything is where it needs to be. Map is your friend.

Hope that helps...

-- Charles

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.