Next: , Previous: , Up: Top   [Contents][Index]


13 Flash Programming

OpenOCD implements numerous ways to program the target flash, whether internal or external. Programming can be achieved by either using Programming using GDB, or using the commands given in Flash Programming Commands.


To simplify using the flash commands directly a jimtcl script is available that handles the programming and verify stage. OpenOCD will program/verify/reset the target and optionally shutdown.

The script is executed as follows and by default the following actions will be performed.

  1. ’init’ is executed.
  2. ’reset init’ is called to reset and halt the target, any ’reset init’ scripts are executed.
  3. flash write_image is called to erase and write any flash using the filename given.
  4. If the preverify parameter is given, the target is "verified" first and only flashed if this fails.
  5. verify_image is called if verify parameter is given.
  6. reset run is called if reset parameter is given.
  7. OpenOCD is shutdown if exit 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 exit"

# binary files need the flash address passing
openocd -f board/stm32f3discovery.cfg \
	-c "program filename.bin exit 0x08000000"