Skip to content

Commit c4cc5d2

Browse files
committed
ports/stm32: Fix build with Zephyr threading disabled.
When MICROPY_ZEPHYR_THREADING=0 is passed on the command line, the build would fail because the preprocessor symbol was not defined. The board config header unconditionally defined it as 1, which then tried to include Zephyr headers that weren't available. Fix by: - Making the board config define conditional (#ifndef guard) - Adding an else clause in the Makefile to define the symbol as 0 when the feature is disabled
1 parent e1f9b17 commit c4cc5d2

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

ports/stm32/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,9 @@ $(ZEPHYR_PSP_SWITCH_O): $(TOP)/extmod/zephyr_kernel/zephyr_psp_switch.S
124124
$(ECHO) "CC $<"
125125
$(Q)$(CC) $(ZEPHYR_AS_FLAGS) -c -o $@ $<
126126

127+
else
128+
# Zephyr threading disabled - ensure preprocessor symbol is defined as 0
129+
CFLAGS += -DMICROPY_ZEPHYR_THREADING=0
127130
endif
128131

129132
CROSS_COMPILE ?= arm-none-eabi-

ports/stm32/boards/NUCLEO_F429ZI/mpconfigboard.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
#define MICROPY_HW_BOARD_NAME "NUCLEO-F429ZI"
22
#define MICROPY_HW_MCU_NAME "STM32F429"
33

4-
// Enable Zephyr threading for development
4+
// Enable Zephyr threading for development (can be overridden via CFLAGS)
5+
#ifndef MICROPY_ZEPHYR_THREADING
56
#define MICROPY_ZEPHYR_THREADING 1
7+
#endif
68

79
#define MICROPY_HW_HAS_SWITCH (1)
810
#define MICROPY_HW_HAS_FLASH (1)

0 commit comments

Comments
 (0)