Reducing startup time with MCUBoot in nRF Desktop

I am building a firmware based on nRF Desktop, but can reproduce the issue in nRF Desktop SDK 2.9.0. The issue is that MCUBoot takes almost 1s to start the app, even with RC oscillator LF clock source and with slot0 validation disabled.

To reproduce the issue:

  • Modify the nRF52840dk_nrf52840 configuration:
    • To images/mcuboot/prj_fast_pair.conf add:
      CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y
      CONFIG_BOOT_VALIDATE_SLOT0=n
    • To prj_fast_pair.conf add:
      CONFIG_CAF_POWER_MANAGER_TIMEOUT=20
      CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y
    • To prj.conf add:
      CONFIG_CAF_POWER_MANAGER_TIMEOUT=20
      CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y
  • Modify main.c:
    #include <app_event_manager.h>
    
    #define MODULE main
    #include <caf/events/module_state_event.h>
    
    #include <zephyr/logging/log.h>
    LOG_MODULE_REGISTER(MODULE);
    
    #include <zephyr/drivers/gpio.h>
    
    static const struct gpio_dt_spec led3 = GPIO_DT_SPEC_GET(DT_NODELABEL(led3), gpios);
    
    int main(void)
    {
    	gpio_pin_configure_dt(&led3, GPIO_OUTPUT_LOW);
    	if (app_event_manager_init()) {
    		LOG_ERR("Application Event Manager not initialized");
    	} else {
    		module_set_state(MODULE_STATE_READY);
    	}
    	return 0;
    }
  • With the base configuration and the fast pair configuration, wait for the firmware to power down, then with a logic analyser record P.11 and P.16 and press button 1 until the LEDs light up.

With the base configuration, the delta between button press and LED3 on is about 55ms. With fast pair (MCUBoot) it is 980ms. How can startup time be reduced further when using MCUBoot? Reading other forum posts, the main culprits are usually entropy source, LF oscillator source, and image validation. However with all those modified, it is still slow, slower than should be expected.

Related