There are two primary pieces of software you’ll need to program an STM32 microcontroller. The first is called “STM32CubeMX” and is provided by ST to make it simpler to configure all of the clocks and peripherals and pins on the chip. Even better, it can generate Makefiles and boilerplate .c and .h files for you, across a variety of IDEs. The second piece of software you’ll need is OpenSTM32, which is a free Eclipse-based IDE for writing and flashing programs for your STM32 chip.
Your system likely didn’t come with Java already installed. So, install java first:
sudo apt install default-jre
The next step is to download STM32CubeMX. You’re likely running a 64-bit version of Linux. Don’t be fooled and try to run the STM32CubeMX installer ending in “.linux”. If you try to run it you’ll see:
./SetupSTM32CubeMX-4.27.0.linux unable to execute ./SetupSTM32CubeMX-4.27.0.linux: No such file or directory
As suggested by this link you can run the .exe version instead:
java -jar SetupSTM32CubeMX-4.27.0.exe
Follow the instructions and install.
Unfortunately you need to sign up for an account at www.openstm32.org in order to download OpenSTM32. Once you’ve done so, run
After it’s installed, I needed to edit
--add-modules=java.se.ee right after
-vm-args to get it to run
successfully. Otherwise OpenSTM32 would crash after selecting a workspace.
The contents of that file for me now looks like this:
-pluginCustomization configuration/st_pref.ini -startup plugins/org.eclipse.equinox.launcher_1.3.201.v20161025-1711.jar --launcher.library plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.401.v20161122-1740 -product org.eclipse.epp.package.cpp.product --launcher.defaultAction openFile -showsplash fr.ac6.mcu.ide --launcher.defaultAction openFile --launcher.GTK_version 2 --launcher.appendVmargs -vmargs --add-modules=java.se.ee -Dosgi.requiredJavaVersion=1.8 -XX:+UseG1GC -XX:+UseStringDeduplication -Dosgi.requiredJavaVersion=1.8 -Xms256m -Xmx1024m