OpenOCD implements numerous ways to program the target flash, whether internal or external. Programming can be acheived by either using GDB Programming using GDB, or using the cmds given in Flash Programming Commands.
To simplify using the flash cmds directly a jimtcl script is available that handles the programming and verify stage. OpenOCD will program/verify/reset the target and shutdown.
The script is executed as follows and by default the following actions will be peformed.
flash write_imageis called to erase and write any flash using the filename given.
verify_imageis called if verify parameter is given.
reset runis called if reset parameter is given.
An example of usage is given below. See program.
# program and verify using elf/hex/s19. verify and reset # are optional parameters openocd -f board/stm32f3discovery.cfg \ -c "program filename.elf verify reset" # binary files need the flash address passing openocd -f board/stm32f3discovery.cfg \ -c "program filename.bin 0x08000000"