-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Compiling and flashing the firmware
Right to the STM32, there is a debugging header with GND, 3V3, SWDIO and SWCLK. Connect GND, SWDIO and SWCLK to your SWD programmer, like the ST-Link found on many STM devboards.
If you have never flashed your sideboard before, the MCU is probably locked. To unlock the flash, check-out the wiki page How to Unlock MCU flash.
Do not power the mainboard from the 3.3V of your programmer! This has already killed multiple mainboards.
Make sure you hold the powerbutton or connect a jumper to the power button pins while flashing the firmware, as the STM might release the power latch and switches itself off during flashing. Battery > 36V have to be connected while flashing.
To build and flash choose one of the following methods:
- Install Vscode
- Install Platformio
- open the folder in Vscode
- press the 'PlatformIO:Build' or the 'PlatformIO:Upload' button (bottom left in vscode).
- in Keil uVision, open the mainboard-hack.uvproj
- if you are asked to install missing packages, click Yes
- click Build Target (or press F7) to build the firmware
- click Load Code (or press F8) to flash the firmware.
- prerequisites: install ST-Flash utility.
- open a terminal in the repo check-out folder and if you have definded the variant in config.h type:
make
or you can set the variant like this
make -e VARIANT=VARIANT_####
- flash the firmware by typing:
make flash
- or
openocd -f interface/stlink-v2.cfg -f target/stm32f1x.cfg -c flash "write_image erase build/hover.bin 0x8000000"
- prerequisites: first get brew https://brew.sh
- then install stlink ST-Flash utility
brew install stlink
- open a terminal in the repo check-out folder and if you have definded the variant in config.h type:
make
or you can set the variant like this
make -e VARIANT=VARIANT_####
If compiling fails because something is missing just install it with brew AND leave a comment to improve this howto or pull request ;-)
- flash the firmware by typing:
make flash
- if unlock is needed
make unlock
brew install platformio
platformio run -e VARIANT_####
platformio run –target upload -e VARIANT_####
If you have set default_envs in platformio.ini you can ommit -e parameter