Switch to cmake build system

* use tinyprintf
* ability to configure project via ccmake

Signed-off-by: Amir Hammad <amir.hammad@hotmail.com>
This commit is contained in:
Amir Hammad 2016-09-09 18:36:38 +02:00
parent 28ccd32608
commit ed70a1efa3
19 changed files with 1001 additions and 370 deletions

6
cmake/doc.cmake Normal file
View file

@ -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
)

18
cmake/openocd_flash.cmake Normal file
View file

@ -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)

15
cmake/toolchain.cmake Normal file
View file

@ -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})