Modify the MCUboot's booting process

Hi,

I want to use the MCUboot for the DFU and I have been able to configure it and flash it on the device so far (tested that it is correctly flashed).

But I need to make some modifications to the MCUboot's booting process to match with the device's specifications, the modifications that I need to do are:

  • Set a PIN on High as soon as it is powered, the device's turn off if I don't.
  • The device runs on battery so I need to check that the charger is connected before or that it has enough battery.
  • Change the upgrade strategy from swapping the images in the memory slots to just changing the address of the image that it will boot.

I would like to know the best way to make this modifications and in the case of the third point if there is a configuration option or example.

  • Hi, it has been some time since the last message but I got busy with something else and had to put this issue on hold.

    But continuing from where it was left, I have been able to stop the execution of the code for enough time for the board to power OFF by using the function "NRFX_DELAY_US" in the file "board.c"

    Now I am trying to modify the MCUboot image to boot the application directly from the secondary partition. At first it was working with the Direct-XIP configuration, the MCUboot image's "prj.conf" looked like this:

    CONFIG_MCUBOOT_LOG_LEVEL_DBG=y
    CONFIG_BOOT_SWAP_USING_MOVE=n
    CONFIG_BOOT_DIRECT_XIP=y

    I even starting implementing my own changes, but it seems that it was working because some configuration was left on the chip since now it will always boot the application of the primary partition even when the Log says that the image in the secondary partition is newer and that it will be booting it.
    I tried going back in all my changes but the error is still present.


    Right now I have been debugging the booting process after the partition has been selected and it seems that both partitions have the same MSP (Main Stack Pointer) so that might be why the primary partition is booted even when the secondary partition is selected.

    I also found that I might need to use a file that has the word "secondary" in its name when writing an image in the secondary partition, I suppose that this one has the correct MSP to boot the image in the secondary partition, but I cannot see it in the "build" folder and if I try to set the configuration "CONFIG_BOOT_BUILD_DIRECT_XIP_VARIANT" on the application's "prj.conf" file I get a message that said that it is "undefined" during the compilation.

    What should I do so that i can get the correct image for the secondary partition or what should I configure in the MCUboot so that it can be booted?

    Thanks,
    Erasmo

  • Erasmo said:
    I have been able to stop the execution of the code for enough time for the board to power OFF by using the function "NRFX_DELAY_US" in the file "board.c"

    Good!

    Erasmo said:
    Now I am trying to modify the MCUboot image to boot the application directly from the secondary partition. At first it was working with the Direct-XIP configuration, the MCUboot image's "prj.conf" looked like this:

    This looks like a new question. Could you create a new case for this ? 
    devzone.nordicsemi.com/.../add

  • Hi, I asked the about the Direct XIP since it was related with the point

    Change the upgrade strategy from swapping the images in the memory slots to just changing the address of the image that it will boot.

    but you are right this seems to be escalated so I will move it to a different case.
    As for the other 2 points they are both solved, the verification of the PIN's level before the Application started was solved with the SYS_INIT in the board.c file and the verification that the charger is connected was solved by reading the DTR of the USB port, this last one I found it on the USB console sample.

    Thanks

    Erasmo

Related