8000 ports/nrf: Add common board init macros. · micropython/micropython@233b3f4 · GitHub
[go: up one dir, main page]

Skip to content

Commit 233b3f4

Browse files
committed
ports/nrf: Add common board init macros.
1 parent 6a1dbaa commit 233b3f4

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

ports/nrf/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@ SRC_C += \
274274
drivers/ticker.c \
275275
drivers/bluetooth/ble_drv.c \
276276
drivers/bluetooth/ble_uart.c \
277+
$(wildcard boards/$(BOARD)/*.c) \
277278

278279
ifeq ($(MCU_SUB_VARIANT), nrf52840)
279280

ports/nrf/main.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,13 @@ extern uint32_t _heap_start;
107107
extern uint32_t _heap_end;
108108

109109
int main(int argc, char **argv) {
110+
// Hook for a board to run code at start up, for example check if a
111+
// bootloader should be entered instead of the main application.
112+
MICROPY_BOARD_STARTUP();
110113

111-
114+
MICROPY_BOARD_EARLY_INIT();
112115
soft_reset:
116+
113117
#if MICROPY_PY_TIME_TICKS
114118
rtc1_init_time_ticks();
115119
#endif

ports/nrf/mpconfigport.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,3 +366,11 @@ extern const struct _mp_obj_module_t music_module;
366366
#ifndef MP_NEED_LOG2
367367
#define MP_NEED_LOG2 (1)
368368
#endif
369+
370+
#ifndef MICROPY_BOARD_STARTUP
371+
#define MICROPY_BOARD_STARTUP()
372+
#endif
373+
374+
#ifndef MICROPY_BOARD_EARLY_INIT
375+
#define MICROPY_BOARD_EARLY_INIT()
376+
#endif

0 commit comments

Comments
 (0)
0