Transferring control from FreeRTOS to other code

I’m working on a very simple FreeRTOS application which is a basic bootloader. It allows a client to upload code to be stored in flash/memory, and then jump to it’s entry point. The memory used is totally different from where the Bootloader FreeRTOS is running. The uploaded code can also be a FreeRTOS system, but also could be something totally different, like a Zephyr instance. It will never return to the bootloader code. Is it sufficient to just disable all interrupts and then transfer control to the new code, or should it be done more gently…

It depends on the chip and what the bootloader is doing. For example, some chips require you to do things like remap the vector table before branching from the bootloader to the application code. Also be careful how you disable interrupts - if you just globally disable interrupts then interrupts generated between then and the time your application code re-enables them will execute immediately that your application code enables them - by which time your interrupt vector table will have changed and any objects used within the interrupts may have been corrupted. So, best to disable interrupts in the peripherals themselves as well as globally.