Thursday, July 3, 2014

Installing STM32CubeMX on Linux

STMicroelectronics has a nice little tool to plan out your pin mapping for their STM32 microcontrollers, called STM32CubeMX, but unfortunately they packaged it in to an .exe file. I first tried running the exe under wine but I was greeted with a message that it requires Java. I know a lot of these installers are really just executable zip files so I just ran unzip on it.
mkdir stm32cubemx
cd stm32cubemx
unzip ../SetupSTM32CubeMX-4.3.0.exe

Taking a look at "META-INF/MANIFEST.MF" you'll see it want's to run "com.izforge.izpack.installer.bootstrap.Installer" so I did that next.
java -cp . com.izforge.izpack.installer.bootstrap.Installer

Looking at the install directory we find another exe. Lets unzip again. This time in place (zip bomb, but that's ok).
cd <install location>
unzip STM32CubeMX.exe

Looking at "META-INF/MANIFEST.MF" we now see "com.st.microxplorer.maingui.IOConfigurator" so I ran that.
java -cp . com.st.microxplorer.maingui.IOConfigurator
Seems to work just fine.



26 comments:

  1. Which version of Java do you have installed? For me it doesn't work. It throws

    \home\christian\STMicroelectronics\STM32Cube\STM32CubeMX\\db\plugins\projectmanager\linux\64\toolgen.so
    \home\christian\STMicroelectronics\STM32Cube\STM32CubeMX\\db\plugins\projectmanager\linux\64\toolgen.so not found.

    which seems reasonable because there are no .so libraries.

    How does that work for you?


    Regards,
    Christian

    ReplyDelete
    Replies
    1. I'm running jdk 1.7.0_45, STM32CubeMX version 4.3.0.

      Does it not come up at all or does it fail when you do something in the program?

      Delete
    2. It does not come up at all. Here is the output:

      ~/STMicroelectronics/STM32Cube/STM32CubeMX$ java -cp . com.st.microxplorer.maingui.IOConfigurator

      HeapMemory: 235929600
      Using Application install path:/home/christian/STMicroelectronics/STM32Cube/STM32CubeMX
      Using Application install path:/home/christian/STMicroelectronics/STM32Cube/STM32CubeMX

      loadPluginJar : ipmanager

      loadPluginJar : add ipmanager

      loadPluginJar : projectmanager


      This is Unix or Linux

      This is 64 Bit VM

      \home\christian\STMicroelectronics\STM32Cube\STM32CubeMX\\db\plugins\projectmanager\linux\64\toolgen.so
      \home\christian\STMicroelectronics\STM32Cube\STM32CubeMX\\db\plugins\projectmanager\linux\64\toolgen.so not found.


      Check the installation of the application.

      Delete
    3. and furthermore:


      loadPluginJar : add projectmanager

      loadPluginJar : filemanager

      loadPluginJar : add filemanager

      loadPluginJar : pinoutconfig

      InternalPropertyChange: ChangeKeepUser dont care

      loadPluginJar : add pinoutconfig
      loadPluginJar : clock
      loadPluginJar : add clock
      loadPluginJar : power
      loadPluginJar : add power
      loadPluginJar : updater
      Using Application install path:/home/christian/STMicroelectronics/STM32Cube/STM32CubeMX
      Updater Check For Update Now.
      loadPluginJar : add updater
      PluginManage : ReOrganize retry [4x]
      End of CheckServer Thread
      setPackage(No Configuration,No Configuration)
      Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: javafx/scene/Node
      at com.st.microxplorer.plugins.clock.ClockConfigurationView.getUI(ClockConfigurationView.java:107)
      at com.st.microxplorer.maingui.MainPanel.registerView(MainPanel.java:653)
      at com.st.microxplorer.maingui.MainPanel.(MainPanel.java:144)
      at com.st.microxplorer.maingui.MainFrame.(MainFrame.java:96)
      at com.st.microxplorer.maingui.IOConfigurator$1.run(IOConfigurator.java:90)
      at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:312)
      at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:733)
      at java.awt.EventQueue.access$200(EventQueue.java:103)
      at java.awt.EventQueue$3.run(EventQueue.java:694)
      at java.awt.EventQueue$3.run(EventQueue.java:692)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
      at java.awt.EventQueue.dispatchEvent(EventQueue.java:703)
      at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
      at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
      at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
      at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
      Caused by: java.lang.ClassNotFoundException: javafx.scene.Node
      at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
      at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
      ... 19 more

      Delete
    4. This is the output I get https://gist.github.com/joeferner/510d59046d8ca38b0bb1 after that the UI pops up.

      Looking at the output I am getting the toolgen.so not found too, but it doesn't seem to affect anything.

      Looking at your output it looks like it's looking for a javafx class which should be included as of JDK 7u6 (see http://www.oracle.com/technetwork/java/javafx/downloads/index.html). Which Java version are you using?

      Delete
  2. Hey Joe,

    thanks for the hint. I was using OpenJDK and had no JFX installed. After installing the Oracle JRE, it starts but when I try to generate code it crashes while generating startup code.
    This is the output I get: https://gist.github.com/rizzir/072381b29a00aaa05bce .
    Anyway I can use it for the HAL and main skeleton. I'm hoping that ST will change it's policy and makes it's tools available for Linux as well. Also the linkerscript generated for the gcc is not usable with other IDEs but Atollic due to the license which is a no go for me as well.

    I've ordered two Freedom boards from Freescale and will have a look at these. All their tools come with native Linux support. The dev boards are a bit more expensive than the ones from ST but their chips are not. So for me it's definitely worth looking at.

    Anyway thanks for your help.

    ReplyDelete
  3. Everything seems to work fine until generating the sources.
    The progress dialog stops around 85% with a message saving project settings.
    I've ubuntu 14.04 and installed Oracle's java 8.

    Like to perform the same on windows later and compare what's different with the generated sources.

    These are the last messages I see on the console.

    [... many lines cut before]
    Time for Copy HAL[1] : 42mS.
    Exception in thread "Thread-41664" java.lang.UnsatisfiedLinkError: com.st.microxplorer.plugins.projectmanager.model.ToolchainGenerator.getStartUp()Ljava/lang/String;
    at com.st.microxplorer.plugins.projectmanager.model.ToolchainGenerator.getStartUp(Native Method)
    at com.st.microxplorer.plugins.projectmanager.model.ConfigFileManager.writeUsedFiles(ConfigFileManager.java:495)
    at com.st.microxplorer.plugins.projectmanager.engine.ProjectBuilder.createProject(ProjectBuilder.java:380)
    at com.st.microxplorer.plugins.projectmanager.engine.GenerateProjectThread.run(GenerateProjectThread.java:36)

    ReplyDelete
    Replies
    1. I found that following were not generated when running the tool under Linux:
      - all TrueSTUDIO project related files
      - startup_stm32f417xx.s

      Delete
  4. How use Cube with eclips or coocox?

    ReplyDelete
  5. Sorry if this is a double comment.
    I have tried with oracle java 7 and 8 (latest versions) and st cube v 4.6.0 and get similar errors to the above:
    http://pastebin.com/mfc2sJ4q (verbose)
    http://pastebin.com/CzPu69kB
    If this is solvable can you give me a hand, I do not understand how to fix from the error,
    OR
    can you post links to a java version and stm32cubemx that work together.
    I am on x86_64

    Cheers!

    ReplyDelete
  6. SOLVED!
    I had unzipped the java stuff into a separate folder!!! DOnt do that!
    Unzip the STM32CubeMX.exe in the path containing db (ie where it is originally!!!)
    And it was all a silly mistake where I did not do exactly as described.

    Looking at these logs:
    https://gist.github.com/rizzir/072381b29a00aaa05bce
    We can see that it is loading some libraries from:
    db\plugins\projectmanager\linux\64\toolgen.so
    So yea!
    Fantastic!

    ReplyDelete
  7. I can confirm it works with (at least) openjfx (8u20-b26-3) and STM32CubeMX v 4.6.0

    ReplyDelete
  8. Thank you very much for your post. It save me a lot of time...

    ReplyDelete
  9. Hey! FYI, you can use "java -jar SetupSTM32CubeMX-4.3.0.exe" instead as well as "java -jar STM32CubeMX.exe" to run it. No need to unzip it yourself - a .jar file is natively a .zip file under the hood anyways. It's just simpler to do this instead of actually unzipping it.

    ReplyDelete
    Replies
    1. OK but that seems to install it, but how do you run it?

      Delete
  10. I used STM32CubeMX version 4.6.0 on LinuxMint 17, 64bit. Everytjing is OK, but if I want configure GPIO pins (on tab Configurator, colun System->GPIO). Open GPIO dialog and select some pin, nothing happen and in console is error log:
    Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
    at com.st.microxplorer.plugins.ip.gpio.gui.ParameterUI.addPropertyChangeListener(ParameterUI.java:156)
    at javax.swing.plaf.synth.SynthPanelUI.installListeners(SynthPanelUI.java:83)
    at javax.swing.plaf.synth.SynthPanelUI.installUI(SynthPanelUI.java:63)
    at javax.swing.JComponent.setUI(JComponent.java:656)

    detailed log: http://pastebin.com/Fb5yM7zW

    Can somebody help?

    ReplyDelete
  11. I think I can try, as this bugged me for some time and today I needed to use this feature. For my system it seems to be related to GTK Look&Feel theme and it's quite common not only for CubeMX. The GPIO configurator can be used by decompiling ParameterUI.class from gpio.jar and modifying two methods to avoid exception when listener is added to to uninitialized class instance.


    --- com/st/microxplorer/plugins/ip/gpio/gui/ParameterUI.org.java 2015-03-17 18:37:33.755350200 +0100
    +++ com/st/microxplorer/plugins/ip/gpio/gui/ParameterUI.java 2015-03-17 17:49:21.125906827 +0100
    @@ -76,11 +76,17 @@

    public synchronized void addPropertyChangeListener(PropertyChangeListener listener)
    {
    + if (paramBoundSupport == null) {
    + paramBoundSupport = new PropertyChangeSupport (this);
    + }
    paramBoundSupport.addPropertyChangeListener(listener);
    }

    public synchronized void removePropertyChangeListener(PropertyChangeListener listener)
    {
    + if (paramBoundSupport == null) {
    + paramBoundSupport = new PropertyChangeSupport (this);
    + }
    paramBoundSupport.removePropertyChangeListener(listener);
    }


    Not sure it's 100% correct, but seems to works good enough for me ;)

    ReplyDelete
  12. Hello All,

    I have a problem with stm32cube version 4.7.0.

    Project Generator version: 2.6.1
    FileStreamsReadnWrite: java.io.FileNotFoundException: ~/STM32CubeMX/db/plugins/projectmanager\src\syscalls.c (No such file or directory)

    The tool only support window os. Therefore keyword "\" is used in path. Now I need change this keyword by "/". Please tell me a solution to fix this issue.

    Thank you so much (b)

    ReplyDelete
  13. Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: -1
    at java.util.ArrayList.elementData(ArrayList.java:418)
    at java.util.ArrayList.get(ArrayList.java:431)
    at javax.swing.JTabbedPane.getTitleAt(JTabbedPane.java:1112)
    at com.st.microxplorer.maingui.MainPanel.getSelectedPluginView(MainPanel.java:803)
    at com.st.microxplorer.maingui.MainPanel.adjustPlacement(MainPanel.java:564)
    at com.st.microxplorer.maingui.MainPanel.setOutputTabVisible(MainPanel.java:334)
    at com.st.microxplorer.maingui.MainPanel.initialization(MainPanel.java:179)
    at com.st.microxplorer.maingui.MainFrame.initialization(MainFrame.java:105)
    at com.st.microxplorer.maingui.IOConfigurator.run(IOConfigurator.java:124)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756)
    at java.awt.EventQueue.access$500(EventQueue.java:97)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.awt.EventQueue$3.run(EventQueue.java:703)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:726)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

    hi I keep getting these error messages when trying to run stmcubemx could anyone help please

    ReplyDelete
  14. did someone try this?
    ln -s STM32CubeMX.exe STM32CubeMX.jar
    java -jar STM32CubeMX.jar

    works fine here

    ReplyDelete
  15. Thank you sir! It works terrific on my Ubuntu 14 regularly updated Linux.

    With the "java -jar SetupSTM32CubeMX-4.3.0.exe" instead as well as "java -jar STM32CubeMX.exe" to run it as Tim Nordell further above advised.

    Lock the Unity launcher and you got yourself a CubeMX rolling on Linux. Now why didn't the guys at STM think of that. hmmm ...

    ReplyDelete
  16. Thank you so much!! This saved me a lot of trouble.

    To run the application, the command now looks like that:
    java -cp . com.st.microxplorer.maingui.STM32CubeMX

    ReplyDelete
  17. How to run on OpenJDK? I met an error:
    Please install Java 1.7 or latter first.

    ReplyDelete
  18. > How to run on OpenJDK?
    No way with STM32CubeMX 4.13.1 and seems all others. Here is my quetion and answer unix.stackexchange.com/questions/271119/how-to-emulate-oracle-java-with-openjdk

    ReplyDelete