In the meantime, I have made tests with several STM32 boards that are available to me:
ADAFRUIT_F405_EXPRESS, BLACK_F407VE, PYBV11 and WEACT_H750
Since all boards are affected, I have renamed the subject from [BLACK_F407VE] to [STM32].
Originally I followed the instructions in
Getting Started. I already had a fork of MicroPython, so I took the following steps.
Code: Select all
git clone https://github.com/mitag/micropython
// Configure remote upstream
cd ~/micropython/
git checkout -b dev-branch
// Install the required dependencies for Linux:
sudo apt install build-essential libffi-dev git pkg-config
// For the stm32 port, the ARM cross-compiler is required:
// sudo apt-get install arm-none-eabi-gcc arm-none-eabi-binutils arm-none-eabi-newlib
sudo apt install gcc-arm-none-eabi binutils-arm-none-eabi libnewlib-arm-none-eabi
// --------------------------
// Building the firmware
cd boards
git clone https://github.com/mcauser/BLACK_F407VE
cd ..
make BOARD=BLACK_F407VE
LINK build-BLACK_F407VE/firmware.elf
text data bss dec hex filename
459028 80 80892 540000 83d60 build-BLACK_F407VE/firmware.elf
GEN build-BLACK_F407VE/firmware0.bin
GEN build-BLACK_F407VE/firmware1.bin
GEN build-BLACK_F407VE/firmware.dfu
GEN build-BLACK_F407VE/firmware.hex
// Flashing via DFU
make BOARD=BLACK_F407VE deploy
Writing build-BLACK_F407VE/firmware.dfu to the board
File: build-BLACK_F407VE/firmware.dfu
b'DfuSe' v1, image size: 459413, targets: 1
b'Target' 0, alt setting: 0, name: "ST...", size: 459128, elements: 2
0, address: 0x08000000, size: 14656
1, address: 0x08020000, size: 444456
usb: 0483:df11, device: 0x0000, dfu: 0x011a, b'UFD', 16, 0xa3626c2d
Writing memory...
0x08000000 14656 [=========================] 100%
0x08020000 444456 [=========================] 100%
Exiting DFU...
Finished
After several unsuccessful attempts to include the W5X00 driver in the firmware (here are only
the best of to see),
Code: Select all
mike@mpc4:~/micropython/ports/stm32$ make BOARD=WEACT_H750 MICROPY_PY_WIZNET5K=5500 MICROPY_PY_LWIP=1
Use make V=1 or set BUILD_VERBOSE in your environment to increase build verbosity.
GEN build-WEACT_H750/genhdr/qstrdefs.collected.h
QSTR not updated
GEN build-WEACT_H750/genhdr/compressed.collected
Compressed data not updated
CC ../../extmod/modlwip.c
In file included from ../../py/objlist.h:29,
from ../../extmod/modlwip.c:32:
../../extmod/modlwip.c:1564:19: error: 'MP_QSTR_sendall' undeclared here (not in a function); did you mean 'MP_QSTR_gencall'?
{ MP_ROM_QSTR(MP_QSTR_sendall), MP_ROM_PTR(&lwip_socket_sendall_obj) },
^~~~~~~~~~~~~~~
../../py/obj.h:96:56: note: in definition of macro 'MP_OBJ_NEW_QSTR'
#define MP_OBJ_NEW_QSTR(qst) ((mp_obj_t)((((mp_uint_t)(qst)) << 3) | 2))
^~~
../../extmod/modlwip.c:1564:7: note: in expansion of macro 'MP_ROM_QSTR'
{ MP_ROM_QSTR(MP_QSTR_sendall), MP_ROM_PTR(&lwip_socket_sendall_obj) },
^~~~~~~~~~~
../../extmod/modlwip.c:1568:19: error: 'MP_QSTR_makefile' undeclared here (not in a function); did you mean 'MP_QSTR_mktime'?
{ MP_ROM_QSTR(MP_QSTR_makefile), MP_ROM_PTR(&lwip_socket_makefile_obj) },
^~~~~~~~~~~~~~~~
../../py/obj.h:96:56: note: in definition of macro 'MP_OBJ_NEW_QSTR'
#define MP_OBJ_NEW_QSTR(qst) ((mp_obj_t)((((mp_uint_t)(qst)) << 3) | 2))
^~~
../../extmod/modlwip.c:1568:7: note: in expansion of macro 'MP_ROM_QSTR'
{ MP_ROM_QSTR(MP_QSTR_makefile), MP_ROM_PTR(&lwip_socket_makefile_obj) },
^~~~~~~~~~~
../../extmod/modlwip.c:1742:50: error: 'MP_QSTR_lwip' undeclared here (not in a function); did you mean 'MP_QSTR_zip'?
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_lwip) },
^~~~~~~~~~~~
../../py/obj.h:96:56: note: in definition of macro 'MP_OBJ_NEW_QSTR'
#define MP_OBJ_NEW_QSTR(qst) ((mp_obj_t)((((mp_uint_t)(qst)) << 3) | 2))
^~~
../../extmod/modlwip.c:1742:38: note: in expansion of macro 'MP_ROM_QSTR'
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_lwip) },
^~~~~~~~~~~
../../py/obj.h:96:30: error: initializer element is not constant
#define MP_OBJ_NEW_QSTR(qst) ((mp_obj_t)((((mp_uint_t)(qst)) << 3) | 2))
^
../../py/obj.h:308:24: note: in expansion of macro 'MP_OBJ_NEW_QSTR'
#define MP_ROM_QSTR(q) MP_OBJ_NEW_QSTR(q)
^~~~~~~~~~~~~~~
../../extmod/modlwip.c:1742:38: note: in expansion of macro 'MP_ROM_QSTR'
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_lwip) },
^~~~~~~~~~~
../../py/obj.h:96:30: note: (near initialization for 'mp_module_lwip_globals_table[0].value')
#define MP_OBJ_NEW_QSTR(qst) ((mp_obj_t)((((mp_uint_t)(qst)) << 3) | 2))
^
../../py/obj.h:308:24: note: in expansion of macro 'MP_OBJ_NEW_QSTR'
#define MP_ROM_QSTR(q) MP_OBJ_NEW_QSTR(q)
^~~~~~~~~~~~~~~
../../extmod/modlwip.c:1742:38: note: in expansion of macro 'MP_ROM_QSTR'
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_lwip) },
^~~~~~~~~~~
../../extmod/modlwip.c:1746:19: error: 'MP_QSTR_print_pcbs' undeclared here (not in a function); did you mean 'MP_QSTR_print'?
{ MP_ROM_QSTR(MP_QSTR_print_pcbs), MP_ROM_PTR(&lwip_print_pcbs_obj) },
^~~~~~~~~~~~~~~~~~
../../py/obj.h:96:56: note: in definition of macro 'MP_OBJ_NEW_QSTR'
#define MP_OBJ_NEW_QSTR(qst) ((mp_obj_t)((((mp_uint_t)(qst)) << 3) | 2))
^~~
../../extmod/modlwip.c:1746:7: note: in expansion of macro 'MP_ROM_QSTR'
{ MP_ROM_QSTR(MP_QSTR_print_pcbs), MP_ROM_PTR(&lwip_print_pcbs_obj) },
^~~~~~~~~~~
../../py/obj.h:96:30: error: initializer element is not constant
#define MP_OBJ_NEW_QSTR(qst) ((mp_obj_t)((((mp_uint_t)(qst)) << 3) | 2))
^
../../py/obj.h:308:24: note: in expansion of macro 'MP_OBJ_NEW_QSTR'
#define MP_ROM_QSTR(q) MP_OBJ_NEW_QSTR(q)
^~~~~~~~~~~~~~~
../../extmod/modlwip.c:1746:7: note: in expansion of macro 'MP_ROM_QSTR'
{ MP_ROM_QSTR(MP_QSTR_print_pcbs), MP_ROM_PTR(&lwip_print_pcbs_obj) },
^~~~~~~~~~~
../../py/obj.h:96:30: note: (near initialization for 'mp_module_lwip_globals_table[4].key')
#define MP_OBJ_NEW_QSTR(qst) ((mp_obj_t)((((mp_uint_t)(qst)) << 3) | 2))
^
../../py/obj.h:308:24: note: in expansion of macro 'MP_OBJ_NEW_QSTR'
#define MP_ROM_QSTR(q) MP_OBJ_NEW_QSTR(q)
^~~~~~~~~~~~~~~
../../extmod/modlwip.c:1746:7: note: in expansion of macro 'MP_ROM_QSTR'
{ MP_ROM_QSTR(MP_QSTR_print_pcbs), MP_ROM_PTR(&lwip_print_pcbs_obj) },
^~~~~~~~~~~
../../extmod/modlwip.c:1762:19: error: 'MP_QSTR_SOL_SOCKET' undeclared here (not in a function); did you mean 'MP_QSTR_SOFT_RESET'?
{ MP_ROM_QSTR(MP_QSTR_SOL_SOCKET), MP_ROM_INT(1) },
^~~~~~~~~~~~~~~~~~
../../py/obj.h:96:56: note: in definition of macro 'MP_OBJ_NEW_QSTR'
#define MP_OBJ_NEW_QSTR(qst) ((mp_obj_t)((((mp_uint_t)(qst)) << 3) | 2))
^~~
../../extmod/modlwip.c:1762:7: note: in expansion of macro 'MP_ROM_QSTR'
{ MP_ROM_QSTR(MP_QSTR_SOL_SOCKET), MP_ROM_INT(1) },
^~~~~~~~~~~
../../py/obj.h:96:30: error: initializer element is not constant
#define MP_OBJ_NEW_QSTR(qst) ((mp_obj_t)((((mp_uint_t)(qst)) << 3) | 2))
^
../../py/obj.h:308:24: note: in expansion of macro 'MP_OBJ_NEW_QSTR'
#define MP_ROM_QSTR(q) MP_OBJ_NEW_QSTR(q)
^~~~~~~~~~~~~~~
../../extmod/modlwip.c:1762:7: note: in expansion of macro 'MP_ROM_QSTR'
{ MP_ROM_QSTR(MP_QSTR_SOL_SOCKET), MP_ROM_INT(1) },
^~~~~~~~~~~
../../py/obj.h:96:30: note: (near initialization for 'mp_module_lwip_globals_table[11].key')
#define MP_OBJ_NEW_QSTR(qst) ((mp_obj_t)((((mp_uint_t)(qst)) << 3) | 2))
^
../../py/obj.h:308:24: note: in expansion of macro 'MP_OBJ_NEW_QSTR'
#define MP_ROM_QSTR(q) MP_OBJ_NEW_QSTR(q)
^~~~~~~~~~~~~~~
../../extmod/modlwip.c:1762:7: note: in expansion of macro 'MP_ROM_QSTR'
{ MP_ROM_QSTR(MP_QSTR_SOL_SOCKET), MP_ROM_INT(1) },
^~~~~~~~~~~
../../extmod/modlwip.c:1763:19: error: 'MP_QSTR_SO_REUSEADDR' undeclared here (not in a function); did you mean 'MP_QSTR_SOFT_RESET'?
{ MP_ROM_QSTR(MP_QSTR_SO_REUSEADDR), MP_ROM_INT(SOF_REUSEADDR) },
^~~~~~~~~~~~~~~~~~~~
../../py/obj.h:96:56: note: in definition of macro 'MP_OBJ_NEW_QSTR'
#define MP_OBJ_NEW_QSTR(qst) ((mp_obj_t)((((mp_uint_t)(qst)) << 3) | 2))
^~~
../../extmod/modlwip.c:1763:7: note: in expansion of macro 'MP_ROM_QSTR'
{ MP_ROM_QSTR(MP_QSTR_SO_REUSEADDR), MP_ROM_INT(SOF_REUSEADDR) },
^~~~~~~~~~~
../../py/obj.h:96:30: error: initializer element is not constant
#define MP_OBJ_NEW_QSTR(qst) ((mp_obj_t)((((mp_uint_t)(qst)) << 3) | 2))
^
../../py/obj.h:308:24: note: in expansion of macro 'MP_OBJ_NEW_QSTR'
#define MP_ROM_QSTR(q) MP_OBJ_NEW_QSTR(q)
^~~~~~~~~~~~~~~
../../extmod/modlwip.c:1763:7: note: in expansion of macro 'MP_ROM_QSTR'
{ MP_ROM_QSTR(MP_QSTR_SO_REUSEADDR), MP_ROM_INT(SOF_REUSEADDR) },
^~~~~~~~~~~
../../py/obj.h:96:30: note: (near initialization for 'mp_module_lwip_globals_table[12].key')
#define MP_OBJ_NEW_QSTR(qst) ((mp_obj_t)((((mp_uint_t)(qst)) << 3) | 2))
^
../../py/obj.h:308:24: note: in expansion of macro 'MP_OBJ_NEW_QSTR'
#define MP_ROM_QSTR(q) MP_OBJ_NEW_QSTR(q)
^~~~~~~~~~~~~~~
../../extmod/modlwip.c:1763:7: note: in expansion of macro 'MP_ROM_QSTR'
{ MP_ROM_QSTR(MP_QSTR_SO_REUSEADDR), MP_ROM_INT(SOF_REUSEADDR) },
^~~~~~~~~~~
../../extmod/modlwip.c:1765:19: error: 'MP_QSTR_IPPROTO_IP' undeclared here (not in a function); did you mean 'MP_QSTR_PERIODIC'?
{ MP_ROM_QSTR(MP_QSTR_IPPROTO_IP), MP_ROM_INT(0) },
^~~~~~~~~~~~~~~~~~
../../py/obj.h:96:56: note: in definition of macro 'MP_OBJ_NEW_QSTR'
#define MP_OBJ_NEW_QSTR(qst) ((mp_obj_t)((((mp_uint_t)(qst)) << 3) | 2))
^~~
../../extmod/modlwip.c:1765:7: note: in expansion of macro 'MP_ROM_QSTR'
{ MP_ROM_QSTR(MP_QSTR_IPPROTO_IP), MP_ROM_INT(0) },
^~~~~~~~~~~
../../py/obj.h:96:30: error: initializer element is not constant
#define MP_OBJ_NEW_QSTR(qst) ((mp_obj_t)((((mp_uint_t)(qst)) << 3) | 2))
^
../../py/obj.h:308:24: note: in expansion of macro 'MP_OBJ_NEW_QSTR'
#define MP_ROM_QSTR(q) MP_OBJ_NEW_QSTR(q)
^~~~~~~~~~~~~~~
../../extmod/modlwip.c:1765:7: note: in expansion of macro 'MP_ROM_QSTR'
{ MP_ROM_QSTR(MP_QSTR_IPPROTO_IP), MP_ROM_INT(0) },
^~~~~~~~~~~
../../py/obj.h:96:30: note: (near initialization for 'mp_module_lwip_globals_table[13].key')
#define MP_OBJ_NEW_QSTR(qst) ((mp_obj_t)((((mp_uint_t)(qst)) << 3) | 2))
^
../../py/obj.h:308:24: note: in expansion of macro 'MP_OBJ_NEW_QSTR'
#define MP_ROM_QSTR(q) MP_OBJ_NEW_QSTR(q)
^~~~~~~~~~~~~~~
../../extmod/modlwip.c:1765:7: note: in expansion of macro 'MP_ROM_QSTR'
{ MP_ROM_QSTR(MP_QSTR_IPPROTO_IP), MP_ROM_INT(0) },
^~~~~~~~~~~
../../extmod/modlwip.c:1766:19: error: 'MP_QSTR_IP_ADD_MEMBERSHIP' undeclared here (not in a function); did you mean 'IP_ADD_MEMBERSHIP'?
{ MP_ROM_QSTR(MP_QSTR_IP_ADD_MEMBERSHIP), MP_ROM_INT(IP_ADD_MEMBERSHIP) },
^~~~~~~~~~~~~~~~~~~~~~~~~
../../py/obj.h:96:56: note: in definition of macro 'MP_OBJ_NEW_QSTR'
#define MP_OBJ_NEW_QSTR(qst) ((mp_obj_t)((((mp_uint_t)(qst)) << 3) | 2))
^~~
../../extmod/modlwip.c:1766:7: note: in expansion of macro 'MP_ROM_QSTR'
{ MP_ROM_QSTR(MP_QSTR_IP_ADD_MEMBERSHIP), MP_ROM_INT(IP_ADD_MEMBERSHIP) },
^~~~~~~~~~~
../../py/obj.h:96:30: error: initializer element is not constant
#define MP_OBJ_NEW_QSTR(qst) ((mp_obj_t)((((mp_uint_t)(qst)) << 3) | 2))
^
../../py/obj.h:308:24: note: in expansion of macro 'MP_OBJ_NEW_QSTR'
#define MP_ROM_QSTR(q) MP_OBJ_NEW_QSTR(q)
^~~~~~~~~~~~~~~
../../extmod/modlwip.c:1766:7: note: in expansion of macro 'MP_ROM_QSTR'
{ MP_ROM_QSTR(MP_QSTR_IP_ADD_MEMBERSHIP), MP_ROM_INT(IP_ADD_MEMBERSHIP) },
^~~~~~~~~~~
../../py/obj.h:96:30: note: (near initialization for 'mp_module_lwip_globals_table[14].key')
#define MP_OBJ_NEW_QSTR(qst) ((mp_obj_t)((((mp_uint_t)(qst)) << 3) | 2))
^
../../py/obj.h:308:24: note: in expansion of macro 'MP_OBJ_NEW_QSTR'
#define MP_ROM_QSTR(q) MP_OBJ_NEW_QSTR(q)
^~~~~~~~~~~~~~~
../../extmod/modlwip.c:1766:7: note: in expansion of macro 'MP_ROM_QSTR'
{ MP_ROM_QSTR(MP_QSTR_IP_ADD_MEMBERSHIP), MP_ROM_INT(IP_ADD_MEMBERSHIP) },
^~~~~~~~~~~
make: *** [../../py/mkrules.mk:77: build-WEACT_H750/extmod/modlwip.o] Fehler 1
Code: Select all
mike@mpc4:~/micropython/ports/stm32$ make clean
Use make V=1 or set BUILD_VERBOSE in your environment to increase build verbosity.
rm -rf build-PYBV10
mike@mpc4:~/micropython/ports/stm32$ make BOARD=PYBV11 MICROPY_PY_WIZNET5K=5500 MICROPY_PY_LWIP=1
Use make V=1 or set BUILD_VERBOSE in your environment to increase build verbosity.
CC mpnetworkport.c
mpnetworkport.c: In function 'pyb_lwip_poll':
mpnetworkport.c:58:5: error: implicit declaration of function 'wiznet5k_poll' [-Werror=implicit-function-declaration]
wiznet5k_poll();
^~~~~~~~~~~~~
cc1: all warnings being treated as errors
make: *** [../../py/mkrules.mk:77: build-PYBV11/mpnetworkport.o] Fehler 1
I dug through the forum, code, the issues and various README.md on github.com/micropython/micropython, as well as the net using search engines.
After this hint I cloned micropython/miropython again:
Re: Pyboard + W5500/W5200 Ethernet - Cant get it to work - MicroPython v1.11-422-g98c2eabaf
wangshujun@tom.com wrote: ↑Wed Nov 17, 2021 1:26 am
Download the package of 1.17 + daily update package from the official website, and the compilation will report the above error
If you clone directly from GitHub, the compilation is correct
Unfortunately, in my case, I could not confirm this advice.
Code: Select all
// due to a hint in the forum, I clone directly without diversions via my fork.
mike@mpc4:~/micropython$ cd ~
mike@mpc4:~$ mkdir mp.org
mike@mpc4:~$ cd mp.org/
mike@mpc4:~/mp.org$ git clone https://github.com/micropython/micropython
mike@mpc4:~/mp.org$ cd micropython/
mike@mpc4:~/mp.org/micropython$ git submodule update --init
mike@mpc4:~/mp.org/micropython$ cd ports/stm32/
mike@mpc4:~/mp.org/micropython/ports/stm32$ make BOARD=PYBV11 submodules
mike@mpc4:~/mp.org/micropython$ make BOARD=PYBV11 MICROPY_PY_WIZNET5K=5500 MICROPY_PY_LWIP=1
// there are more errors instead of fewer
For all boards, except for the PYBV11, I can create firmware without W5x00 in ~/micropython/ports/stm32 as well as in ~/mp.org/micropython/ports/stm32, flash it and get to the respective REPL prompt with Thonny. Unfortunately, I can't say why I can't generate any firmware for the PYBV11 and since when. The board had slipped between some LCDs and I only found it after an extensive search.
At some point I got into the habit of recording every step and in such cases I am extremely happy about it, even if I am actually too lazy to write so much and copy written as well as resulting messages.