cancel
Showing results for 
Search instead for 
Did you mean: 

Trying to get a DHCP to work in anSTM32CubeIDE project – strange error

EThom.3
Associate III

Hi,

Backgorund: I am struggling with getting DHCP to work through a W5500 ethernet controller, and have been searching for working examples with limited luck. The SPI connection works fine, and my router can (usually) see the W5500, including the MAC address. DHCP works, at least partially, because my device gets an IP address from the router. However, I cannot connect to the controller from a piece of software. (I get network error 10060)

So – I have been spending some days trying to find a working DHCP example, so I might be able to figure out what I am doing wrong. And I just thought that I found one. A complete CubeIDE project for an STM32F103 by @SGatt.1, designed for a W5500. Thanks.

However, when I try to build it, I get weird errors from the... linker?

 

e:\program files\stm32cubeide_1.12.1\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.200.202301161003\tools\arm-none-eabi\bin\ld.exe: e:/program files/stm32cubeide_1.12.1/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.200.202301161003/tools/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/lib/thumb/v7-m/nofp\libc_nano.a(lib_a-abort.o): in function `abort':
abort.c:(.text.abort+0xa): undefined reference to `_exit'

 

This goes on with nine more similar "complaints" about missing stuff.

When doing a search, I find no 'abort.c' file, no 'abort' function and no reference to '_exit' in the project. Can someone see what is going on here?

And – if anyone has a working W5500 project for STM32CubeIDE, I would be thrilled.

1 ACCEPTED SOLUTION

Accepted Solutions
Peter BENSCH
ST Employee

Well, I saw your installation path with a space, plus some unexpected errors from not finding functions, which immediately brought to mind my own problems of a similar nature. The nasty thing is that in such cases, errors do not occur immediately, but only when particularly deep paths within the GNU GCC have to be used. With Linux the situation looks much more relaxed, but with Windows a path like C:\ST is indeed the most sensible.

In your case, however, the problem is that the C++ project was created with a much older setup of STM32CubeIDE and has to do with newlib. There are now several solutions to avoid these errors, one of which is to manually add the following group somewhere in the linker file (the *.ld file shown on the left in Project Explorer), e.g. at its very end:

GROUP ( libnosys.a )

Hope that helps?

Regards
/Peter

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

View solution in original post

8 REPLIES 8
Peter BENSCH
ST Employee

You should not install STM32CubeIDE in "e:\program files\", but in a path as short as possible without any spaces.

Regards
/Peter

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Hello Peter,

Do you think that this is the cause of the problem? It hasn't given me trouble before.

Or is your comment simply a "please keep in mind that..."?

Br, Erik

Uninstalling and reinstalling in a new location did not make a difference.

e:\st\stm32cubeide_1.12.1\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.200.202301161003\tools\arm-none-eabi\bin\ld.exe: e:/st/stm32cubeide_1.12.1/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.200.202301161003/tools/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/lib/thumb/v7-m/nofp\libc_nano.a(lib_a-abort.o): in function `abort':
abort.c:(.text.abort+0xa): undefined reference to `_exit'

 

EThom.3
Associate III

Never mind. I managed to get my original code to work.

If anyone should be interested, I can make a working W5500 DHCP example project that can be loaded directly into CubeIDE.

Peter BENSCH
ST Employee

Well, I saw your installation path with a space, plus some unexpected errors from not finding functions, which immediately brought to mind my own problems of a similar nature. The nasty thing is that in such cases, errors do not occur immediately, but only when particularly deep paths within the GNU GCC have to be used. With Linux the situation looks much more relaxed, but with Windows a path like C:\ST is indeed the most sensible.

In your case, however, the problem is that the C++ project was created with a much older setup of STM32CubeIDE and has to do with newlib. There are now several solutions to avoid these errors, one of which is to manually add the following group somewhere in the linker file (the *.ld file shown on the left in Project Explorer), e.g. at its very end:

GROUP ( libnosys.a )

Hope that helps?

Regards
/Peter

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
Peter BENSCH
ST Employee

Great to hear it works!

If the problem is solved, please mark this thread as answered by selecting Accept as Solution, as also explained here. This will help other users find that answer faster.

Regards
/Peter

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
EThom.3
Associate III

Thanks Peter.

Hi, 

seems I have the same issue: by trying to migrate my project from CubeIDE Ver 1.12.1 to Ver 1.16.0 I also face with some complaints about undefined references to some stuff. I've been checking settings/linker, but cannot find out, what's missing.

-mcpu=cortex-m4 -T"*:\*\STM32L496QGIX_FLASH.ld" --specs=nosys.specs -Wl,-Map="${BuildArtifactFileBaseName}.map" -Wl,--gc-sections -static -L"*:\*\Middlewares\ST\touchgfx\lib\core\cortex_m4f\gcc" --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -u _printf_float -Wl,--start-group -lc -lm -lstdc++ -lsupc++ -Wl,--end-group -l:libtouchgfx-float-abi-hard.a  

 

Do I overlook smth?