← index #16537Issue #18389
Off-topic · high · value 0.423
QUERY · ISSUE

mboot fails to build

openby zeroby0opened 2025-01-07updated 2026-03-18
bugport-stm32needs-info

Port, board and/or hardware

ARDUINO_PORTENTA_H7

MicroPython version

git describe --dirty: v1.24.0-181-g495ce91ca; Building for ARDUINO_PORTENTA_H7.

But the board says MicroPython v1.25.0-preview.180.g495ce91ca on 2025-01-07; Arduino Portenta H7 with STM32H747 when I flash mpython (it already has mboot I guess).

I've also tried this for tag v1.24.0 and the same error occurs.

Reproduction

Following build instructions from here: https://github.com/micropython/micropython/tree/master/ports/stm32#build-instructions

git clone https://github.com/micropython/micropython.git
cd micropython/
make -C mpy-cross
cd ports/stm32/
make BOARD=ARDUINO_PORTENTA_H7 submodules
make BOARD=ARDUINO_PORTENTA_H7
make -C mboot BOARD=ARDUINO_PORTENTA_H7

Expected behaviour

mboot builds

Observed behaviour

....
....
CC ../../../lib/uzlib/header.c
CC ../../../lib/uzlib/tinflate.c
CC adc.c
CC main.c
main.c: In function 'build_flash_layout_str':
main.c:449:40: error: 'FLASH_LAYOUT_TEMPLATE' undeclared (first use in this function); did you mean 'FLASH_LAYOUT_STR_ALLOC'?
  449 | #define FLASH_LAYOUT_STR_ALLOC (sizeof(FLASH_LAYOUT_TEMPLATE))
      |                                        ^~~~~~~~~~~~~~~~~~~~~
main.c:453:18: note: in expansion of macro 'FLASH_LAYOUT_STR_ALLOC'
  453 |     size_t len = FLASH_LAYOUT_STR_ALLOC - 1;
      |                  ^~~~~~~~~~~~~~~~~~~~~~
main.c:449:40: note: each undeclared identifier is reported only once for each function it appears in
  449 | #define FLASH_LAYOUT_STR_ALLOC (sizeof(FLASH_LAYOUT_TEMPLATE))
      |                                        ^~~~~~~~~~~~~~~~~~~~~
main.c:453:18: note: in expansion of macro 'FLASH_LAYOUT_STR_ALLOC'
  453 |     size_t len = FLASH_LAYOUT_STR_ALLOC - 1;
      |                  ^~~~~~~~~~~~~~~~~~~~~~
main.c: In function 'pyb_usbdd_StrDescriptor':
main.c:449:40: error: 'FLASH_LAYOUT_TEMPLATE' undeclared (first use in this function); did you mean 'FLASH_LAYOUT_STR_ALLOC'?
  449 | #define FLASH_LAYOUT_STR_ALLOC (sizeof(FLASH_LAYOUT_TEMPLATE))
      |                                        ^~~~~~~~~~~~~~~~~~~~~
main.c:1191:26: note: in expansion of macro 'FLASH_LAYOUT_STR_ALLOC'
 1191 |                 char buf[FLASH_LAYOUT_STR_ALLOC];
      |                          ^~~~~~~~~~~~~~~~~~~~~~
main.c:1191:22: error: unused variable 'buf' [-Werror=unused-variable]
 1191 |                 char buf[FLASH_LAYOUT_STR_ALLOC];
      |                      ^~~
cc1: all warnings being treated as errors
make: *** [Makefile:295: build-ARDUINO_PORTENTA_H7/main.o] Error 1
make: Leaving directory '........./micropython/ports/stm32/mboot'

Additional Information

Link to offending line in main.c for your convenience: https://github.com/micropython/micropython/blob/master/ports/stm32/mboot/main.c#L449

Code of Conduct

Yes, I agree

CANDIDATE · ISSUE

../py/misc.h:108:9: Error: expected »;« before »void«, NORETURN void m_malloc_fail(size_t num_bytes);

closedby ro011110otopened 2025-11-09updated 2026-01-27
needs-info

Port, board and/or hardware

esp32

MicroPython version

git describe --dirty
v1.20.0-2510-gacfeb7b7e-dirty

Reproduction

make -C mpy-cross clean
make: Verzeichnis „/home/ro011110ot/_Dev/Python/_ESP32/lvgl/lv_micropython/mpy-cross“ wird betreten
Use make V=1 or set BUILD_VERBOSE in your environment to increase build verbosity.
rm -f build/mpy-cross
rm -f build/mpy-cross.map
rm -rf build
make: Verzeichnis „/home/ro011110ot/_Dev/Python/_ESP32/lvgl/lv_micropython/mpy-cross“ wird verlassen
❯ git submodule update --init --recursive
❯ make CC=gcc-12 -C mpy-cross
make: Verzeichnis „/home/ro011110ot/_Dev/Python/_ESP32/lvgl/lv_micropython/mpy-cross“ wird betreten
Use make V=1 or set BUILD_VERBOSE in your environment to increase build verbosity.
mkdir -p build/genhdr
GEN build/genhdr/mpversion.h
GEN build/genhdr/qstr.i.last
GEN build/genhdr/qstr.split
GEN build/genhdr/qstrdefs.collected.h
QSTR updated
GEN build/genhdr/qstrdefs.generated.h
GEN build/genhdr/moduledefs.split
GEN build/genhdr/moduledefs.collected
Module registrations updated
GEN build/genhdr/moduledefs.h
GEN build/genhdr/root_pointers.split
GEN build/genhdr/root_pointers.collected
Root pointer registrations updated
GEN build/genhdr/root_pointers.h
mkdir -p build/py/
mkdir -p build/shared/runtime/
CC ../py/mpstate.c
CC ../py/nlr.c
CC ../py/nlrx86.c
CC ../py/nlrx64.c
CC ../py/nlrthumb.c
CC ../py/nlraarch64.c
CC ../py/nlrmips.c
CC ../py/nlrpowerpc.c
CC ../py/nlrxtensa.c
CC ../py/nlrrv32.c
CC ../py/nlrrv64.c
CC ../py/nlrsetjmp.c
CC ../py/malloc.c
CC ../py/gc.c
CC ../py/pystack.c
CC ../py/qstr.c
CC ../py/vstr.c
CC ../py/mpprint.c
CC ../py/unicode.c
CC ../py/mpz.c
CC ../py/reader.c
CC ../py/lexer.c
CC ../py/parse.c
CC ../py/scope.c
CC ../py/compile.c
CC ../py/emitcommon.c
CC ../py/emitbc.c
CC ../py/asmbase.c
CC ../py/asmx64.c
CC ../py/emitnx64.c
CC ../py/asmx86.c
CC ../py/emitnx86.c
CC ../py/asmthumb.c
CC ../py/emitnthumb.c
CC ../py/emitinlinethumb.c
In Datei, eingebunden von ../py/asmthumb.h:30,
von ../py/emitinlinethumb.c:33:
../py/misc.h:108:9: Fehler: expected »;« before »void«
108 | NORETURN void m_malloc_fail(size_t num_bytes);
| ^~~~~
| ;
../py/misc.h:170:1: Fehler: unbekannter Typname: »mp_uint_t«
170 | mp_uint_t unichar_xdigit_value(unichar c);
| ^~~~~~~~~
../py/misc.h:237:8: Fehler: unbekannter Typname: »mp_uint_t«
237 | extern mp_uint_t mp_verbose_flag;
| ^~~~~~~~~
../py/misc.h:382:35: Fehler: unbekannter Typname: »mp_int_t«
382 | static inline uint32_t mp_clz_mpi(mp_int_t x) {
| ^~~~~~~~
See https://github.com/micropython/micropython/wiki/Build-Troubleshooting
make: *** [../py/mkrules.mk:90: build/py/emitinlinethumb.o] Fehler 1
make: Verzeichnis „/home/ro011110ot/_Dev/Python/_ESP32/lvgl/lv_micropython/mpy-cross“ wird verlassen

Expected behaviour

Build without Errors

Observed behaviour

In Datei, eingebunden von ../py/asmthumb.h:30,
von ../py/emitinlinethumb.c:33:
../py/misc.h:108:9: Fehler: expected »;« before »void«
108 | NORETURN void m_malloc_fail(size_t num_bytes);
| ^~~~~
| ;
../py/misc.h:170:1: Fehler: unbekannter Typname: »mp_uint_t«
170 | mp_uint_t unichar_xdigit_value(unichar c);
| ^~~~~~~~~
../py/misc.h:237:8: Fehler: unbekannter Typname: »mp_uint_t«
237 | extern mp_uint_t mp_verbose_flag;
| ^~~~~~~~~
../py/misc.h:382:35: Fehler: unbekannter Typname: »mp_int_t«
382 | static inline uint32_t mp_clz_mpi(mp_int_t x) {
| ^~~~~~~~

Additional Information

With the help from Gemini i found a solution:

It seems like you're running into a build error. The compiler is reporting unknown type names like mp_uint_t and mp_int_t, which suggests a missing header file during the compilation of
emitinlinethumb.c. I'll start by examining the file py/emitinlinethumb.c to understand its dependencies.
╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ ✓ ReadFile py/emitinlinethumb.c │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
✦ py/emitinlinethumb.c includes py/asmthumb.h and py/emit.h. The error stems from py/misc.h, which is included by py/asmthumb.h. I'll examine py/asmthumb.h now.
╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ ✓ ReadFile py/asmthumb.h │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
✦ py/asmthumb.h includes py/misc.h and py/asmbase.h, but py/misc.h requires types from py/mpconfig.h which isn't included first. I'll check py/misc.h to confirm its dependencies.
╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ ✓ ReadFile py/misc.h │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
✦ py/misc.h is missing mp_uint_t, mp_int_t, and NORETURN definitions because py/emitinlinethumb.c includes py/asmthumb.h before py/mpconfig.h. Other py/ headers include py/mpconfig.h first.
I'll add #include "py/mpconfig.h" to the top of py/asmthumb.h to fix this.
╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ ✓ Edit py/asmthumb.h: #ifndef MICROPY_INCLUDED_PY_AS... => #ifndef MICROPY_INCLUDED_PY_AS... │
│ │
│ 26 #ifndef MICROPY_INCLUDED_PY_ASMTHUMB_H │
│ 27 #define MICROPY_INCLUDED_PY_ASMTHUMB_H │
│ 28 │
│ 29 + #include "py/mpconfig.h" │
│ 30 #include <assert.h> │
│ 31 #include "py/misc.h" │
│ 32 #include "py/asmbase.h"

After adding
│ 29 + #include "py/mpconfig.h"
to
py/asmthumb.h:

the build was succsess

Code of Conduct

Yes, I agree

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied