summaryrefslogtreecommitdiff
path: root/cmake/openocd_flash.cmake
diff options
context:
space:
mode:
authorAmir Hammad <amirhammad@users.noreply.github.com>2016-09-11 13:40:59 +0200
committerGitHub <noreply@github.com>2016-09-11 13:40:59 +0200
commit5e714edfa65f2f0d18fe9dc722ccd564a04e152a (patch)
tree5e310e07bdfb28e36d663ccdffbe65f78081187e /cmake/openocd_flash.cmake
parent5615b9c938f6e4d05f7fae68b5329346df1238f9 (diff)
parentb7167bf2aff1a7c9cf223dc2a1d2e401f599d5d8 (diff)
downloadsecure-hid-5e714edfa65f2f0d18fe9dc722ccd564a04e152a.tar.gz
secure-hid-5e714edfa65f2f0d18fe9dc722ccd564a04e152a.tar.bz2
secure-hid-5e714edfa65f2f0d18fe9dc722ccd564a04e152a.zip
Merge pull request #4 from amirhammad/core-refactor
Major rework
Diffstat (limited to 'cmake/openocd_flash.cmake')
-rw-r--r--cmake/openocd_flash.cmake18
1 files changed, 18 insertions, 0 deletions
diff --git a/cmake/openocd_flash.cmake b/cmake/openocd_flash.cmake
new file mode 100644
index 0000000..5c92c49
--- /dev/null
+++ b/cmake/openocd_flash.cmake
@@ -0,0 +1,18 @@
+find_program (OOCD openocd DOC "openocd executable")
+
+set (OOCD_INTERFACE stlink-v2 CACHE STRING "interface config file used for openocd flashing")
+set (OOCD_BOARD stm32f4discovery CACHE STRING "board config file used for openocd flashing")
+if (OOCD)
+ message (STATUS "OpenOCD found: ${OOCD}")
+ message (STATUS "... interface: ${OOCD_INTERFACE}")
+ message (STATUS "... board: ${OOCD_BOARD}")
+ add_custom_target (flash
+ COMMAND sh -c '${OOCD} -f interface/${OOCD_INTERFACE}.cfg
+ -f board/${OOCD_BOARD}.cfg
+ -c "init" -c "reset init"
+ -c "flash write_image erase $<TARGET_FILE:demo>"
+ -c "reset"
+ -c "shutdown" '
+ DEPENDS demo
+ )
+endif (OOCD)