From 50a2966913d3474d940c6377cae350a1e7dcc04f Mon Sep 17 00:00:00 2001 From: Nicholas Graumann Date: Sun, 9 Oct 2016 18:47:53 -0500 Subject: [PATCH] stmhal: Add OpenOCD configuration for STM32L4. --- stmhal/boards/openocd_stm32l4.cfg | 42 +++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 stmhal/boards/openocd_stm32l4.cfg diff --git a/stmhal/boards/openocd_stm32l4.cfg b/stmhal/boards/openocd_stm32l4.cfg new file mode 100644 index 0000000000..3608b334b2 --- /dev/null +++ b/stmhal/boards/openocd_stm32l4.cfg @@ -0,0 +1,42 @@ +# This script configures OpenOCD for use with an ST-Link V2 programmer/debugger +# and an STM32L4 target microcontroller. +# +# To flash your firmware: +# +# $ openocd -f openocd_stm32l4.cfg \ +# -c "stm_flash build-BOARD/firmware0.bin build-BOARD/firmware1.bin" +# +# For a gdb server on port 3333: +# +# $ openocd -f openocd_stm32l4.cfg + + +source [find interface/stlink-v2-1.cfg] +transport select hla_swd +source [find target/stm32l4x.cfg] +reset_config srst_only +init + +proc stm_flash { BIN0 BIN1 } { + reset halt + sleep 100 + wait_halt 2 + flash write_image erase $BIN0 0x08000000 + sleep 100 + verify_image $BIN0 0x08000000 + sleep 100 + flash write_image erase $BIN1 0x08004000 + sleep 100 + verify_image $BIN1 0x08004000 + sleep 100 + reset run + shutdown +} + +proc stm_erase {} { + reset halt + sleep 100 + stm32l4x mass_erase 0 + sleep 100 + shutdown +}