About my project, I have to add SPI-API into bootloader,in order to get data from SPI_flash(w25x16),but I found that:
---->I do hardware-init normally(include CLK_init,IO_init.SPI_init etc) ,and in main, I do nothing just jump to app directly,It is OK ,app works correctly.
---->I only add one operation in main ,that is<after hardware-init , I read data from SPI_flash once>, and then jump to app, but it is NG, it will jump to HardFault_Handler.
In my thought , maybe caused by Interrupt or DeInit, so before jump , I Deinit IO, SPI,NVIC, and add __disable_irp(),but it doesn't work.
so, I need help!!!
Thank you very much.
I recommend you to debug the code. You can start with a reading CSFR register to determine which exception has occurred. The description of this register can be found on the link below.
Also, please refer to Fault handling on S32K144, there can be found the description and example code shows the exception handling on S32K144 MCU.
Did you consider that the issue can be in reading data from SPI flash?
I hope it helps you.