This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

__get_IPSR() at boot application

Hello!
I wrote my own version of the bootloader for nFR52832.
If I go into the loader, check the application and switch to its execution via nrf_bootloader_app_start (), then everything is fine.
But if I download the firmware via BLE, I cannot go to the application via nrf_bootloader_app_start (). The error is 0xDEADBEEF.
It appears in the app_start () function, namely on ASSERT (current_isr_num == 0);
where current_isr_num = __get_IPSR () = 38 != 0
My understanding is that you cannot move the vector table while the loader is in some kind of interrupt.
But I am trying to complete all communications before switching to the application
ble_conn_params_stop ();
sd_ble_gap_disconnect (m_conn_handle, BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION);
sd_softdevice_disable ();
nrf_bootloader_app_start ();
But this does not work. What is my problem? How to painlessly switch from the BLE mode to the application?

  • You need to start the application main in thread mode and reset all stack frames to point to the correct MSP/PSP and to correct stack frame. The normal way Nordic bootloader does this is to mark that the update is complete in the flash and reset the device. If you have your own bootloader, then you should make sure that you finish all your interrupt processing and switch the thread mode before you can do a jump to the application.

     

    where current_isr_num = __get_IPSR () = 38 != 0

     Seems like you are doing something with EGU/SWI and attempting to jump to the application while in the interrupt handler. It would be risky and wrong to jump to the application vector table from an exception.

Related