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.