Multiple Programs on same LPC1345 Chip

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Multiple Programs on same LPC1345 Chip

326 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ub3r on Thu Dec 06 08:20:09 MST 2012
Hi Guys,

[B]Basic info:[/B]
I want to create a boot application at address 0x00000000.
Also another application at address 0x00002000.
And a third application at address 0x00004000.

[U][B]Aim:[/B][/U]
The chip boots into the boot program, and then run one of the other 2 application depending on the state of some I/O.

The boot program also consists of a USB-CDC, and i plan to update the other 2 flash locations via the boot app CDC..

[U][B]Problem:[/B][/U]
I'm not sure how to jump to a particular flash address to execute the new application from the boot program??

Im sure there's an easy way.. I just haven't found it after searching for a while now.. :confused:

cheers
Tony
0 Kudos
6 Replies

310 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ub3r on Sat Dec 08 16:32:48 MST 2012
Well after examining further i now know where the 0x1FFFFF80 comes from... 0b11111111111111111111110000000..

Anyways it works fine.. The LPC1345 flash range is 0x0000 -> 0x8000.

I compiled a program and loaded it into address 0x0000, and another blinky program at 0x2000. The chip boots into 0x0000, the boot program sets a new vector to 0x2000, and the chip blinks away.. :D

Thanks again..
0 Kudos

310 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Sat Dec 08 11:15:32 MST 2012
AFAIR that's 17xx code and a few lower bits are reserved to prevent us from trying to squeeze long vector tables in overlapping memory areas :o

I'm not familiar with LPC1345, but I hope your vector table will fit in 0x2000 :rolleyes:
0 Kudos

310 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ub3r on Sat Dec 08 09:55:42 MST 2012
hey Zero,

I just tried the code and its works perfectly. :D
Although i still dont understand where the '0x1FFFFF80' comes from??

Cheers
Tony
0 Kudos

310 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ub3r on Sat Dec 08 09:02:52 MST 2012
Hey Zero,

Thanks for your reply its exactly what I'm looking for, although i have yet to implement it.
0 Kudos

310 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Jeroen3 on Fri Dec 07 01:49:50 MST 2012
Take a look at operating systems (like freertos), they might do exactly what you are looking for.
0 Kudos

310 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Thu Dec 06 08:33:09 MST 2012
Not sure what we are talking about :confused:

A program which jumps to a flash address after setting new vector table as used in a lot of bootloaders?

 
#define USER_START_SECTOR_ADDRESS 0x2000

/remap vector table to sector 2 and call reset table address (sector address + 4 bytes)
void execute_user_code(void)
{
 void (*user_code_entry)(void);            //pointer to function
 unsigned *p;                            //pointer to read reset address
//remap vector table address
 SCB->VTOR = (USER_START_SECTOR_ADDRESS & 0x1FFFFF80);
//read reset address from vector table = sector 2 + 4 bytes
 p = (unsigned *)(USER_START_SECTOR_ADDRESS + 4 );
//set content of reset address to function call
 user_code_entry = (void *) *p;
//and go...
 user_code_entry();
}
0 Kudos