Implementation of jumping from bootloader to application

Hello. We recently started working with the new nrf connect sdk and we need to implement a very simple bootloader that would only jump to the main application at a specific address. In this regard, there are several questions:


1) the bootloader should start from address 0, right? how to set the exact address?


2) implementation of our very simple bootloader:

#include <zephyr/kernel.h>

#define APP_ADDR 0x0000C200

int main(void)
{
printk("BOOT\n");
void *start;
irq_lock();
__set_MSP(APP_ADDR);
start = (void *)(APP_ADDR + 4);
((void (*)(void))start)();
while(1);
return 0;
}

how to transfer a vector table? Should this be done in the bootloader or in the application?


3) how to set the offset for the firmware image in the application (to which you need to jump) for nrf connect sdk based on zephyr? (in other projects and mcu this was done in the linker script).


4) is there any additional configuration needed in the main application?

The bootloader and main application are based on nrf connect sdk v2.5.0. MCU nrf52840. The assembly is carried out in Windows 11 and VS Code with the nrf connect sdk plugin.

thanks in advance for the answers

Related