Hello,
I've had to redesign my bootloader and I am now stuck with a problem that I can not solve. I need to know the correct workflow for switching from bootloader to application and I was unable to figure it out.
- I am writing the UICR_BOOTADDR register with the address of my bootloader
- I have two projects, one for my bootloader and one for my application at fitting addresses
- My bootloader does not need the softdevice
When the bootaddress is set, all interrupts will be forwarded by the MBR to my bootloader. Before I start my application, I am doing the following:
interrupts_disable();
sd_mbr_command_t com;
com.command = SD_MBR_COMMAND_VECTOR_TABLE_BASE_SET;
com.params.base_set.address = SD_SIZE_GET(MBR_SIZE);
err = sd_mbr_command(&com);
bootloader_util_app_start(CODE_REGION_1_START); //copied this function from the SDK code.
My app starts, but I have so far been unable to enable the softdevice or use sd_softdevice_vector_table_base_set. If I do not flash the bootloader and just the application, everything works as expected. It must have something to do with the interrupt table, but I am a bit lost there.
What is the correct order in which I call these functions? Also, GCC will not compile the bootloader_util_app_start function depending on the settings of the optimizer,...?
What does the SD_MBR_COMMAND_VECTOR_TABLE_BASE_SET do? I get the feeling that it changes something persistently that is then remembered after a reboot....