Primitive Dual Booting a nRF21540 (nRF52840) and zephyr Nordic Bluetooth examples

I found this pretty old post devzone.nordicsemi.com/.../switching-between-apps-with-dual-bank . Currently I am building two different zephyr projects and selecting between them at boot time, using this code. The code handles interrupt reset conditions which I really don't think I care about, but it's not hurting anything, so no big deal. There is also some bare metal ARM boot code in this.

Essentially the code uses the offsets provided to pull the stack and reset pointer for each program. I am pretty sure that the initialization of a zephyr program holds no expectation to the state of the CPU other than it has to be in the initial boot mode.

I was curious, I don't know if this is a fair question since in is really about zephyr, however there is involvement of the BLE libraries. I am wondering if there are any specific assumptions (that I can know about of course) being made about the state of the processor when a Nordic Bluetooth Program is involved?

Why am I doing this? It's simple and I understand it. I came across a better way to handle this, but I will stick with this in the short term.


To simplify, the question is: " Are there any specific assumptions (that I can know about of course) being made about the state of the processor when a Nordic Bluetooth Program starts from reset? Can I just relocate them and jump to them?"

I understand if this is too esoteric a question to answer. I have been deliberating for a week if I should even bring it up.
Enclosed the code because it isn't exactly secret information.

boot_exp_0.zip

Parents
  • Hi,

     

    To simplify, the question is: " Are there any specific assumptions (that I can know about of course) being made about the state of the processor when a Nordic Bluetooth Program starts from reset? Can I just relocate them and jump to them?"

    As you mention, you should set the SP and entry-point. Other than that, it is to cleanup any specific peripherals that you may have used (uart for instance).

    It sounds like you want to boot different applications. Have you considered using mcuboot?

     

    Kind regards,

    Håkon

Reply
  • Hi,

     

    To simplify, the question is: " Are there any specific assumptions (that I can know about of course) being made about the state of the processor when a Nordic Bluetooth Program starts from reset? Can I just relocate them and jump to them?"

    As you mention, you should set the SP and entry-point. Other than that, it is to cleanup any specific peripherals that you may have used (uart for instance).

    It sounds like you want to boot different applications. Have you considered using mcuboot?

     

    Kind regards,

    Håkon

Children
  • The mcuboot module would be a good option, but my launch code was so much easier to control in terms of additional code and knowledge. I just wanted to make sure there wasn't more to the programs I am jumping to. 

    The end product is sort of special case device. 

    Thanks for the reply, I always appreciate Nordic's help. You guys are supporting a large amount of code. I know I was wide eyed while asking about Matter application code. Your team was very helpful then.

  • Hi,

     

    Always happy to help out. There's effectively a function pointer and setting the MSP.

    AMarch01 said:
    Thanks for the reply, I always appreciate Nordic's help. You guys are supporting a large amount of code. I know I was wide eyed while asking about Matter application code. Your team was very helpful then.

    We're here to help out with anything you might have questions or issues related to. I'll relay your gratitude to the Matter team

     

    Kind regards,

    Håkon

Related