Getting started with MiniHIL development on linux

Motivation

On linux a few things have to be setup differently than on windows. This page gives a short overview over the necessary steps to get started.

Note Most of the other pages in this documentation are written with windows in mind. We trust the linux user to map the commands to linux where needed.

IDE and usb udev setup on linux

Install the IDE

You need a MiniHIL IDE release for linux.

Extract the IDE into a folder of your choice.

Before launching the IDE make sure to setup the udev rules needed for programming with the stlink debugger (see section below). You must also make sure that the stlink-server can be found by the IDE.

Warning Before starting the IDE and importing projects the project build configuration must be converted to linux (see project setup below).

To import projects into the IDE please use the "import existing projects into workspace" functionality as described here.

Setup build toolchain for debug launches in the IDE

Unfortunately, as of writing, the STM32 CubeIDE, which we use as a basis for the MiniHIL IDE, comes with a dated version of the arm-gcc toolchain which links to some old system libraries. To avoid conflicts we recommend to configure the IDE to use the toolchain provided in the minihil tools directory.

In the IDE open the preferences (Menu: Window → Preferences), search for "tool" and open the STM32 cube toolchain manager. Create a new toolchain pointing to the arm-gcc/bin subfolder of the minihil tools directory. Save the new toolchain and, before closing the preferences, set your new toolchain as default.

Toolchain manager: Add local + set default

Toolchain manager.

Add new toolchain

Add new toolchain.

There are two options to make the stlink-server available to the IDE: 1. Ensure that the stlink-server binary is on you PATH. The binary can be found in the IDEs root directory after extraction. 2. Install the stlink-server using the installer st-stlink-server.[version].install.sh which can also be found in the IDEs root directory. Note that the installation requires root access.

Setup udev rules

On linux udev rules are needed to allow non root users to access USB devices. We provide udev rules for the stlink debuggers as well as for the miniHIL usb interface as part of the tools release for linux. You can find a udev-rules directory in the tools directory for linux. You can either copy the rules manually or execute the install script which is also part of the udev-rules directory (the setup script requires root access).

Project setup on linux

Folder structure

You need: - A MiniHIL IDE release for linux - A MiniHIL external tools folder for linux - A normal template project (or your own MiniHIL project)

Select a folder you want your project to be setup in. In the chosen directory extract the tools parallel to the template project. We also suggest you extract the IDE in this folder, but that is not mandatory.

Your folder structure should then look similar to this:

ROOT
|-- tools
|   |-- arm-gcc
|   |-- openocd
|   |-- [...]
|-- miniHILIDE (optional)
|   |-- stm32cubeide
|   |-- [...]
|-- MiniHILTemplateProject
|   |-- MiniHilProject
|   |-- minihillib
|   |-- [...]

Initial build

To validate the project structure you should execute an initial build. Run the following command from within the MiniHILTemplateProject folder:

./gradlew clean assemble

# if you have successfully setup the udev rules
# (section above) you can also flash the miniHIL and
# execute the test cases from the commandline
./gradlew assemble flash runTests

# Additionally the GUI can be launched
./gradlew runGui

Converting the IDE project build configuration for linux

Please make sure you have setup your project correctly by executing the initial build (section above). Only if that build succeeds continue to convert your project for the linux IDE by executing this command from your MiniHILTemplateProject directory.

Note If you have already started the IDE and imported the projects, please close the IDE now and reopen it after the command has completed.
./gradlew switchBuildConfigurationToLinux

Afterwards the IDE can be opened and the build from within the IDE should succeed.

Converting the launch configuration to linux

After you have successfully imported the projects into the IDE you need to edit the launch configuration. You can access the configurations via the "Run" → "Debug configurations" menu.

Here you need to edit the executable path in the build-debug-ST-Link configuration: Change the back-slashes "\" to forward slashes "/".

Run config with forward slashes

Run config with forward slashes.

Starting the IDE

After the IDE has been setup correctly and the project has been converted to linux the IDE can be started using the stm32cubeide executable in the IDE folder.