nrf/main: Add startup and early-init board hook macros.
Following stm32 for naming and location of the hooks. Also allow a board to provide custom .c files to implement code for these hooks.
This commit is contained in:
parent
9b486340da
commit
921dd94676
|
@ -274,6 +274,7 @@ SRC_C += \
|
|||
drivers/ticker.c \
|
||||
drivers/bluetooth/ble_drv.c \
|
||||
drivers/bluetooth/ble_uart.c \
|
||||
$(wildcard $(BOARD_DIR)/*.c) \
|
||||
|
||||
ifeq ($(MCU_SUB_VARIANT), nrf52840)
|
||||
|
||||
|
|
|
@ -107,9 +107,14 @@ extern uint32_t _heap_start;
|
|||
extern uint32_t _heap_end;
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
// Hook for a board to run code at start up, for example check if a
|
||||
// bootloader should be entered instead of the main application.
|
||||
MICROPY_BOARD_STARTUP();
|
||||
|
||||
MICROPY_BOARD_EARLY_INIT();
|
||||
|
||||
soft_reset:
|
||||
|
||||
#if MICROPY_PY_TIME_TICKS
|
||||
rtc1_init_time_ticks();
|
||||
#endif
|
||||
|
|
|
@ -366,3 +366,11 @@ extern const struct _mp_obj_module_t music_module;
|
|||
#ifndef MP_NEED_LOG2
|
||||
#define MP_NEED_LOG2 (1)
|
||||
#endif
|
||||
|
||||
#ifndef MICROPY_BOARD_STARTUP
|
||||
#define MICROPY_BOARD_STARTUP()
|
||||
#endif
|
||||
|
||||
#ifndef MICROPY_BOARD_EARLY_INIT
|
||||
#define MICROPY_BOARD_EARLY_INIT()
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue