mLRS uses STM32CubeIDE for STM32 targets. The following procedure should work.
In case of issues with this procedure, don't hesitate to join the discussion thread at rcgroups or the discord channel.
Let's assume that the project should be located in the folder C:/Me/Documents/Github/mlrs
.
For the first step (step I) you need to have git and Python3 installed. Depending on the Python3 distribution you may need to install further libraries.
- open a command line processor
- cd into
C:/Me/Documents/Github
(not C:/Me/Documents/Github/mlrs !) git clone https://github.com/olliw42/mLRS.git mlrs
cd mlrs
- run
run_setup.py
. This does four steps: Initializes submodules (git submodule --init --recursive), copies ST HAL and LL drivers to the target folders, generates the MAVLink library files, and finally generates the DroneCAN library files.- Note: Ensure that all four steps are executed completely.
For cloning you of course can use any other tool you like.
- download and install STM32CubeIDE
- Note: Install into the default folder if possible.
- start STM32CubeIDE
- in Launcher select Workspace by hitting [Browse...] button, and browse to
C:/Me/Documents/Github/mlrs/mLRS
. Hit [Launch] button.- Note: It is not C:/Me/Documents/Github/mlrs but C:/Me/Documents/Github/mlrs/mLRS! If you proceed with the wrong path then there will be a compile error "undefined reference to main_main()"!
- in the IDE's top bar go to
File->Open Projects from File System
- in the Importer select Import source by hitting [Directory...] button, and browse to the desired project. E.g. select
C:/Me/Documents/Github/mlrs/mLRS/rx-diy-board01-f103cb
. Hit [Finish] button. - change from Debug to Release configuration: Go to the 'hammer' icon in the top icon bar, click on the down arrow right to it, and select
Release
.- Note: If you don't do that then there will be a compile error "undefined reference to main_main()"!
- open the file
mlrs-rx.cpp
ormlrs-tx.cpp
into the editor - compiling should work now: Go to the green 'right-pointing triangle' icon in the top icon bar and click it
- repeat steps 4. - 8. for each board you are interested in
The STM32CubeIDE has its weirdness, so you may have to get used to it.
Note: If you get a compiler error stating 'Must be gnu gcc 11 or lower!' then you will have to install the GCC 11 toolchain. Follow these steps:
- Within STM32CubeIDE go to Window > Preferences > STM32Cube > Toolchain Manager
- Wait for the process to fetch the list of toolchains.
- Note: This can take some time, be patient.
- Once the list has loaded, select 'GNU Tools for STM32 (11.3rel1)' then click 'Install'.
- Click Apply and Close, the toolchain will install.
- Note: This can take some time and there will be additional dialog boxes.
- Once the installation has finished, go back to the Toolchain Manager, following step 1.
- Select 'GNU Tools for STM32 (11.3rel1)' and click 'Set Default'.
- Note: At this point, you do not have to wait for the list of toolchains to load.
- Click Apply and Close.