diff options
| -rw-r--r-- | ports/nrf/Makefile | 1 | ||||
| -rw-r--r-- | ports/nrf/main.c | 5 | ||||
| -rw-r--r-- | ports/nrf/mpconfigport.h | 8 |
3 files changed, 14 insertions, 0 deletions
diff --git a/ports/nrf/Makefile b/ports/nrf/Makefile index c32e09d2c..55cce1906 100644 --- a/ports/nrf/Makefile +++ b/ports/nrf/Makefile @@ -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) diff --git a/ports/nrf/main.c b/ports/nrf/main.c index 2ec16194c..091aa73f4 100644 --- a/ports/nrf/main.c +++ b/ports/nrf/main.c @@ -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 diff --git a/ports/nrf/mpconfigport.h b/ports/nrf/mpconfigport.h index 29bdd3f80..04bd5b4c2 100644 --- a/ports/nrf/mpconfigport.h +++ b/ports/nrf/mpconfigport.h @@ -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 |
