Commit 142b3396 authored by Andrzej Puzdrowski's avatar Andrzej Puzdrowski
Browse files

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: default avatarAndrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
parent d5e99023
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -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 */
+6 −0
Original line number Diff line number Diff line
@@ -79,5 +79,11 @@
    do {                                        \
    } while (0)

/*
 * No direct idle call implemented
 */
#define MCUBOOT_CPU_IDLE() \
    do {                   \
    } while (0)

#endif /* __MCUBOOT_CONFIG_H__ */
+7 −0
Original line number Diff line number Diff line
@@ -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__ */
+5 −0
Original line number Diff line number Diff line
@@ -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__ */
+10 −0
Original line number Diff line number Diff line
@@ -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__ */