Hi, I’m having trouble compiling Ethernet sample program at [1] which depends on mbed latest Network Socket API when using PlatformIO IDE. Everything works fine (compiles and runs) when using the ARM mbed online compiler. I’m using following boards;
NXP LPC1768
STM32 NUCLEO-F767ZI
Please use the link at the bottom to refer to the source code.
Compile error:
In file included from src/main.cpp:2:0:
/home/akila/.platformio/packages/framework-mbed/features/unsupported/net/eth/EthernetInterface/EthernetInterface.h:24:2: error: #error The Ethernet Interface library is not supported on this target
; #error The Ethernet Interface library is not supported on this target
platformio.ini
[env:nucleo_f767zi]
build_flags = -Wall -DMBED_CONF_LWIP_IPV4_ENABLED -DMBED_CONF_LWIP_IP_VER_PREF=4
platform = ststm32
board = nucleo_f767zi
framework = mbed
; lib_ignore = mbed-net ; does not work even when enabled
; lib_ldf_mode = deep+ ; does not work even when enabled
It seems a similar issue is reported in [2]. I noticed that mbed builder script (mbed.py under builder-framework-mbed) [3] is still trying to include mbed old networking module (features/unsupported/net) but there is no option to include the latest feature-lwip module. I tried tweaking mbed.py script to include features/FEATURE_LWIP/lwip-interface and features/netsocket modules and managed to get it compiled. However, it fails to create an Ethernet connection after uploading the program.
I seem to have the same problem. Everything is up to date as far as I can determine, but the Ethernet sample will not compile. I’m quite new to this so some help would be appreciated.
PackageManager: Installing toolchain-gccarmnoneeabi @ >=1.60301.0
Downloading…
Unpacking…
Verbose mode can be enabled via -v, --verbose option
Collected 22 compatible libraries
Looking for dependencies…
Library Dependency Graph
|--
| |--
| |--
| |--
Linking .pioenvs\disco_f769ni\firmware.elf
…
.pioenvs/disco_f769ni/lib/FEATURE_LWIP/lwip-interface/lwip-sys/arch/lwip_sys_arch.o: In function sys_arch_mbox_fetch': lwip_sys_arch.c:(.text.sys_arch_mbox_fetch+0x22): undefined reference toosEventFlagsWait’
lwip_sys_arch.c:(.text.sys_arch_mbox_fetch+0x2e): undefined reference to osKernelLock' lwip_sys_arch.c:(.text.sys_arch_mbox_fetch+0x54): undefined reference toosEventFlagsSet’
lwip_sys_arch.c:(.text.sys_arch_mbox_fetch+0x68): undefined reference to osEventFlagsClear' lwip_sys_arch.c:(.text.sys_arch_mbox_fetch+0x6e): undefined reference toosKernelRestoreLock’
.pioenvs/disco_f769ni/lib/FEATURE_LWIP/lwip-interface/lwip-sys/arch/lwip_sys_arch.o: In function sys_arch_mbox_tryfetch': lwip_sys_arch.c:(.text.sys_arch_mbox_tryfetch+0xe): undefined reference toosEventFlagsWait’
lwip_sys_arch.c:(.text.sys_arch_mbox_tryfetch+0x1a): undefined reference to osKernelLock' lwip_sys_arch.c:(.text.sys_arch_mbox_tryfetch+0x40): undefined reference toosEventFlagsSet’
lwip_sys_arch.c:(.text.sys_arch_mbox_tryfetch+0x54): undefined reference to osEventFlagsClear' lwip_sys_arch.c:(.text.sys_arch_mbox_tryfetch+0x5a): undefined reference toosKernelRestoreLock’
.pioenvs/disco_f769ni/lib/FEATURE_LWIP/lwip-interface/lwip-sys/arch/lwip_sys_arch.o: In function sys_sem_new': lwip_sys_arch.c:(.text.sys_sem_new+0x20): undefined reference toosSemaphoreNew’
.pioenvs/disco_f769ni/lib/FEATURE_LWIP/lwip-interface/lwip-sys/arch/lwip_sys_arch.o: In function sys_arch_sem_wait': lwip_sys_arch.c:(.text.sys_arch_sem_wait+0x18): undefined reference toosSemaphoreAcquire’
.pioenvs/disco_f769ni/lib/FEATURE_LWIP/lwip-interface/lwip-sys/arch/lwip_sys_arch.o: In function sys_sem_signal': lwip_sys_arch.c:(.text.sys_sem_signal+0x4): undefined reference toosSemaphoreRelease’
.pioenvs/disco_f769ni/lib/FEATURE_LWIP/lwip-interface/lwip-sys/arch/lwip_sys_arch.o: In function sys_mutex_new': lwip_sys_arch.c:(.text.sys_mutex_new+0x1c): undefined reference toosMutexNew’
.pioenvs/disco_f769ni/lib/FEATURE_LWIP/lwip-interface/lwip-sys/arch/lwip_sys_arch.o: In function sys_mutex_lock': lwip_sys_arch.c:(.text.sys_mutex_lock+0x8): undefined reference toosMutexAcquire’
.pioenvs/disco_f769ni/lib/FEATURE_LWIP/lwip-interface/lwip-sys/arch/lwip_sys_arch.o: In function sys_mutex_unlock': lwip_sys_arch.c:(.text.sys_mutex_unlock+0x4): undefined reference toosMutexRelease’
.pioenvs/disco_f769ni/lib/FEATURE_LWIP/lwip-interface/lwip-sys/arch/lwip_sys_arch.o: In function sys_init': lwip_sys_arch.c:(.text.sys_init+0x14): undefined reference toosMutexNew’
.pioenvs/disco_f769ni/lib/FEATURE_LWIP/lwip-interface/lwip-sys/arch/lwip_sys_arch.o: In function sys_arch_protect': lwip_sys_arch.c:(.text.sys_arch_protect+0xa): undefined reference toosMutexAcquire’
.pioenvs/disco_f769ni/lib/FEATURE_LWIP/lwip-interface/lwip-sys/arch/lwip_sys_arch.o: In function sys_arch_unprotect': lwip_sys_arch.c:(.text.sys_arch_unprotect+0x6): undefined reference toosMutexRelease’
.pioenvs/disco_f769ni/lib/FEATURE_LWIP/lwip-interface/lwip-sys/arch/lwip_sys_arch.o: In function sys_thread_new': lwip_sys_arch.c:(.text.sys_thread_new+0x72): undefined reference toosThreadNew’
collect2.exe: error: ld returned 1 exit status
*** [.pioenvs\disco_f769ni\firmware.elf] Error 1
[ERROR] Took 32.67 seconds
strange thing I noticed that it starts with installing a new compiler packages, but when i run the update packages command this get uninstalled again… output:
Only thing I’m still curious about is: why it was necessary to add the rtos flag. In my day job I get spoiled with managed and scripting languages, so when I have to get back to c/c++ I can read and understand most of it, but I keep being surprised by the amount of what I would call “configuration” that needs to be done to get things compiling. If the rtos is needed why did the ethernet/lwip feature not pull it in automatically? Would that be a platformio/mbed bug or a lack of knowledge on my part.
I think PIO authors have intentionally left RTOS to be enabled by explicitly passing a build_arg. This is probably because RTOS features are not needed unless you are developing a real-time application and it takes up some resources from the MCU. But I get your point, PIO should be able to detect whether “rtos.h” has been included and automatically handle those dependencies.