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 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 optionally shutdown.

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

  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. verify_image is called if verify parameter is given.
  5. reset run is called if reset parameter is given.
  6. 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"