W5500 Ethernet controller on OpenMV

Hi all,

I was wondering if anyone successfully built the openmv with the “MICROPY_PY_WIZNET5K=5500” flag?
Below is the error when I try to build it.

CC src/usbd_uvc_if.c
CC src/usbd_conf.c
CC src/main.c
CC src/usbd_core.c
CC src/usbd_ctlreq.c
CC src/stm32fxxx_it.c
CC src/string0.c
CC src/usbd_uvc.c
CC src/usbd_ioreq.c
CC src/usbd_desc.c
CC src/systick.c
make[1]: Leaving directory '/home/piliwilliam/openmv/src/uvc'
/home/piliwilliam/openmv/src/build/micropython/modnetwork.o:(.rodata.mp_module_network_globals_table+0xc): undefined reference to `mod_network_nic_type_wiznet5k'
collect2: error: ld returned 1 exit status
Makefile:497: recipe for target 'firmware' failed
make: *** [firmware] Error 1

It looks like you need to edit the MakeFile to include the wiznet c code. Usually, this means you need to find what .c file makes that thing up and add it to the MakeFile which compiles the C file and you also need to edit the main MakeFile that links the .o files.

Having the same issue the screenshot showed the relevant files needed for this variable are available i’m not expert in C code but any help would be very much appreciated as there is only a hand full of comments on this error online.

You need to edit the make file system to include the compile the specified file and then include the .o.

I don’t actually know which files you need to modify. However, it’s not hard. You just have to go into the make files and add the missing file in the right places.

This is a update of my findings:

Using the “MICROPY_PY_WIZNET5K=5500” flag:

this files the compiling of the c code in the stm32/makefile

ifneq ($(MICROPY_PY_WIZNET5K),0)
ifeq ($(MICROPY_PY_LWIP),1)
# When using MACRAW mode (with lwIP), maximum buffer space must be used for the raw socket
SRC_MOD += network_wiznet5k.c modnwwiznet5k.c
SRC_MOD += $(addprefix $(WIZNET5K_DIR)/,\
	ethernet/wizchip_conf.c \
	ethernet/socket.c \
	internet/dns/dns.c \

This error is still occurring even when i have added the o files that have been compiled in the


After added the relevant compiled libraries into the build in the /src/MakeFile

ifneq ($(MICROPY_PY_WIZNET5K),0)
FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/drivers/,\
	wiznet5k/ethernet/w$(MICROPY_PY_WIZNET5K)/w$(MICROPY_PY_WIZNET5K).o \
	wiznet5k/ethernet/wizchip_conf.o \
	wiznet5k/ethernet/socket.o \
	wiznet5k/internet/dns/dns.o \

This is still causing the original issue

/home/jack/Development/OPENMV_FIRMWARE/openmv/src/build/micropython/modnetwork.o:(.rodata.mp_module_network_globals_table+0xc): undefined reference to `mod_network_nic_type_wiznet5k'
collect2: error: ld returned 1 exit status
Makefile:674: recipe for target 'firmware' failed
make: *** [firmware] Error 1

There is only one modnetwork.o so that doesnt need to be changed. all the relevant files are in place. I am unsure what ‘mod_network_nic_type_wiznet5k’ maybe its a parameter needed in the make file i have logged an issue with the micropython github hopefully they can give me the parameter i need to declare: MICROPY_PY_WIZNET5K=5500: `mod_network_nic_type_wiznet5k' · Issue #6625 · micropython/micropython · GitHub

You need to link the object file that has the object, grep is your friend:

> grep -r mod_network_nic_type_wiznet5k *
ports/stm32/modnwwiznet5k.c:    wiznet5k_obj.base.type = (mp_obj_type_t*)&mod_network_nic_type_wiznet5k;
ports/stm32/modnwwiznet5k.c:const mod_network_nic_type_t mod_network_nic_type_wiznet5k = {

In that file you’ll see that it also needs LWIP enabled:


Thank you for the response you’re a life saver, wish i knew about grep before! it has fixed all my issues! now on to testing :open_mouth:
That a hardware engineer trying to learn firmware for you :laughing:
I will make a pull request in the morning!
All the Best,

Now Receiving this error:

Warning: FROZEN_MPY_DIR is deprecated in favour of FROZEN_MANIFEST
CC modnetwork.c
In file included from /home/jack/Development/OPENMV_FIRMWARE/openmv/src/micropython/py/objlist.h:29:0,
                 from modnetwork.c:31:
modnetwork.c:148:46: error: 'mod_network_nic_type_winc' undeclared here (not in a function); did you mean 'mod_network_nic_type_wiznet5k'?
     { MP_ROM_QSTR(MP_QSTR_WINC), MP_ROM_PTR(&mod_network_nic_type_winc) },
/home/jack/Development/OPENMV_FIRMWARE/openmv/src/micropython/py/obj.h:249:24: note: in definition of macro 'MP_ROM_PTR'
 #define MP_ROM_PTR(p) (p)
../../py/mkrules.mk:47: recipe for target '/home/jack/Development/OPENMV_FIRMWARE/openmv/src/build/micropython/modnetwork.o' failed
make[1]: *** [/home/jack/Development/OPENMV_FIRMWARE/openmv/src/build/micropython/modnetwork.o] Error 1
Makefile:643: recipe for target 'FIRMWARE_OBJS' failed
make: *** [FIRMWARE_OBJS] Error 2

when is use the grep command i get this:

grep -r mod_network_nic_type_winc *
build/micropython/genhdr/qstr.i.last:    { ((mp_obj_t)((((mp_uint_t)(MP_QSTR_WINC)) << 2) | 2)), (&mod_network_nic_type_winc) },
micropython/ports/stm32/modnetwork.h:extern const mod_network_nic_type_t mod_network_nic_type_winc;
micropython/ports/stm32/modnetwork.c:    { MP_ROM_QSTR(MP_QSTR_WINC), MP_ROM_PTR(&mod_network_nic_type_winc) },
omv/py/py_winc.c:static const winc_obj_t winc_obj = {{(mp_obj_type_t*)&mod_network_nic_type_winc}};
omv/py/py_winc.c:const mod_network_nic_type_t mod_network_nic_type_winc = {

All of these files except for :

are accounted for in the make files, is there anything obvious im missing?

You’ve disabled the winc1500, you need to re-enable it too or remove that line.

Forcing the compile flag has the same result with or without


same error as above has been causing with:


when force disable MICROPY_PY_WINC1500 with:


This is my error message:

CC src/systick.c
/usr/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/bin/ld: /home/jack/Development/OPENMV_FIRMWARE/openmv/src/build/bin/firmware.elf section `.text' will not fit in region `FLASH_TEXT'
/usr/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/bin/ld: /home/jack/Development/OPENMV_FIRMWARE/openmv/src/build/bin/firmware.elf section `._heap' will not fit in region `SRAM1'
/usr/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/bin/ld: region `SRAM1' overflowed by 24012 bytes
/usr/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/bin/ld: region `FLASH_TEXT' overflowed by 16 bytes
/home/jack/Development/OPENMV_FIRMWARE/openmv/src/build/micropython/modnetwork.o: In function `pyb_lwip_poll':
/home/jack/Development/OPENMV_FIRMWARE/openmv/src/micropython/ports/stm32/modnetwork.c:61: undefined reference to `wiznet5k_poll'
/home/jack/Development/OPENMV_FIRMWARE/openmv/src/build/micropython/modnetwork.o:(.rodata.mp_module_network_globals_table+0xc): undefined reference to `mod_network_nic_type_wiznet5k'
collect2: error: ld returned 1 exit status
Makefile:667: recipe for target 'firmware' failed
make: *** [firmware] Error 1

It looks likes LWIP is causing this somehow, any ideas?

I see multiple issues, first if you want to disable modules like WINC you need to edit this file:


Set WINC to 0.

I think this config will work for you:


/usr/bin/…/lib/gcc/arm-none-eabi/7.3.1/…/…/…/…/arm-none-eabi/bin/ld: region SRAM1' overflowed by 24012 bytes /usr/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/bin/ld: region FLASH_TEXT’ overflowed by 16 bytes

If you get this you need to disable things until the firmware fits, try to disable things in imlib_config.h and you need to lower the heap in omv_boardconfig.h

/home/jack/Development/OPENMV_FIRMWARE/openmv/src/build/micropython/modnetwork.o: In function `pyb_lwip_poll':
/home/jack/Development/OPENMV_FIRMWARE/openmv/src/micropython/ports/stm32/modnetwork.c:61: undefined reference to `wiznet5k_poll'

I think the above config will fix these.

Finally keep in mind that even if it builds it still may not work with our firmware, it may be missing a callback or something, so you’re on your own here.