I'm working with an STM32WB09KE microcontroller and have implemented a bootloader to handle firmware updates downloaded via Bluetooth. The bootloader copies the downloaded firmware into the active application slot, and it works well for simple applications, such as basic "Hello World" examples. However, I encounter issues when attempting to boot my main Bluetooth (BLE) application.
Specifically:
- With the debugger connected, the application enters the NMI_Handler() at the first call to a BLE function, BLE_STACK_Init().
Without the debugger, the application progresses slightly further, reporting some BLE configuration functions (e.g., set_tx_power) as successful before also entering NMI_Handler(). - I attempted to use the Application Install Manager from STM (Of course i adjusted my Slot Sizes and Boundaries like documented in the Heart_Rate_OTA example), which successfully boots the BLE application from the active slot, but copying the Firmware into the active Slot does not work.
My main questions are:
- Is there source code available for the Application Install Manager? Access to this might help me understand its BLE stack initialization process and other mechanisms that ensure stability in the BLE application.
- Are there any specific considerations or tips for making the BLE application run successfully when loaded by a custom bootloader? I have implemented a "magic number" check to ensure the integrity of the downloaded firmware before copying it to the active slot.
Here is the code I'm using to jump to the application.
void gotToApplication(void){
typedef void (*pFunction)(void);
pFunction JumpToApplication;
uint32_t JumpAddress;
printf("Jumping to Application! \r\n");
JumpAddress = *(__IO uint32_t*) (APPLICATION_START + 4);
JumpToApplication = (pFunction) JumpAddress;
__set_MSP(*(__IO uint32_t*) APPLICATION_START);
JumpToApplication();
}