diff options
author | Amir Hammad <amirhammad@users.noreply.github.com> | 2016-09-11 13:40:59 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-11 13:40:59 +0200 |
commit | 5e714edfa65f2f0d18fe9dc722ccd564a04e152a (patch) | |
tree | 5e310e07bdfb28e36d663ccdffbe65f78081187e /cmake | |
parent | 5615b9c938f6e4d05f7fae68b5329346df1238f9 (diff) | |
parent | b7167bf2aff1a7c9cf223dc2a1d2e401f599d5d8 (diff) | |
download | secure-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')
-rw-r--r-- | cmake/doc.cmake | 6 | ||||
-rw-r--r-- | cmake/openocd_flash.cmake | 18 | ||||
-rw-r--r-- | cmake/toolchain.cmake | 15 |
3 files changed, 39 insertions, 0 deletions
diff --git a/cmake/doc.cmake b/cmake/doc.cmake new file mode 100644 index 0000000..76336a8 --- /dev/null +++ b/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/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) diff --git a/cmake/toolchain.cmake b/cmake/toolchain.cmake new file mode 100644 index 0000000..b6e2af7 --- /dev/null +++ b/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_C_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}) + + |