my mcu is mpc5748g.I try to jump to app throught bootloader.But faile.
my bootloader flash configuration like following:
ps: bootloader with os,only use cpu0
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
flash_rchw : org = 0x00F90000, len = 0x4
cpu0_reset_vec : org = 0x00F90000+0x10, len = 0x4
cpu1_reset_vec : org = 0x00F90000+0x14, len = 0x4
cpu2_reset_vec : org = 0x00F90000+0x04, len = 0x4
m_text : org = 0x00F90000 + 0x400, len = 256K - 0x400
m_vectors_ram : org = 0x40000000, len = 0xC00
m_data : org = 0x40000000+0xC00, len = 768K-0xC00-64K /*left 64k for btl*/
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
my app flash configuration like following:
ps: app with os,only use cpu0
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
flash_rchw : org = 0x01000000, len = 0x4
cpu0_reset_vec : org = 0x01000000+0x10, len = 0x4
cpu1_reset_vec : org = 0x01000000+0x14, len = 0x4
cpu2_reset_vec : org = 0x01000000+0x04, len = 0x4
m_text : org = 0x01000000+ 0x400, len = 256K - 0x400
m_vectors_ram : org = 0x40000000, len = 0xC00
m_data : org = 0x40000000+0xC00, len = 768K-0xC00-64K /*left 64k for btl*/
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
In my bootloader,I use following functions to jump to app
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
function1: faile
***********************************************
typedef void (*start_fun)(void);
start_fun start_entry;
unsigned int *start_addr = (unsigned int *)(0x01000000+0x10);
DISABLE_INTERRUPTS(); //"wrteei 0"
start_entry = (start_fun) * start_addr;
start_entry();
**********************************************
function2: faile
***********************************************
asm("e_lis %r12,0x0100");
asm("e_or2i %r12,0x0010");
asm("e_lwz %r0,0(%r12) ");
asm("mtlr %r0");
asm("se_blrl");
**********************************************
When jump from bootloader to app,my app can run to main.If run to xTaskCreate,failed in
every time.
througth disassembly and watch,I found following state:
I try to set the value of INTC->IACKR0 to 0x40000000,but unavailable.It still keep the value of 0x400003c4.Could somebody give me some suggestion about how to solve this problem?
ps:
1.when bootloader without os,it can jump to app without os succesfully.
2.when bootloader with os,,it can jump to app without os succesfully.
3.when bootloader without os,it can't jump to app with os.
4.when bootloader with os,it can't jump to app with os.
Solved! Go to Solution.
Hi,
lower part of IACKR (INTVEC) can't be changed, it is updated automatically by interrupt controller.
I can see that you disabled interrupts only by wrteei instruction before jump. My recommendation is - disable also all local enable bits in peripherals. Reason - if application enable interrupts again, some interrupts flags can be still set and it can trigger interrupt. And your application won't handle it as expected, most likely.
Offset 0x3C4 corresponds to PIT channel 15, so this is the first thing to check.
And one more note - it is good practice to put everything to default reset state before jumping to app. Or the application must be aware of the changes.
Regards,
Lukas
hi,
the research I am doing is the same as yours. May I ask if you can share your bootloader and OS code for my reference? Thank you very much
Hi,I'm sorry that I could't share the project to you.But you can implement your Jump code according the following code:
void PrepareJump()
{
DISABLE_INTERRUPTS(); /*disable the CPU interrupt*/
INT_SYS_DisableIRQ(PIT_Ch15_IRQn);
}
void oad_app(uint32_t appxaddr)
{
if((*(uint32_t*)appxaddr)==0x005A0002)
{
typedef void (*start_fun)(void);
start_fun start_entry;
unsigned int *start_addr = (unsigned int *)(appxaddr + 0x10);
PrepareJump();
start_entry = (start_fun) * start_addr;
start_entry();
}
}
Hi,
lower part of IACKR (INTVEC) can't be changed, it is updated automatically by interrupt controller.
I can see that you disabled interrupts only by wrteei instruction before jump. My recommendation is - disable also all local enable bits in peripherals. Reason - if application enable interrupts again, some interrupts flags can be still set and it can trigger interrupt. And your application won't handle it as expected, most likely.
Offset 0x3C4 corresponds to PIT channel 15, so this is the first thing to check.
And one more note - it is good practice to put everything to default reset state before jumping to app. Or the application must be aware of the changes.
Regards,
Lukas
Hi,Lukas.Thank you very much! your answer solve my problem perfectly.