diff --git a/boot/cypress/MCUBootApp/config/mcuboot_config/mcuboot_config.h b/boot/cypress/MCUBootApp/config/mcuboot_config/mcuboot_config.h index a58d584b..e18d0fb6 100644 --- a/boot/cypress/MCUBootApp/config/mcuboot_config/mcuboot_config.h +++ b/boot/cypress/MCUBootApp/config/mcuboot_config/mcuboot_config.h @@ -152,4 +152,11 @@ #define NUM_ECC_BYTES (256 / 8) #endif /* ENC_IMG */ +/* + * No direct idle call implemented + */ +#define MCUBOOT_CPU_IDLE() \ + do { \ + } while (0) + #endif /* MCUBOOT_CONFIG_H */ diff --git a/boot/mbed/include/mcuboot_config/mcuboot_config.h b/boot/mbed/include/mcuboot_config/mcuboot_config.h index 468d8ee4..a603e05d 100644 --- a/boot/mbed/include/mcuboot_config/mcuboot_config.h +++ b/boot/mbed/include/mcuboot_config/mcuboot_config.h @@ -79,5 +79,11 @@ do { \ } while (0) +/* + * No direct idle call implemented + */ +#define MCUBOOT_CPU_IDLE() \ + do { \ + } while (0) #endif /* __MCUBOOT_CONFIG_H__ */ diff --git a/boot/mynewt/mcuboot_config/include/mcuboot_config/mcuboot_config.h b/boot/mynewt/mcuboot_config/include/mcuboot_config/mcuboot_config.h index 696f2e70..4c0ec387 100644 --- a/boot/mynewt/mcuboot_config/include/mcuboot_config/mcuboot_config.h +++ b/boot/mynewt/mcuboot_config/include/mcuboot_config/mcuboot_config.h @@ -101,4 +101,11 @@ #define MCUBOOT_WATCHDOG_FEED() do {} while (0) #endif +/* + * No direct idle call implemented + */ +#define MCUBOOT_CPU_IDLE() \ + do { \ + } while (0) + #endif /* __MCUBOOT_CONFIG_H__ */ diff --git a/boot/zephyr/include/mcuboot_config/mcuboot_config.h b/boot/zephyr/include/mcuboot_config/mcuboot_config.h index 8f2b1575..13a28e68 100644 --- a/boot/zephyr/include/mcuboot_config/mcuboot_config.h +++ b/boot/zephyr/include/mcuboot_config/mcuboot_config.h @@ -205,4 +205,9 @@ #endif /* CONFIG_BOOT_WATCHDOG_FEED */ +#define MCUBOOT_CPU_IDLE() \ + if (!IS_ENABLED(CONFIG_MULTITHREADING)) { \ + k_cpu_idle(); \ + } + #endif /* __MCUBOOT_CONFIG_H__ */ diff --git a/samples/mcuboot_config/mcuboot_config.template.h b/samples/mcuboot_config/mcuboot_config.template.h index 2125792d..989ec618 100644 --- a/samples/mcuboot_config/mcuboot_config.template.h +++ b/samples/mcuboot_config/mcuboot_config.template.h @@ -146,4 +146,14 @@ * do { do watchdog feeding here! } while (0) */ +/* If a OS ports support single thread mode or is bare-metal then: + * This macro implements call that switches CPU to an idle state, from which + * the CPU may be woken up by, for example, UART transmission event. + * + * Otherwise this macro should be no-op. + */ +#define MCUBOOT_CPU_IDLE() \ + do { \ + } while (0) + #endif /* __MCUBOOT_CONFIG_H__ */