EthernetInterface problem

hello, I want to use ethernet on DISCO_F746NG. mbed reference Ethernet - API references and tutorials | Mbed OS 6 Documentation
After adding “mbed-netsocket” in the CMakeList.txt i’m getting this errors.


can anyone help me to fix this problem.

Is it possible that you moved or uninstalled GNU ARM after configuring your project? It looks like CMake is trying to execute a gcc that doesn’t exist. Try deleting your CMake build directory and recreating it to force it to search for the compiler again.

I have tried deleting CMake build directory and recreating it, but that does not work in my case. Also everything works fine after removing “mbed-netsocket” from CMakeList.txt and commenting all Ethernet stuff. is there anything else to add in CMakeList to try ethernet example?

Oh, I bet this is a command line length issue. Sometimes, adding a lot of extra modules leads to you building up a huge number of #defines and other flags on the command line, which goes over a Windows internal limit and prevents the code from building.

I applied some mitigations for this issue in the Mbed Community Edition fork, so you might be able to try that and see if it helps. Other than that, you could try compiling in Linux/WSL, which would probably work around the issue.

I have tried the Mbed community edition but got the same result. I’ve even tried this example: GitHub - ARMmbed/mbed-os-example-sockets: Simple example for the network-socket API
using Mbed Cli2 commands. Result is the same. if I got "mbed-netsocket” in my main CMakeList.txt l’m getting this type of error. I spent the whole day just to include the Ethernet interface. I wonder if you could explain me how to compile my clion project using WSL(i’ve got one). Thanks for your attention. I’m looking forward to your reply.

I’m using mbed-ce with a Nucleo-F746NG and ethernet, it works very fine.

my CMakeLists.txt:

#
# Mbed CE Hello World Project
#
cmake_minimum_required(VERSION 3.19)
cmake_policy(VERSION 3.19)

# Initialize Mbed OS build system. 
# Note: This block must be before the project() call.
set(MBED_APP_JSON_PATH mbed_app.json)

include(mbed-os/tools/cmake/app.cmake) # Load Mbed CE toolchain file and basic build system

# If you need any custom upload method configuration for your target, do that here

add_subdirectory(mbed-os) # Load Mbed OS build targets.  Must be added before any other subdirectories
add_subdirectory(libs/MQTTPacket)
add_subdirectory(libs/MQTTClient)

project(IMS-HSD)

add_executable(HSDTriggerController
    main.cpp
)

target_link_libraries(HSDTriggerController mbed-os) # Can also link to mbed-baremetal here
target_link_libraries(HSDTriggerController mbed-netsocket) 
target_link_libraries(HSDTriggerController MQTT_packet)
target_link_libraries(HSDTriggerController MQTT_client)

mbed_set_post_build(HSDTriggerController) # Must call this for each target to set up bin file creation, code upload, etc

mbed_finalize_build() # Make sure this is the last line of the top-level buildscript

all libraries could be added in one target_link_libraries call.

In another project I’m using also Disco F746 with ethernet, works in the same way. I startet on a windows machine, and now WSL2 is working also with USB and compiling much faster, so I have built this project also in WSL2.

Have you tried to compile in command line? Could it be some setting in CLion?

hallo Johannes could you send me your project “Disco F746 with ethernet” and also give me some references to build project using wls2

my project is a little bit complex, its on github already:

It has the configuration for VSCode. Jamie has written detailed steps to setup the toolchain and the VSCode project.
When the mbed-ce-hello is compiling then my project should run also. On the Disco F746, I still some problems with the SD card, it has to be commented out first, I’m still working on it. Also the DS1820 temperature sensor will cause an error when missing, the io_thread should not be started.

I’ve used command line project setup guide in wls terminal
reference: Project Setup: Command Line · mbed-ce/mbed-os Wiki · GitHub
got this error:

Please try again without <> around the target name. For your board, replace it with DISCO_F746NG.

Final results: “I did it”


using WLS2 both mbed-os and mbed-ce. thank both of you very much indeed it was limited by windows but it took 1 hour to fully build which is too long from my point of view. even the blink project took five times more than Clion on windows. what could be the problem?

great, except the long build time. That is why I installed everything again on WSL2 because it is about 5 times faster compiling than on Windows. Are you using a HDD instead of SSD? Not enough RAM? But even on my Laptop with 16 GB RAM WSL is pretty fast.
I have installed also CCache, but that does give a benefit for the first time compiling.

Ok, after a closer look I see the problem:
You are using the /mnt/c/, so you are on the windows filesystem. It will be much much faster when you copy / clone your project to a project folder in your WSL home directory and compile it there.
Also the toolchain should be installed in WSL, the Linux toolchain is 64 bit executable instead of 32 bit for Windows.

And the long pathname should be no problem with mbed-ce as Jamie already said, mbed-ce uses a response file as input for the linker. But afaik this was also solved with CLI1/CLI2 in mbed-os, only exports to other IDE/makefile had that problem.

When you want to use WSL2, it is good news that USB works now and can be used for debugging/flashing the target hardware. With feature preview build 22H2 in Win10, even GUI apps are working now.

And when you use WSL, VSCode is working perfectly together with it. It connects to WSL and mbed-ce uses the cmake-tools extension. That is really great stuff.

Hello again. Jojos you were right the long build time was associated with the windows file system. As a machine l’m using i7 11gen combined with Nwme SSD and 32Gb RAM. Now the build took exactly one minute instead of 60:ddd 60x times faster. now I have switched to my development board based on STM32f407VGT and using this repo as a custom target for F407VGT MCU GitHub - JojoS62/custom_targets: Custom target definitions for Mbed5
when i am building as DEVEBOX_F407VG target i do not get the result from the ethernet example.


But when i am building as ARCH_MAX target which is based on STM32F407VET it works pretty fine. Jojos can you help me with this problem as i see this is your repository if I’m not wrong.

Hi Giorgi,
What is your Ethernet Phy and what is its address? It is possible that just the address is different. The address can be defined in mbed_app.json.

Thanks again johannes. i am using LAN8720A. I’ve added in “mbed_app.json” this and everything works fine.
{ "target_overrides": { "DEVEBOX_F407VG": { "stm32-emac.eth-phy-address": 1 } } }
But it’s interesting that same bord but with ARCH_MAX target config works fine without adding this.

the default for the ARCH_MAX is different.
The ARCH_MAX has the VE MCU, wich has 512 kB flash, the VG has 1 MB. Also some IO pins maybe different, so creating a custom target makes sense.
For small changes in the linker script, I have added a feature to replace the default by a custom linker script in Mbed-CE. This is simpler than creating a new custom target.
This also usefull for the F407, it has some 64 kB RAM that cannot be used with DMA and you want to use it for special purpose.