Peripheral: nRF52832
IDE: SES
SDK: nRF5 17.0.2
Hi,
I am attempting to jump from a non-BLE application to a BLE application. I was successful in modifying the "secure_bootloader" example to jump to the non-BLE application but I can't seem to get the non-BLE application to jump to my BLE application.
Below is my code for attempting to jump to the 2nd application:
__STATIC_INLINE void start_main_app(void)
{
uint32_t err_code;
const uint32_t current_isr_num = (__get_IPSR() & IPSR_ISR_Msk);
const uint32_t new_msp = *((uint32_t *)(vector_table_addr)); // The app's Stack Pointer is found as the first word of the vector table.
const uint32_t reset_handler = *((uint32_t *)(vector_table_addr + sizeof(uint32_t))); // The app's Reset Handler is found as the second word of the vector table.
NVIC->ICER[0]=0xFFFFFFFF;
NVIC->ICPR[0]=0xFFFFFFFF;
NVIC->ICER[1]=0xFFFFFFFF;
NVIC->ICPR[1]=0xFFFFFFFF;
SCB->VTOR = (uint32_t)vector_table_addr;
// Manually set the forward address if this MBR doesn't have the command.
*(uint32_t *)(MBR_IRQ_FORWARD_ADDRESS_ADDRESS) = vector_table_addr;
__set_CONTROL(0x00000000); // Set CONTROL to its reset value 0.
__set_PRIMASK(0x00000000); // Set PRIMASK to its reset value 0.
__set_BASEPRI(0x00000000); // Set BASEPRI to its reset value 0.
__set_FAULTMASK(0x00000000); // Set FAULTMASK to its reset value 0.
ASSERT(current_isr_num == 0); // If this is triggered, the CPU is currently in an interrupt.
//Jump into main application.
// Run application
__set_MSP(new_msp);
((void (*)(void))reset_handler)();
}
Vector_table_addris equal to 0x1000 which is the MBR size. If my understanding is correct, I have to jump into the softdevice and then the softdevice jumps into my application. They are located right after eachother.
Any help would be appreciated.
Thanks,
Tom