stm32/mboot: Only include UI code if at least one board LED is defined.
Otherwise the board must provide dummy definitions of MBOOT_LED1. Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
@@ -26,6 +26,7 @@
|
|||||||
#ifndef MICROPY_INCLUDED_STM32_MBOOT_MBOOT_H
|
#ifndef MICROPY_INCLUDED_STM32_MBOOT_MBOOT_H
|
||||||
#define MICROPY_INCLUDED_STM32_MBOOT_MBOOT_H
|
#define MICROPY_INCLUDED_STM32_MBOOT_MBOOT_H
|
||||||
|
|
||||||
|
#include "py/mpconfig.h"
|
||||||
#include "py/mphal.h"
|
#include "py/mphal.h"
|
||||||
|
|
||||||
// Use this to tag global static data in RAM that doesn't need to be zeroed on startup
|
// Use this to tag global static data in RAM that doesn't need to be zeroed on startup
|
||||||
@@ -38,6 +39,13 @@
|
|||||||
#define NORETURN __attribute__((noreturn))
|
#define NORETURN __attribute__((noreturn))
|
||||||
#define MP_ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
|
#define MP_ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
|
||||||
|
|
||||||
|
// The default UI code in ui.c only works if there is at least one LED configured.
|
||||||
|
#if defined(MBOOT_LED1) || defined(MICROPY_HW_LED1)
|
||||||
|
#define MBOOT_ENABLE_DEFAULT_UI (1)
|
||||||
|
#else
|
||||||
|
#define MBOOT_ENABLE_DEFAULT_UI (0)
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef MBOOT_BOARD_EARLY_INIT
|
#ifndef MBOOT_BOARD_EARLY_INIT
|
||||||
#define MBOOT_BOARD_EARLY_INIT(initial_r0)
|
#define MBOOT_BOARD_EARLY_INIT(initial_r0)
|
||||||
#endif
|
#endif
|
||||||
@@ -47,15 +55,27 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef MBOOT_BOARD_GET_RESET_MODE
|
#ifndef MBOOT_BOARD_GET_RESET_MODE
|
||||||
|
#if MBOOT_ENABLE_DEFAULT_UI
|
||||||
#define MBOOT_BOARD_GET_RESET_MODE(initial_r0) mboot_get_reset_mode_default()
|
#define MBOOT_BOARD_GET_RESET_MODE(initial_r0) mboot_get_reset_mode_default()
|
||||||
|
#else
|
||||||
|
#define MBOOT_BOARD_GET_RESET_MODE(initial_r0) BOARDCTRL_RESET_MODE_NORMAL
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef MBOOT_BOARD_STATE_CHANGE
|
#ifndef MBOOT_BOARD_STATE_CHANGE
|
||||||
|
#if MBOOT_ENABLE_DEFAULT_UI
|
||||||
#define MBOOT_BOARD_STATE_CHANGE(state, arg) mboot_state_change_default((state), (arg))
|
#define MBOOT_BOARD_STATE_CHANGE(state, arg) mboot_state_change_default((state), (arg))
|
||||||
|
#else
|
||||||
|
#define MBOOT_BOARD_STATE_CHANGE(state, arg)
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef MBOOT_BOARD_SYSTICK
|
#ifndef MBOOT_BOARD_SYSTICK
|
||||||
|
#if MBOOT_ENABLE_DEFAULT_UI
|
||||||
#define MBOOT_BOARD_SYSTICK() mboot_ui_systick()
|
#define MBOOT_BOARD_SYSTICK() mboot_ui_systick()
|
||||||
|
#else
|
||||||
|
#define MBOOT_BOARD_SYSTICK()
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef MBOOT_ADDRESS_SPACE_64BIT
|
#ifndef MBOOT_ADDRESS_SPACE_64BIT
|
||||||
@@ -171,8 +191,10 @@ const uint8_t *elem_search(const uint8_t *elem, uint8_t elem_id);
|
|||||||
int fsload_process(void);
|
int fsload_process(void);
|
||||||
|
|
||||||
static inline void mboot_entry_init_default(void) {
|
static inline void mboot_entry_init_default(void) {
|
||||||
|
#if MBOOT_ENABLE_DEFAULT_UI
|
||||||
// Init subsystems (mboot_get_reset_mode() may call these, calling them again is ok)
|
// Init subsystems (mboot_get_reset_mode() may call these, calling them again is ok)
|
||||||
led_init();
|
led_init();
|
||||||
|
#endif
|
||||||
|
|
||||||
// set the system clock to be HSE
|
// set the system clock to be HSE
|
||||||
SystemClock_Config();
|
SystemClock_Config();
|
||||||
|
|||||||
@@ -27,6 +27,8 @@
|
|||||||
#include "mboot.h"
|
#include "mboot.h"
|
||||||
#include "ports/stm32/boardctrl.h"
|
#include "ports/stm32/boardctrl.h"
|
||||||
|
|
||||||
|
#if MBOOT_ENABLE_DEFAULT_UI
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
// LED
|
// LED
|
||||||
|
|
||||||
@@ -253,3 +255,5 @@ void mboot_state_change_default(mboot_state_t state, uint32_t arg) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // MBOOT_ENABLE_DEFAULT_UI
|
||||||
|
|||||||
Reference in New Issue
Block a user