STM32
Flashing:
With a USB to Serial converter:
With an STLink
Bear Metal
Install:
sudo apt-get install gcc-arm-none-eabi
Install stlink (flasher)
git clone https://github.com/texane/stlink
cd stlink
cmake .
make
cd bin
sudo cp st-* /usr/local/bin
sudo cp stlink/config/udev/rules.d/49-stlinkv* /etc/udev/rules.d/
Using:
$ arm-none-eabi-gcc -std=gnu99 -g -O2 -Wall -mlittle-endian -mthumb -mthumb-interwork -mcpu=cortex-m0 -fsingle-precision-constant -Wdouble-promotion main.c -o main.elf
$ arm-none-eabi-objcopy -O binary main.elf main.bin
$ st-flash --reset write main.bin 0x8000000
STM32CubeIDE: (Preferred)
ST Provide a very good IDE for configuring al peripherals, the clocks, and lots of middleware (USB/fatfs/etc...)
Arduino-cli:
Install:
Using arduino IDE (or arduino-cli) on a PC, you should use the boardmanager
http://dan.drown.org/stm32duino/package_STM32duino_index.json
Using arduino-cli on ARM (raspberry pi), their are no binaries in boardsmanager, follow the following instead
Using:
Serial link
$ arduino-cli compile -b stm32duino:STM32F1:genericSTM32F103C:upload_method=serialMethod ~/Arduino/MyScript
$ arduino-cli upload -p /dev/ttyUSB0 -b stm32duino:STM32F1:genericSTM32F103C:upload_method=serialMethod ~/Arduino/MyScript
or, an STLink
$ arduino-cli compile -b stm32duino:STM32F1:genericSTM32F103C:upload_method=STLinkMethod ~/Arduino/MyScript
$ arduino-cli upload -b stm32duino:STM32F1:genericSTM32F103C:upload_method=STLinkMethod ~/Arduino/MyScript