fisr draft of cmake buidl system. Update generation still missing
This commit is contained in:
parent
e50ce0d541
commit
289f49204d
73
stm-firmware/CMakeLists.txt
Normal file
73
stm-firmware/CMakeLists.txt
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
set(CMAKE_SYSTEM_NAME Generic)
|
||||||
|
set(CMAKE_SYSTEM_PROCESSOR arm)
|
||||||
|
set(CMAKE_CROSSCOMPILING 1)
|
||||||
|
cmake_minimum_required(VERSION 3.0)
|
||||||
|
|
||||||
|
set(CMAKE_TOOLCHAIN_FILE "arm-none-eabi-gcc.cmake")
|
||||||
|
|
||||||
|
project(reflow-controller)
|
||||||
|
|
||||||
|
if(NOT WIN32)
|
||||||
|
string(ASCII 27 Esc)
|
||||||
|
set(ColorReset "${Esc}[m")
|
||||||
|
set(ColorBold "${Esc}[1m")
|
||||||
|
set(Red "${Esc}[31m")
|
||||||
|
set(Green "${Esc}[32m")
|
||||||
|
set(Yellow "${Esc}[33m")
|
||||||
|
set(Blue "${Esc}[34m")
|
||||||
|
set(Magenta "${Esc}[35m")
|
||||||
|
set(Cyan "${Esc}[36m")
|
||||||
|
set(White "${Esc}[37m")
|
||||||
|
set(BoldRed "${Esc}[1;31m")
|
||||||
|
set(BoldGreen "${Esc}[1;32m")
|
||||||
|
set(BoldYellow "${Esc}[1;33m")
|
||||||
|
set(BoldBlue "${Esc}[1;34m")
|
||||||
|
set(BoldMagenta "${Esc}[1;35m")
|
||||||
|
set(BoldCyan "${Esc}[1;36m")
|
||||||
|
set(BoldWhite "${Esc}[1;37m")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(ELFFILE ${PROJECT_NAME}.elf)
|
||||||
|
set(LINKER_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/stm32f407vet6_flash.ld)
|
||||||
|
|
||||||
|
add_compile_options(-Wall -Wextra -Wold-style-declaration -Wuninitialized -Wmaybe-uninitialized -Wunused-parameter)
|
||||||
|
add_compile_options(-mlittle-endian -mthumb -mcpu=cortex-m4 -mthumb-interwork -mfloat-abi=hard -mfpu=fpv4-sp-d16 -nostartfiles -Wimplicit-fallthrough=3 -Wsign-compare)
|
||||||
|
|
||||||
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
|
||||||
|
|
||||||
|
add_definitions(-DBASE64_LOOKUP_TABLE_SECTION=\".ccm.bss\" -DSHELLMATTA_HELP_ALIAS=\"?\" -DSTM32F407xx -DSTM32F4XX -DARM_MATH_CM4 -DHSE_VALUE=8000000UL)
|
||||||
|
|
||||||
|
|
||||||
|
add_subdirectory(base64-lib)
|
||||||
|
|
||||||
|
|
||||||
|
IF(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||||
|
add_definitions(-DDEBUGBUILD)
|
||||||
|
add_compile_options(-O0 -g)
|
||||||
|
ELSE()
|
||||||
|
add_definitions(-DDEBUGBUILD)
|
||||||
|
add_compile_options(-O3 -g)
|
||||||
|
add_link_options(-Wl,--gc-sections)
|
||||||
|
ENDIF(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||||
|
|
||||||
|
aux_source_directory("." MAIN_SOURCES)
|
||||||
|
aux_source_directory("config-parser" CFG_PARSER_SRCS)
|
||||||
|
aux_source_directory("ui" UI_SRCS)
|
||||||
|
aux_source_directory("fatfs" FAT_SRCS)
|
||||||
|
aux_source_directory("fatfs/shimatta_sdio_driver" SDIO_SRCS)
|
||||||
|
aux_source_directory("boot" BOOT_SRCS)
|
||||||
|
aux_source_directory("setup" SETUP_SRCS)
|
||||||
|
aux_source_directory("stm-periph" STM_PERIPH_SRCS)
|
||||||
|
aux_source_directory("settings" SETTINGS_SRCS)
|
||||||
|
aux_source_directory("safety" SAFETY_SRCS)
|
||||||
|
aux_source_directory("shellmatta/src" SHELLMATTA_SRCS)
|
||||||
|
aux_source_directory("updater" UPDATER_SRCS)
|
||||||
|
|
||||||
|
add_executable(${ELFFILE} ${MAIN_SOURCES} ${CFG_PARSER_SRCS} ${UI_SRCS}
|
||||||
|
${FAT_SRCS} ${SDIO_SRCS} ${BOOT_SRCS} ${SETUP_SRCS}
|
||||||
|
${STM_PERIPH_SRCS} ${SETTINGS_SRCS} ${SAFETY_SRCS} ${SHELLMATTA_SRCS} ${UPDATER_SRCS})
|
||||||
|
|
||||||
|
target_include_directories(${ELFFILE} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/shellmatta/api ${CMAKE_CURRENT_SOURCE_DIR}/config-parser/include)
|
||||||
|
target_link_options(${ELFFILE} PRIVATE -mlittle-endian -mthumb -mcpu=cortex-m4 -mthumb-interwork -mfloat-abi=hard -mfpu=fpv4-sp-d16 --disable-newlib-supplied-syscalls -nostartfiles -T${LINKER_SCRIPT} -Wl,--print-memory-usage)
|
||||||
|
target_link_libraries(${ELFFILE} base64-lib)
|
||||||
|
|
28
stm-firmware/arm-none-eabi-gcc.cmake
Normal file
28
stm-firmware/arm-none-eabi-gcc.cmake
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
if(MINGW OR CYGWIN OR WIN32)
|
||||||
|
set(UTIL_SEARCH_CMD where)
|
||||||
|
elseif(UNIX OR APPLE)
|
||||||
|
set(UTIL_SEARCH_CMD which)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(TOOLCHAIN_PREFIX arm-none-eabi-)
|
||||||
|
|
||||||
|
execute_process(
|
||||||
|
COMMAND ${UTIL_SEARCH_CMD} ${TOOLCHAIN_PREFIX}gcc
|
||||||
|
OUTPUT_VARIABLE BINUTILS_PATH
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
|
)
|
||||||
|
|
||||||
|
get_filename_component(ARM_TOOLCHAIN_DIR ${BINUTILS_PATH} DIRECTORY)
|
||||||
|
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
|
||||||
|
|
||||||
|
set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}gcc)
|
||||||
|
set(CMAKE_ASM_COMPILER ${CMAKE_C_COMPILER})
|
||||||
|
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}g++)
|
||||||
|
|
||||||
|
set(CMAKE_OBJCOPY ${ARM_TOOLCHAIN_DIR}/${TOOLCHAIN_PREFIX}objcopy CACHE INTERNAL "objcopy tool")
|
||||||
|
set(CMAKE_SIZE_UTIL ${ARM_TOOLCHAIN_DIR}/${TOOLCHAIN_PREFIX}size CACHE INTERNAL "size tool")
|
||||||
|
|
||||||
|
set(CMAKE_FIND_ROOT_PATH ${BINUTILS_PATH})
|
||||||
|
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||||
|
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||||
|
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
Loading…
Reference in New Issue
Block a user