boot: introduce MCUBOOT_CPU_IDLE() for support low power single thread

Introduced MCUBOOT_CPU_IDLE() macro.
If a port supports single thread or is bare-metal then might be need
to switch to idle mode explicitly form MCUboot code.
The call allows to enable lower power consumption while waiting for
incoming transmission in serial recovery etc.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
This commit is contained in:
Andrzej Puzdrowski 2021-06-11 12:26:42 +02:00
parent d5e9902352
commit 142b339667
5 changed files with 35 additions and 0 deletions

View File

@ -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 */

View File

@ -79,5 +79,11 @@
do { \
} while (0)
/*
* No direct idle call implemented
*/
#define MCUBOOT_CPU_IDLE() \
do { \
} while (0)
#endif /* __MCUBOOT_CONFIG_H__ */

View File

@ -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__ */

View File

@ -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__ */

View File

@ -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__ */