This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Jumping Between Applications

hey guys i want to implement two separate application programs on the same chip.

Say Application1 is stored in address start_address1 to end_address2 and Application2 is stored in address start_address2 to end_address2.

can i just directly jump to one application to another ? i am used to using this on simpler microcontroller, can i do this in the NRF52 too?

void JumpToApp(void) {

void (*fptr)(void);
fptr = (void (*)(void))APP1_RESET_ADDRESS;
fptr();

}

thanks.

  • The nRF devices just have ARM processors at their core, so functionally you can always look up the opcode for moving the PC to where ever you want and put the opcode in your application code. In this manner, you can easily switch from one application to another.

    Based on the product spec they do not provide a way to permanently change the boot vector. Likely because this could get messy since the SD and MBR always sit at 0x0.

    I would suggest you just nestle the two applications together. In C this is pretty straightforward since most programs operate as a series of handlers calling various functions. Having the programs together as one will make your life easier down the road as all the nordic apps are geared around 1 SD, 1 app, 1 DFU/bootloader.

    If you don't like the idea of putting them together in one C project, then concatenate them after compilation and just allocate the memory yourself using the ROM settings in the compiler. Then it is still one app and the first app just switch boots to the second.

  • can i just directly jump to one application to another

    Yes.

    But the softdevice and interrupts can make this task a lot more difficult - only the first application will handle interrupts by default, and you cannot simply set VTOR (the vector table offset register) to another address once the softdevice is running.

  • @Turbo: However it's possible to tell the softdevice to forward the interrupts to the application vector table using sd_softdevice_vector_table_base_set()

  • @Ashlesh: Please provide more information that you use the softdevice or not. If you use softdevice, you can refer to our bootloader example in the SDK for a reference.

  • dear , yes i am using a softdevice(s332) and also a DFU. so basically i can use the same function the bootloader uses to jump to the application for my application ?

Related