2021-03-21 22:38:22 +01:00
|
|
|
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()
|
|
|
|
|
2021-03-23 22:15:11 +01:00
|
|
|
execute_process(COMMAND bash -c "echo -n $(git describe --always --tags --dirty)"
|
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
|
|
OUTPUT_VARIABLE GIT_DESCRIBE)
|
|
|
|
|
2021-03-21 22:38:22 +01:00
|
|
|
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)
|
|
|
|
|
|
|
|
|
2021-03-23 22:15:11 +01:00
|
|
|
set(GIT_DESCRIBE "${GIT_DESCRIBE}")
|
|
|
|
add_definitions(-DBASE64_LOOKUP_TABLE_SECTION=\".ccm.bss\" -DSHELLMATTA_HELP_ALIAS=\"?\" -DGIT_VER=${GIT_DESCRIBE} -DHSE_VALUE=8000000UL -DSTM32F407xx -DSTM32F4XX -DARM_MATH_CM4)
|
2021-03-21 22:38:22 +01:00
|
|
|
|
2021-03-23 22:15:11 +01:00
|
|
|
add_subdirectory(updater/ram-code)
|
2021-03-21 22:38:22 +01:00
|
|
|
|
2021-03-23 22:15:11 +01:00
|
|
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
|
2021-03-21 22:38:22 +01:00
|
|
|
|
2021-03-23 22:15:11 +01:00
|
|
|
message("${BoldGreen}Version: ${GIT_DESCRIBE}${ColorReset}")
|
2021-03-21 22:38:22 +01:00
|
|
|
|
|
|
|
IF(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|
|
|
add_definitions(-DDEBUGBUILD)
|
2021-04-06 19:25:25 +02:00
|
|
|
add_compile_options(-Og -g)
|
2021-03-21 22:38:22 +01:00
|
|
|
ELSE()
|
|
|
|
add_compile_options(-O3 -g)
|
|
|
|
add_link_options(-Wl,--gc-sections)
|
|
|
|
ENDIF(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|
|
|
|
2021-04-06 19:25:25 +02:00
|
|
|
|
2021-04-10 13:45:00 +02:00
|
|
|
if (DEFINED ENV{UART_ON_DEBUG_HEADER})
|
2021-04-06 19:25:25 +02:00
|
|
|
add_definitions(-DUART_ON_DEBUG_HEADER)
|
2021-04-10 13:45:00 +02:00
|
|
|
message("UART forced to debug header")
|
|
|
|
endif (DEFINED ENV{UART_ON_DEBUG_HEADER})
|
2021-04-06 19:25:25 +02:00
|
|
|
|
2021-03-23 22:15:11 +01:00
|
|
|
add_subdirectory(base64-lib)
|
|
|
|
|
|
|
|
|
2021-03-21 22:38:22 +01:00
|
|
|
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}
|
2021-03-23 22:15:11 +01:00
|
|
|
${STM_PERIPH_SRCS} ${SETTINGS_SRCS} ${SAFETY_SRCS} ${SHELLMATTA_SRCS} ${UPDATER_SRCS}
|
|
|
|
)
|
|
|
|
|
|
|
|
add_dependencies(${ELFFILE} updater-ram-code-header-blob)
|
2021-03-21 22:38:22 +01:00
|
|
|
|
|
|
|
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)
|
2021-03-23 22:15:11 +01:00
|
|
|
target_include_directories(${ELFFILE} PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/updater/ram-code/include/")
|
2021-03-21 22:38:22 +01:00
|
|
|
|