summaryrefslogtreecommitdiff
path: root/fw/cmake
diff options
context:
space:
mode:
authorjaseg <git@jaseg.de>2021-03-02 19:27:52 +0100
committerjaseg <git@jaseg.de>2021-03-02 19:27:52 +0100
commitb328ef60595523e3922aae994d7bbe06c7c3fa56 (patch)
treebdbbd1a4a0528d6f479f903fbd1f1c04476ec5fe /fw/cmake
parent6eddc61626d470363ba464c57a5fc5ec7e8ce329 (diff)
parent5b94dee9cfb1eaaf28510b843c60355663b660ea (diff)
downloadsecure-hid-b328ef60595523e3922aae994d7bbe06c7c3fa56.tar.gz
secure-hid-b328ef60595523e3922aae994d7bbe06c7c3fa56.tar.bz2
secure-hid-b328ef60595523e3922aae994d7bbe06c7c3fa56.zip
Add 'fw/' from commit '5b94dee9cfb1eaaf28510b843c60355663b660ea'
git-subtree-dir: fw git-subtree-mainline: 6eddc61626d470363ba464c57a5fc5ec7e8ce329 git-subtree-split: 5b94dee9cfb1eaaf28510b843c60355663b660ea
Diffstat (limited to 'fw/cmake')
-rw-r--r--fw/cmake/doc.cmake6
-rw-r--r--fw/cmake/openocd_flash.cmake18
-rw-r--r--fw/cmake/toolchain.cmake15
3 files changed, 39 insertions, 0 deletions
diff --git a/fw/cmake/doc.cmake b/fw/cmake/doc.cmake
new file mode 100644
index 0000000..76336a8
--- /dev/null
+++ b/fw/cmake/doc.cmake
@@ -0,0 +1,6 @@
+add_custom_target (doc
+ COMMAND doxygen
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+ COMMENT "output is generted in the ${CMAKE_SOURCE_DIR}/doc"
+ SOURCES Doxyfile
+)
diff --git a/fw/cmake/openocd_flash.cmake b/fw/cmake/openocd_flash.cmake
new file mode 100644
index 0000000..5c92c49
--- /dev/null
+++ b/fw/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)
diff --git a/fw/cmake/toolchain.cmake b/fw/cmake/toolchain.cmake
new file mode 100644
index 0000000..8522d7a
--- /dev/null
+++ b/fw/cmake/toolchain.cmake
@@ -0,0 +1,15 @@
+set (_CMAKE_TOOLCHAIN_PREFIX "arm-none-eabi-" CACHE STRING "toolchain prefix")
+set (_CMAKE_TOOLCHAIN_LOCATION "" CACHE STRING "toolchain location hint")
+
+set (CMAKE_SYSTEM_NAME Generic)
+set (CMAKE_C_COMPILER_WORKS 1)
+set (CMAKE_CXX_COMPILER_WORKS 1)
+set (CMAKE_C_FLAGS "")
+set (CMAKE_CXX_FLAGS "")
+set (BUILD_SHARED_LIBS OFF)
+find_program (CMAKE_C_COMPILER NAMES ${_CMAKE_TOOLCHAIN_PREFIX}gcc HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
+find_program (CMAKE_CXX_COMPILER NAMES ${_CMAKE_TOOLCHAIN_PREFIX}g++ HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
+find_program (CMAKE_OBJCOPY NAMES ${_CMAKE_TOOLCHAIN_PREFIX}objcopy HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
+find_program (CMAKE_SIZE NAMES ${_CMAKE_TOOLCHAIN_PREFIX}size HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
+
+