Dear All,
I know similar questions have been asked before but I have read around quite a bit and I couldn't find an answer to my specific problem.
I have a ble application with softdevice which normally runs just fine. Now I would like to have some simple bootloader so that I can check at boot if a new firmware is available in an external flash. This is how my client wants it so there is no way out. Therefore I started testing with something simple.
I started with the iot_secure_dfu_bootloader and I stripped everything away until my main looked like this:
#include <stdint.h> #include "boards.h" #include "nrf_bootloader_info.h" #include "nrf_bootloader_app_start.h" void app_error_handler_bare(uint32_t error_code) { (void)error_code; //NRF_LOG_ERROR("received an error: 0x%08x!\r\n", error_code); NVIC_SystemReset(); } int main(void) { while(1); nrf_bootloader_app_start(); }
where the while(1); can be commented or uncommented and serves as the simplest possible test of whether the bootloader is executing correctly or not. When I flash the bootloader directly from SEGGER Embedded Studio everything seems to work as expected (at least apparently), when the while(1); is there everything gets stuck, when I comment it out I can see my application start so that suggests that the control is going MBR->bootloader->softdevice->app.
However, if I then power-cycle the device the application always executes, even when I put an infinite loop in the bootloader, which makes me think that, after the power cycle, the bootloader is in fact not being executed and the control jumps straight to the application. What could the reason be?
Can anyone help me in setting up such simple bootloader? I have seen a lot of people on these forums struggling to get something simple like this to work, so I think it would be helpful for the community if we could document a clear and correct way to have a fully custom bootloader without DFU, encryption or anything of that sort.
Thank you very much.