- Install brew
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
- Install stlink and openocd and telnet
$ brew install openocd
$ brew install telnet
- Convert the hex file to binary using
arm-none-eabi-objcopy
(make sure the binary is in your $PATH)
$ arm-none-eabi-objcopy -I ihex --output-target=binary <path>/Achilleas_V_1_4_EACHINE.hex <path>/achilles.bin
- Run openocd
$ openocd -f openocd.cfg -f stm32f1x.cfg -c init
- Open another terminal and use telnet to connect to the debugger
$ telnet localhost 4444
- Make sure your module is connected
> targets
- Halt the module
> halt
- Unlock the flash (if needed)
> stm32f1x unlock 0
- Reset to apply the changes
> reset run
- Halt again
> halt
- Erase bank 0
> stm32f1x mass_erase 0
- Flash the binary
> flash write_bank 0 <absolute_path>/achilles.bin 0
- Reset the module
> reset run