简体   繁体   中英

How to flash stm32 using only Linux terminal?

So, threre are Archlinux distro, stm32 mc, and C code. How to flash stm32, without some IDE, only using console?

With Texane stlink

  1. Install as described in the README
  2. Convert your firmware to .bin if necessary
    arm-none-eabi-objcopy -O binary firmware.elf firmware.bin
  3. /opt/stlink/st-flash write firmware.bin 0x8000000

With OpenOCD , if your board is not supported by Texane

  1. Get it from the link above and install (ignore the eclipse-specific parts)
  2. Find your board description file in openocd/scripts/board , create one if necessary.
  3. openocd -d0 -f board/yourboard.cfg -c "init;targets;halt;flash write_image erase firmware.hex;shutdown"

If you have USB to UART adapter, you can use stm32flash . Basically connect USART1 to the adapter, pull BOOT0 to high (there might be a jumper or button on the board) and power up / reset the board. Then you should be able to follow stm32flash -h to see what to do.

Some STM32 (eg STM32F042 ) has USB DFU bootloader built in, so you can also connect the MCU to USB directly and use dfu-utils .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM