Skip to content

Commit 1ad5e79

Browse files
committed
MicroPython: build tweaks and fixes
1 parent e21b4af commit 1ad5e79

File tree

3 files changed

+18
-13
lines changed

3 files changed

+18
-13
lines changed

advanced/micropython/port-riscv-emu.py/Makefile

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,6 @@ INC += -I$(TOP)
6868
INC += -I$(BUILD)
6969

7070
ifeq ($(CROSS), 1)
71-
DFU = $(TOP)/tools/dfu.py
72-
PYDFU = $(TOP)/tools/pydfu.py
73-
7471
# Base RISC-V flags (bare-metal)
7572
CFLAGS_RISCV = -march=$(MARCH) -mabi=ilp32
7673

@@ -185,11 +182,7 @@ OBJ += $(addprefix $(BUILD)/, $(SRC_C:.c=.o))
185182
OBJ += $(addprefix $(BUILD)/, $(SRC_S:.S=.o))
186183
OBJ += $(addprefix $(BUILD)/, $(SRC_CXX:.cpp=.o))
187184

188-
ifeq ($(CROSS), 1)
189-
all: $(BUILD)/firmware.dfu
190-
else
191-
all: $(BUILD)/firmware.elf
192-
endif
185+
all: $(BUILD)/firmware.elf $(BUILD)/firmware.bin
193186

194187
# Print build configuration
195188
$(info Building MicroPython port in MODE=$(MODE))

advanced/micropython/port-riscv-emu.py/mpconfigport.h

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,22 @@
1515
#define MICROPY_PORT_MODE MODE_REPL_NEWLIB
1616
#endif
1717

18-
// Use CORE_FEATURES ROM level as base, then explicitly enable what we need
19-
#define MICROPY_CONFIG_ROM_LEVEL (MICROPY_CONFIG_ROM_LEVEL_CORE_FEATURES)
18+
// Use EXTRA_FEATURES for full-featured REPL_NEWLIB, CORE_FEATURES for minimal modes
19+
#if (MICROPY_PORT_MODE == MODE_REPL_NEWLIB)
20+
#define MICROPY_CONFIG_ROM_LEVEL (MICROPY_CONFIG_ROM_LEVEL_EXTRA_FEATURES)
21+
#else
22+
#define MICROPY_CONFIG_ROM_LEVEL (MICROPY_CONFIG_ROM_LEVEL_CORE_FEATURES)
23+
#endif
2024

2125
// Float support - disabled for HEADLESS and REPL_UART to eliminate libc dependencies
2226
#if (MICROPY_PORT_MODE == MODE_REPL_NEWLIB)
2327
#define MICROPY_PY_BUILTINS_FLOAT (1)
2428
#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_FLOAT)
2529
#define MICROPY_PY_MATH (1)
26-
#define MICROPY_PY_CMATH (0)
2730
#else
2831
#define MICROPY_PY_BUILTINS_FLOAT (0)
2932
#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_NONE)
3033
#define MICROPY_PY_MATH (0)
31-
#define MICROPY_PY_CMATH (0)
3234
#endif
3335

3436
#define MICROPY_ENABLE_COMPILER (1)
@@ -65,6 +67,7 @@
6567
#define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_NONE)
6668
#endif
6769
#define MICROPY_PY_BUILTINS_COMPLEX (0)
70+
#define MICROPY_PY_CMATH (0)
6871
#define MICROPY_PY_IO (0) // no file system or streams
6972

7073
// Explicitly enable modules we need (some may not be in CORE_FEATURES)
@@ -79,7 +82,6 @@
7982
#define MICROPY_PY_BINASCII (1)
8083
#define MICROPY_PY_RE (1)
8184
#define MICROPY_PY_HEAPQ (1)
82-
#define MICROPY_PY_HASHLIB (0)
8385
#define MICROPY_PY_JSON (1)
8486
#define MICROPY_PY_UCTYPES (1)
8587

@@ -89,6 +91,16 @@
8991
#define MICROPY_PY_MACHINE_MEMX (1)
9092
#define MICROPY_PY_MACHINE_SIGNAL (0)
9193

94+
// Additional modules for REPL_NEWLIB mode only
95+
#if (MICROPY_PORT_MODE == MODE_REPL_NEWLIB)
96+
// Cryptographic hashing for checksums and data integrity
97+
#define MICROPY_PY_HASHLIB (1)
98+
#define MICROPY_PY_HASHLIB_SHA1 (1)
99+
#define MICROPY_PY_HASHLIB_SHA256 (1)
100+
#else
101+
#define MICROPY_PY_HASHLIB (0)
102+
#endif
103+
92104
#define MICROPY_PY_SYS (1)
93105
#define MICROPY_PY_SYS_MODULES (1)
94106
#define MICROPY_PY_SYS_PLATFORM "riscv-emu.py"

prebuilt/micropython_repl_uart.bin

190 KB
Binary file not shown.

0 commit comments

Comments
 (0)