MPC5748G bootloader to application jump issue

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

MPC5748G bootloader to application jump issue

跳至解决方案
3,963 次查看
prasad_chormale
Contributor II

I am developing serial Bootloader for MPC57485G. flow of the the process is simple ,after every power on controller goes to bootloader code waits for 1sec to receive an file over serial uart. If the new file is received than its writes the file to application area and after completing its jump to application code. If file is not received than its directly jump to
existing application code.My application is simple of LED toggling.

I have divided flash in following manner and have made 2 separate projects for bootloader and application files of same
is also attached .

/*BOOTLOADER*/


SRAM_SIZE = 256K;
/* Define SRAM Base Address */
SRAM_BASE_ADDR = 0x40000000;

MEMORY
{

flash_rchw : org = 0x00FA0000, len = 0x4
cpu0_reset_vec : org = 0x00FA0000+0x10, len = 0x4
cpu1_reset_vec : org = 0x00FA0000+0x14, len = 0x4
cpu2_reset_vec : org = 0x00FA0000+0x04, len = 0x4

m_text : org = 0x014C0000, len = 256K
m_vectors_ram : org = 0x40000000, len = 0xC00
m_data : org = 0x40000000+0xC00, len = 256K-0xC00
}


/*APPLICATION*/

SRAM_SIZE = 256K;
/* Define SRAM Base Address */
SRAM_BASE_ADDR = 0x40000000;

MEMORY
{

flash_rchw : org = 0x00FA4000, len = 0x4
cpu0_reset_vec : org = 0x00FA4000+0x10, len = 0x4
cpu1_reset_vec : org = 0x00FA4000+0x14, len = 0x4
cpu2_reset_vec : org = 0x00FA4000+0x04, len = 0x4

m_text : org = 0x01000000, len = 4800K
m_vectors_ram : org = 0x40000000, len = 0xC00
m_data : org = 0x40000000+0xC00, len = 256K-0xC00
}


I have used following asm code to jump to application code
//Jump to app address 0x01000000
asm("e_lis %r12,0x0100");
asm("e_or2i %r12,0x0000");
asm("mtlr %r12");
asm("se_blrl");



I am using S32 IDE and MPC57485G Devkit board for development purpose and open SDA is used for debugging.
I have loaded both app and bootloader together by giving bootloader elf object file reference in application code.

I am facing an issue that whenever i make execution jump from bootloader to application its take some time to configure
the core clock in application and whenever I try to configure any other module like uart it goes in hard fault(IVOR6_handler) and remains there only refer below image for details and highlighted code from where its goes to IVOR6_handler. Same is the case whenever I initialize any other module .

pastedImage_2.png


However if i removes all modules from application and just keep clock and pin initialization ,though it take some time to
configure clock here also but application work as expected

Also i have following queries
1.Is there any restriction that clock speed for the core must me same in both bootloader and application code because
i need to re initialize complete controller altogether in different manner in application.
2.Is there any mandatory housekeeping work(like resting some important registers,modules etc ) need to done before
jumping to application.If there is anything please let me know any reference for the same.
3.Is it mandatory to divide ram also for this kind of use case if yes than any reference to do it will be really helpful
4.Is method in which flash is divided is correct

0 项奖励
1 解答
3,720 次查看
stephenlangstaf
Contributor III

My guess is that your application does not like the fact that your UART has already been setup by the bootloader.

Do you reset your UART (and any other peripherals used in the bootloader) before jumping to the application?

在原帖中查看解决方案

4 回复数
3,271 次查看
thomasbao
Contributor II

Hello, prasad:

    i am facing the same issue, but i have deinit all Peripherals used in bootloader. Could you please share the code?

 

1,802 次查看
developer_newbie
Contributor III
Hello @thomasbao,

I am facing on the same issue with usdhc, have you found how to do that ?
0 项奖励
3,721 次查看
stephenlangstaf
Contributor III

My guess is that your application does not like the fact that your UART has already been setup by the bootloader.

Do you reset your UART (and any other peripherals used in the bootloader) before jumping to the application?

3,721 次查看
prasad_chormale
Contributor II

Thanks very much Stephen your suggestion is correct Resetting of the used peripherals was the missing thing.