-
Notifications
You must be signed in to change notification settings - Fork 1
Home
You can either use Ubuntu's apt
package manager to get a (slightly outdated) ARM toolchain, or grab the latest toolcahin from https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloads.
Download the toolchain, bunzip/untar, move to a sane location (/opt/
) and edit your path:
$ tar jxvf gcc-arm-none-eabi-8-2018-q4-major.tar.bz2
$ sudo mv gcc-arm-none-eabi-8-2018-q4-major /opt/
$ echo 'export PATH="/opt/gcc-arm-none-eabi-8-2018-q4-major/bin:$PATH"' >> ~/.bashrc
The thing to note is that there is a gdb with python support (gcc-arm-none-eabi-gdb-py
) which is required for QtCreator debugging.
Install openocd
: sudo apt install openocd
. (I got v0.9.0 in June 2019).
To start the debugger (using an st-link-v2):
$ openocd -f /usr/share/openocd/scripts/interface/stlink-v2.cfg -f /usr/share/openocd/scripts/target/stm32f4x.cfg
I've noticed that with the onboard debugger on the F3 Discovery board, I have to use
$ openocd -f /usr/share/openocd/scripts/interface/stlink-v2-1.cfg -f /usr/share/openocd/scripts/target/stm32f3x.cfg
udev
rules:
# /etc/udev/rules.d/99-stlink.rules
# https://gctechspace.org/2014/09/getting-to-blinky-with-the-stm32-and-ubuntu-linux/
ATTRS{idVendor}=="0483", ATTRS{idProduct}=="3748", MODE="0666"
# /etc/udev/rules.d/45-stdfu-permissions.rules
# DFU (Internal bootloader for STM32 MCUs)
ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="df11", MODE="0664", GROUP="plugdev"
ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="5740", MODE="0664", GROUP="plugdev"
- Download the latest
qtcreator
from the official mirror (tested with 4.9.1) - Install to
/opt/qtcreator-4.9.1
:$ chmod +x qt-creator-opensource-linux-x86_64-4.9.1.run $ sudo ./qt-creator-opensource-linux-x86_64-4.9.1.run
- Skip login
- Dark theme
- Tools > Options > Environment > Theme > Flat Dark
(see also, http://www.iwasz.pl/electronics/stm32-on-ubuntu-linux-step-by-step/)
- Help > Plugins > DeviceSupport > BareMetal > check box for load
- Help > Plugins > Version Control > disable (prevents annoying popups when opening existing projects)
Restart
- Tools > Options > Devices > Bare Metal > Add,OpenOCD. Defaults are good.
Apply
- Tools > Options > Devices > Devices > Add,Bare Metal Device. Name STM32. OpenOCD GDB server provider.
Apply
- Tools > Options > Kits > Compilers > Add (add to path, see here)
- Tools > Options > Kits > Debuggers > Add (rename
arm-gdb
, choose path to be wherearm-none-eabi-gdb-py
is. empty working dir is okay) - Tools > Options > Kits > Add. (set name, device type, GCC/G++, GDB, QtVer:None, remove qt stuff from CMake Config)
(see also, http://docs.rosflight.org/en/latest/developer-guide/debugging/)
- File > New .. Project > Import Project > Import Existing Project (select root dir of
airdamon_f3
; select entire source tree) - Projects (sidebar) > Disable
Desktop
kit to prevent confusion. - Projects (sidebar) > Build Settings > change build dir to wherever your Makefile is. Expand build steps details and uncheck
all
target (unless you need it) - Projects (sidebar) > Run > Change 'run configuration' to STM32. Select the
*.elf
file for the project and set the working directory to the build dir (you may need to run make in the terminal for these to appear).