Using mcuboot_status_change() to control GPIO and I2C during MCUboot execution

Hi! I’m currently implementing a hook using mcuboot_status_change() inside MCUboot. I’m following the path defined by CONFIG_MCUBOOT_ACTION_HOOKS, and I’ve confirmed that my function is properly compiled into the mcuboot image.

I want to confirm if this setup is correct, and at what point it is safe to perform low-level operations like turning on a GPIO or initiating I2C communication. I’m targeting an nRF54L15 with sysbuild enabled.

What I’ve done so far:

  • I enabled CONFIG_MCUBOOT_ACTION_HOOKS=y in the prj.conf for MCUboot.

  • I implemented mcuboot_status_change(mcuboot_status_type_t status) inside the MCUboot image (not in the application).

  • I’m able to print the status 

What I’d like to do:

  • Use the MCUBOOT_STATUS_STARTUP status to activate a GPIO or send a short I2C command to a peripheral (e.g., a power controller).

  • I’m wondering:

    1. Is it safe to initialize and use I2C from this hook?

    2. What configs or steps do I need in MCUboot’s prj.conf to enable DEVICE_DT_GET() or i2c_write() in this context?

    3. Is there any official example or limitation for this kind of use?

Related