Activating the bootloader from within a user program

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Activating the bootloader from within a user program

2,115 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by cpldcpu on Sun Feb 09 14:04:50 MST 2014
I have an application where the LPC800 is comminucating to a host via RS232. I would like to activate the bootloader by sending a special sequence to the user programe.

Is it possible to active the bootloader from within a user programe?

If yes, is it also possible to remap the UART?
标签 (1)
0 项奖励
回复
6 回复数

2,072 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by MarcVonWindscooting on Sat Mar 22 08:03:23 MST 2014

Quote: Floyd42
Reading the manual helps. :)


Reading the most recent manual helps. :p
0 项奖励
回复

2,072 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Floyd42 on Thu Mar 20 10:28:57 MST 2014
Reading the manual helps.

See the boot loader commands, 22.5.1.8 "Go <address> <mode>". It says:

Quote:

Alternatively, the following snippet can be loaded into the RAM for execution:
SCB->AIRCR = 0x05FA0004; //issue system reset
while(1); //should never come here

The snippet will issue a system reset request to the core.



And for the boot loader entry, use this code:

typedef void (*IAP)(uint32_t*, uint32_t*);
#define IAP_ENTRY           ((IAP)0x1fff1ff1)

typedef struct {
    uint32_t cmdId;
} iapCmdReinvokeIsp_t;

static void iapEntry(const void * cmd, const void * res) 
{
    IAP_ENTRY( (uint32_t*)cmd, (uint32_t*)res);
}

void iapReinvokeIsp(void) 
{
    iapCmdReinvokeIsp_t cmd = { .cmdId = 57 };
    iapEntry(&cmd, NULL);
    while (1);
}
0 项奖励
回复

2,072 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by MarcVonWindscooting on Sat Feb 15 15:21:45 MST 2014

Quote: LabRat

Are we talking about AIRCR?


Wow cool!
I (mis-)used the watchdog to cause RESET, because I did not know about that register!
In life, there are so many things to be ashame of...
0 项奖励
回复

2,072 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by LabRat on Thu Feb 13 03:23:02 MST 2014

Quote: MarcVonWindscooting
...special functionality inside the NVIC that does a RESET thingy...



Are we talking about AIRCR?

http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0497a/Cihehdge.html
0 项奖励
回复

2,071 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by MarcVonWindscooting on Thu Feb 13 02:45:57 MST 2014

Quote: LabRat

...and reset your chip with NVIC_SystemReset()...


This function is mentioned as a matter of course every day or two as if there were a special functionality inside the NVIC that does a RESET thingy...
I haven't found such. What do I miss? Can someone enlighten me?
0 项奖励
回复

2,071 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by LabRat on Sun Feb 09 17:08:54 MST 2014
Usually this is done with 'Reinvoke ISP' (IAP57).

Another simple solution is to set your ISP pin as output (low) and reset your chip with NVIC_SystemReset()...
0 项奖励
回复