cancel
Showing results for 
Search instead for 
Did you mean: 

How to install/use STM32CubeProgrammer on Debian Linux?

John Davis
Associate III

I was unable to run the setup program. I found this gist on how to do an install of

STM32CubeMX:

https://gist.github.com/Lanchon/2156953d18f7534a926b

Using that method I could run the installer via this method:

sudo java -jar SetupSTM32CubeProgrammer-2.8.0.exe

That enabled a nice dialog based install to /usr/local. However afterwards I am unable to run the programmer. It has a similar problem as the installer.

davis@twenty:/usr/local/STMicroelectronics/STM32Cube/STM32CubeProgrammer 
$ ls bin
ExternalLoader  libcrypto.so        libstp11_SAM.so.conf  STM32CubeProgrammer          STM32_Programmer_CLI            STM32WLScripts
FlashLoader     libcrypto.so.1.0.0  PersoPackages         STM32CubeProgrammerLauncher  STM32_Programmer.sh             version
HSM             libssl.so           platforms             STM32MP_KeyGen_CLI           STM32TrustedPackageCreator
jre             libstp11_SAM.so     RSSe                  STM32MP_SigningTool_CLI      STM32TrustedPackageCreator_CLI
davis@twenty:/usr/local/STMicroelectronics/STM32Cube/STM32CubeProgrammer 
$ ./bin/STM32CubeProgrammerLauncher 
./bin/STM32CubeProgrammerLauncher
/usr/local/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin
chdir /usr/local/STMicroelectronics/STM32Cube/STM32CubeProgrammer/./bin
current dir /usr/local/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin
<JAVA_HOME>/lib/ext exists, extensions mechanism no longer supported; Use -classpath instead.
.Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
davis@twenty:/usr/local/STMicroelectronics/STM32Cube/STM32CubeProgrammer

 Other bit on info

On this box I have the STM32CubeMX installed. If I compare the java jre's on this system I notice the one with STM32CubeProgrammer is different.

The CubeMX JRE

davis@twenty:/usr/local/STMicroelectronics/STM32Cube/STM32CubeMX/jre/bin 
$ ./java --version
openjdk 11.0.10 2021-01-19
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.10+9)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.10+9, mixed mode)
 

The default installed JRE

$ java --version
openjdk 11.0.12 2021-07-20
OpenJDK Runtime Environment (build 11.0.12+7-post-Debian-2)
OpenJDK 64-Bit Server VM (build 11.0.12+7-post-Debian-2, mixed mode, sharing)

The JRE for CubeProgrammer

davis@twenty:/usr/local/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin/jre/bin 
$ ./java --version
<JAVA_HOME>/lib/ext exists, extensions mechanism no longer supported; Use -classpath instead.
.Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

6 REPLIES 6
Houda GHABRI
ST Employee

Hi @Community member​ ,

To launch STM32CuneProgrammer you need to use the script launcher STM32CubeProgrammer instead of the STM32CubeProgrammerLauncher:

./bin/STM32CubeProgrammer

To avoid any java compatibility issue be sure please that you are using the JRE bundled in Cubeprogrammer , not the default one installed in you PC.

Please test and tell me if it is OK?

If your question is answered, please close this topic by choosing Select as Best. This will help other users find that answer faster.

Houda

John Davis
Associate III

It doesn't work. From the cube programmer directory, using your execution method results in:

davis@twenty:/usr/local/STMicroelectronics/STM32Cube/STM32CubeProgrammer 
$ ./bin/STM32CubeProgrammer
<JAVA_HOME>/lib/ext exists, extensions mechanism no longer supported; Use -classpath instead.
.Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

No JAVA based exports are in place

$ export | grep JAVA
davis@twenty:/usr/local/STMicroelectronics/STM32Cube/STM32CubeProgrammer 

In the original post, I noted that the jre included with the cube programmer application fails to run. See above or here:

davis@twenty:/usr/local/STMicroelectronics/STM32Cube/STM32CubeProgrammer 
$ ./bin/jre/bin/java --version
<JAVA_HOME>/lib/ext exists, extensions mechanism no longer supported; Use -classpath instead.
.Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit. 

John Davis
Associate III

FWIW, I installed the programmer software on a different pc. In that case, the installer program worked and afterwards the program itself worked. I haven't figured out exactly why it works or not yet. I tried to duplicate the setup and it fails.

Both laptops are debian bulleye release. On the laptop that worked, I downloaded three setup programs into the same directory. I unziped the cubemx, installed it. It left a jre subdirectory in unzip which was used during installation. Later it seems that the jre in the cubemx installation directory is the one which was unzipped in the install source directory.

I then did the same with the cubeIDE. It worked correctly.

Afterwards I unzipped the programmer software. It asked if I wanted to overwrite the jre files. I chose to do all overwrites. In this case it installed and worked.

On the problematic laptop, I did reinstalls and tried removing any leftover files. I could not get it to work. I was erasing files in /usr/local/STMicroelectronics/STM32Cube/STM32CubeProgrammer  and ~/.stmprogrammer

John Davis
Associate III

Hmm. I tried again on the problematic laptop.

Explicit steps taken.

Remove any existing installation files

$ rm -rf usr/local/STMicroelectronics/STM32Cube/STM32CubeProgrammer/

$ rm -rf ~/.STM32CubeProgrammer

Ensure clean install and unzip downloaded setup program

$ cd ~/Downloads

$ mkdir new_installs

$ cd new_installs

$ cp en.stm32cubeprg-lin_v2-8-0_v2.8.0.zip new_installs/.

$ unzip en.stm32cubeprg-lin_v2-8-0_v2.8.0.zip

This creates jre, SetupSTM32CubeProgrammer-2.8.0.exe and SetupSTM32CubeProgrammer-2.8.0.exe

Install program

$ sudo ./SetupSTM32CubeProgrammer-2.8.0.linux

Acknowledge that given /usr/local path is ok. ie. don't change anything.

Afterwards start program (Hey now it runs so that is positive)

$ /usr/local/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin/STM32CubeProgrammer

Program dialog does appear. The terminal does show some errors though

jar:file:/usr/local/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin/STM32CubeProgrammerLauncher!/fxml/Config.fxml

Error occurred while parsing external Loader list

An error occurred.

java.io.FileNotFoundException: /home/davis/Downloads/new_installs/version (No such file or directory)

at java.io.FileInputStream.open0(Native Method)

at java.io.FileInputStream.open(FileInputStream.java:195)

at java.io.FileInputStream.<init>(FileInputStream.java:138)

at java.util.Scanner.<init>(Scanner.java:611)

at com.st.updaterManager.Utility.getProgrammerVersion(Utility.java:178)

at com.st.updaterManager.Utility.setIniParameters(Utility.java:331)

at com.st.controllers.MainWindowController.initialize(MainWindowController.java:900)

at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2548)

at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2441)

at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3214)

at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3175)

at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3148)

at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3124)

at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3104)

at javafx.fxml.FXMLLoader.load(FXMLLoader.java:3097)

at com.st.app.Main.start(Main.java:52)

at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$8(LauncherImpl.java:769)

at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$7(PlatformImpl.java:326)

at com.sun.javafx.application.PlatformImpl.lambda$null$5(PlatformImpl.java:295)

at java.security.AccessController.doPrivileged(Native Method)

at com.sun.javafx.application.PlatformImpl.lambda$runLater$6(PlatformImpl.java:294)

at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)

at com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)

at com.sun.glass.ui.gtk.GtkApplication.lambda$null$10(GtkApplication.java:245)

at java.lang.Thread.run(Thread.java:748)

An error occurred.

java.io.FileNotFoundException: /home/davis/Downloads/new_installs/new/updater/version (No such file or directory)

at java.io.FileInputStream.open0(Native Method)

at java.io.FileInputStream.open(FileInputStream.java:195)

at java.io.FileInputStream.<init>(FileInputStream.java:138)

at java.util.Scanner.<init>(Scanner.java:611)

at com.st.updaterManager.Utility.getUpdaterVersion(Utility.java:199)

at com.st.updaterManager.Utility.setIniParameters(Utility.java:334)

at com.st.controllers.MainWindowController.initialize(MainWindowController.java:900)

at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2548)

at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2441)

at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3214)

at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3175)

at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3148)

at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3124)

at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3104)

at javafx.fxml.FXMLLoader.load(FXMLLoader.java:3097)

at com.st.app.Main.start(Main.java:52)

at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$8(LauncherImpl.java:769)

at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$7(PlatformImpl.java:326)

at com.sun.javafx.application.PlatformImpl.lambda$null$5(PlatformImpl.java:295)

at java.security.AccessController.doPrivileged(Native Method)

at com.sun.javafx.application.PlatformImpl.lambda$runLater$6(PlatformImpl.java:294)

at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)

at com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)

at com.sun.glass.ui.gtk.GtkApplication.lambda$null$10(GtkApplication.java:245)

at java.lang.Thread.run(Thread.java:748)

Hmm. It seems to be looking in the current directory and not the install directory. Hence the errors.

What happens if I execute from the install directory?

$ cd /usr/local/STMicroelectronics/STM32Cube 

$ sudo chown -R davis:davis STM32CubeProgrammer

$ cd STM32CubeProgrammer

$ ./bin/STM32CubeProgrammer

ar:file:/usr/local/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin/STM32CubeProgrammerLauncher!/fxml/Config.fxml

Error occurred while parsing external Loader list

An error occurred.

java.io.FileNotFoundException: /usr/local/STMicroelectronics/STM32Cube/STM32CubeProgrammer/version (No such file or directory)

at java.io.FileInputStream.open0(Native Method)

at java.io.FileInputStream.open(FileInputStream.java:195)

at java.io.FileInputStream.<init>(FileInputStream.java:138)

at java.util.Scanner.<init>(Scanner.java:611)

at com.st.updaterManager.Utility.getProgrammerVersion(Utility.java:178)

at com.st.updaterManager.Utility.setIniParameters(Utility.java:331)

at com.st.controllers.MainWindowController.initialize(MainWindowController.java:900)

at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2548)

at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2441)

at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3214)

at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3175)

at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3148)

at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3124)

at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3104)

at javafx.fxml.FXMLLoader.load(FXMLLoader.java:3097)

at com.st.app.Main.start(Main.java:52)

at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$8(LauncherImpl.java:769)

at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$7(PlatformImpl.java:326)

at com.sun.javafx.application.PlatformImpl.lambda$null$5(PlatformImpl.java:295)

at java.security.AccessController.doPrivileged(Native Method)

at com.sun.javafx.application.PlatformImpl.lambda$runLater$6(PlatformImpl.java:294)

at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)

at com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)

at com.sun.glass.ui.gtk.GtkApplication.lambda$null$10(GtkApplication.java:245)

at java.lang.Thread.run(Thread.java:748)

1.0.0

program does run though.

John Davis
Associate III

One last thing, if you run the java jvm in the install directory it gives

davis@twenty:/usr/local/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin/jre/bin 

$ ./java -version

openjdk version "1.8.0_265"

OpenJDK Runtime Environment (build 1.8.0_265-b01)

OpenJDK 64-Bit Server VM (build 25.265-b01, mixed mode)

This is different from the CubeMX

davis@twenty:/usr/local/STMicroelectronics/STM32Cube/STM32CubeMX/jre 

$ ./bin/java -version

openjdk version "11.0.10" 2021-01-19

OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.10+9)

OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.10+9, mixed mode)

Houda GHABRI
ST Employee

Hello @Community member​ ,

There are different JRE version bundled in CubeMX and CubeProgrammer.

However I think that the error is due to STM32CubeProgrammer script launcher format, it should be in unix format .

Can you please try to modify the launcher script using Dos2Unix command and tell me if issue is solved?

regards,

houda