Hello NXP team,
I'm developing bootloader on S32K344 platform.There was a hardfult issue when I tried to jump to APP from BOOTLOADER,
here is my sample code:
typedef void (*AppAddr)(void);
int main(void)
{
/* Write your code here */
resetHandle = (AppAddr)(*(uint32_t *)0x00501420);
(resetHandle)();
.....
}
I get the reset handler address in APP map file, and the address of reset handler is 0x00501420, map file as below:
*(.startup)
*fill* 0x00501414 0xc
.startup 0x00501420 0x1c8 ./Project_Settings/Startup_Code/startup_cm7.o
0x00501420 _start
0x00501420 Reset_Handler
0x00501572 MCAL_LTB_TRACE_OFF
0x00501574 _end_of_eunit_test
0x005015e8 . = ALIGN (0x4)
I'd like to know why this happened and how debug under this situation.
Thank you!
Solved! Go to Solution.
Hi @zp001
First of all, EPSR means Execution Program Status Register, EPSR. Before getting to this might help you https://developer.arm.com/documentation/ddi0419/c/System-Level-Architecture/System-Level-Programmers...
This kind of multi-project in a single MCU design requires a deinitialization process on every jump. Also vector table reallocation and PS & SP. Also, try to jump to 0x00501000 instated 0x00501004.
Hi, I am using the project "S32K344_Can_bootloader_RTD200" in the microprocessor S32K344. I want to download an application with the program of bootloader. I have achieved the jump from program to application but I have different questions. 1. I want to use #define EN_DELAY_TIME but when I uncomment the command in the folder "public_in", the program has different errors. My target to use "Backdoor", that is to say, I want to check if the program has to enter to bootloader or not. I don´t know the process and the different functions that I have to use to achieve the target. I want to use the function "Boot_CheckReqBootloaderMode(void)" but when I debug the program, it never enters to the "if". Could you explain me the process and the steps to achieve the target. I add different functions that I think are important. 2. I don´t know if I have to modificate the parameters of "static tJumpAppDelayTimeInfo gs_stJumpAPPDelayTimeInfo = {FALSE, 0u};". I have to change this structure ? You can see all structure in one of the next pictures. I need the reply as soon as possible since I have to send a project very soon.
Thank you for all,
Hi Zhend,
this code will work if the provided address is an address of reset vector. In your case, it looks like you provide an address which is directly address of entry point.
Example:
This is my vector table:
Reset vector can be found at 0x00400004. So, entry point address is 0x004004C8.
Using you code, it should be called like this:
resetHandle = (AppAddr)(*(uint32_t *)0x00400004);
(resetHandle)();
Regards,
Lukas
Hi Lukas,
Thank you for your help!
I don't understand how to get the address of reset handler in my S32K314 project.
Here is the key part of map file:
.flash 0x00500000 0x3e61c
*(.boot_header)
.boot_header 0x00500000 0x2c ./Project_Settings/Startup_Code/startup_cm7.o
0x00501000 . = ALIGN (0x1000)
*fill* 0x0050002c 0xfd4
0x00501000 __text_start = .
0x00501000 __interrupts_rom_start = .
*(.intc_vector)
.intc_vector 0x00501000 0x408 ./Project_Settings/Startup_Code/Vector_Table.o
0x00501000 VTABLE
0x00501408 . = ALIGN (0x4)
0x00501408 __interrupts_rom_end = .
*(.core_loop)
.core_loop 0x00501408 0xc ./Project_Settings/Startup_Code/startup_cm7.o
0x00501408 _core_loop
0x00501414 . = ALIGN (0x4)
*(.startup)
*fill* 0x00501414 0xc
.startup 0x00501420 0x1c8 ./Project_Settings/Startup_Code/startup_cm7.o
0x00501420 _start
0x00501420 Reset_Handler
0x00501572 MCAL_LTB_TRACE_OFF
0x00501574 _end_of_eunit_test
0x005015e8 . = ALIGN (0x4)
...
...
...
*(.mcal_text)
.mcal_text 0x0051b094 0x14 ./Project_Settings/Startup_Code/exceptions.o
0x0051b094 NMI_Handler
0x0051b096 HardFault_Handler
0x0051b098 MemManage_Handler
0x0051b09a BusFault_Handler
0x0051b09c UsageFault_Handler
0x0051b0a0 DebugMon_Handler
0x0051b0a6 undefined_handler
.mcal_text 0x0051b0a8 0x52 ./Project_Settings/Startup_Code/nvic.o
0x0051b0a8 NVIC_SetPriorityGrouping
0x0051b0bc NVIC_EnableIRQ
0x0051b0d4 NVIC_DisableIRQ
0x0051b0ec NVIC_SetPriority
The corresponding memory conten is shown as below:
In my case, the 0x00501004 is physical address of reset vector, is that right?
But I tried to jump 0x00501004 and got failure again!
Did I miss any key point?
An error log printed in the console:
UsageFault: An instruction executed with an invalid EPSR.T or EPSR.IT field.
HardFault: A fault has been escalated to a hard fault.
I'd like to know how to get the reset vector adrress .would you like to share any reference documents?
Hi @zp001
First of all, EPSR means Execution Program Status Register, EPSR. Before getting to this might help you https://developer.arm.com/documentation/ddi0419/c/System-Level-Architecture/System-Level-Programmers...
This kind of multi-project in a single MCU design requires a deinitialization process on every jump. Also vector table reallocation and PS & SP. Also, try to jump to 0x00501000 instated 0x00501004.
Thank you for your reply!
Finally, the code can be run normally by using 0x00501004 as entry of APP image.
Thank you all.
你好,请问你是怎么改的呀,我遇到了个一摸一样的问题
Hard Fault trap happens when Boot jump into Bsw - NXP Community
hi, I met a same problem. Could you tell me the detail to slove my problem
需要找到APP代码中断向量表的起始地址,app跳转入口地址就是这个+4