cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeMX does not generate *.ld files when SW4STM32 is selected as Toolchain/IDE

anonymous.8
Senior II

I am on macOS 10.13.6 High Sierra. I own a NUCLEO-F446RE board.

I am trying to build a simple test project with SystemWorkbench, i.e. SW4STM32.

I open STM32CubeMX, I select my NUCLEO board, I select SW4STM32 as Toolchain/IDE, I press "generate code" and in the project folder there are no *.ld files, that is why when I try to build in SystemWorkbench app i get this error:

Building target: 00test.elf
Invoking: MCU GCC Linker
arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -mfloat-abi=soft -specs=nosys.specs -specs=nano.specs -T"../" -Wl,-Map=output.map -Wl,--gc-sections -o "00test.elf" @"objects.list" -lm
/Applications/Ac6/SystemWorkbench.app/Contents/Eclipse/plugins/fr.ac6.mcu.externaltools.arm-none.macos64_1.17.0.201812190825/tools/compiler/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/bin/ld: read in flex scanner failed
collect2: error: ld returned 1 exit status
make: *** [00test.elf] Error 1

Instead if I choose STM32CubeIDE as Toolchain/IDE both "STM32F446RETX_FLASH.ld" and "STM32F446RETX_RAM.ld" files are generated and I can build and run without problems.

Info:

STM32CubeMX version 5.6.0

8 REPLIES 8
Khouloud ZEMMELI
ST Employee

​Hello @Community member​ 

This will be internally checked,

Best Regards,

Khouloud

Cartu38 OpenDev
Lead II

Rely on STM32CubeIDE then ... :-). I'm kidding but SW4STM32 is almost deprecated now ... Even more if luckily you're starting a brand new project.

iidio.1
Associate

in fact ,I tested f0 serial and f1serial ,it worked well on windows10 ,but when use linux,neither with root nor other users can generate .ld file for gcc base ides(i test sw4stm32 and truestudio) , the same .ioc file well generate all file when i back to windows10,so you can try on windows

Hi,

any results so far? I am having this problem, too. (With the new 5.6.1 Version of CubeMX, and on Kubuntu Linux 19.10; openjdk 14)

Update: I found the problem, see my answer below.

AVett.1
Associate

Hi,

I kept trying and found a solution to the problem myself:

I was having the issue with CubeMX V5.6.1, V5.5.0 and V4.27.0 on a Kubuntu Linux 19.10 with OpenJDK 14

Switching to OpenJDK 8 fixed the Issue for me.

I don't know about MacOS but for the Linux users finding this post you can fix the issue by running

sudo apt install openjdk-8-jre

And then using

sudo update-alternatives --config java

to switch the default Java version to 8.

To the ST developers: You could let the installer check the Java version and abort the installation or show a warning if a bad/untested Java version is detected.

Kind regards,

Andreas Vetter

Khouloud ZEMMELI
ST Employee

​@Community member​  Could you please share your ioc file?

I need to know the MX version ? Are you UnderRoot ? The app structure (Basic/advanced) ?

Thanks

Hi @Khouloud ZEMMELI​ , this issue seems to be back in STM32Cube v6.1.0, STM32H7 v1.8.0.

I have tried to generate with openJDK 15.0.0, and 15.0.1 on Linux: both show the problem of no loader script being generated.

I have attempted with options:

SW4STM32

STM32CubeIDE

TrueSTUDIO

Makefile

Other Toolchains (GPDSC)

Had the same linker issue (non-existing *.ld script) on my Manjaro 20.2. but your fix (change the java version to 8) resolved it. Thanks a lot =)

P.S.

Link to the guide for switching Java versions on Manjaro (Arch) distros: https://wiki.archlinux.org/index.php/Java