STM32
STM32 programming
Boot mode configuration
<syntaxhighlight lang="bash"> BOOT0 BOOT1 Boot mode Address
x 0 Main Flash memory 0x8000000 0 1 System memory (built-in bootloader) 0x1FFFB000 1 1 Embedded SRAM 0x20000000
in Main flash memory and System memory boot modes address is aliased to 0x0
</syntaxhighlight>
Legend
<syntaxhighlight lang="R"> o o o BOOT1 o o o BOOT0 --- </syntaxhighlight>
Boot to bootloader
<syntaxhighlight lang=" --- ">R</syntaxhighlight>
Boot to main flash
<syntaxhighlight lang=" --- ">R</syntaxhighlight>
Flashing
- Flashing is done via USART1 (A9 TX A10 RX)
Converting Elf to Bin
Required if you only have elf files produced by your toolchain - stm32flash accepts only *.bin files.
<syntaxhighlight lang="bash"> arm-none-eabi-objcopy -O binary miniblink.elf miniblink.bin </syntaxhighlight>
Using stm32flash
Test connection with
<syntaxhighlight lang="bash"> stm32flash /dev/ttyUSB0 </syntaxhighlight>
Flash and run from 0x0
<syntaxhighlight lang="bash"> stm32flash /dev/ttyUSB0 -w miniblink.bin -g 0x0 </syntaxhighlight>