-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
34 lines (27 loc) · 1.46 KB
/
Copy pathCMakeLists.txt
File metadata and controls
34 lines (27 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
cmake_minimum_required(VERSION 3.31)
project(TempSensor VERSION 1.0 LANGUAGES C CXX)
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
enable_language(ASM)
set(LINKER_SCRIPT "${CMAKE_SOURCE_DIR}/STM32L452RETX_FLASH.ld")
set(MCPU "-mcpu=cortex-m4")
set(MFPU "-mfpu=fpv4-sp-d16")
set(MFLOAT_ABI "-mfloat-abi=hard")
set(RUNTIME_LIBRARY "--specs=nano.specs")
set(RUNTIME_LIBRARY_SYSCALLS "--specs=nosys.specs")
set(COMMON_COMPILER_FLAGS "${MCPU} ${MFPU} ${MFLOAT_ABI} ${RUNTIME_LIBRARY} -mthumb -Wall -Werror -ffunction-sections -fdata-sections")
set(CMAKE_EXECUTABLE_SUFFIX ".elf")
set(CMAKE_STATIC_LIBRARY_SUFFIX ".a")
set(CMAKE_C_FLAGS "${COMMON_COMPILER_FLAGS}")
set(CMAKE_CXX_FLAGS "${COMMON_COMPILER_FLAGS} -fno-exceptions -fno-rtti -fno-use-cxa-atexit")
set(CMAKE_EXE_LINKER_FLAGS "-T${LINKER_SCRIPT} ${RUNTIME_LIBRARY_SYSCALLS} -Wl,-Map=test.map -Wl,--gc-sections -static -Wl,--start-group -lc -lm -Wl,--end-group -u _printf_float")
set(CMAKE_ASM_FLAGS "${CMAKE_C_FLAGS} -c -x assembler-with-cpp")
file(GLOB_RECURSE sources src/*.c src/*.cpp)
add_executable(TempSensor ${sources} startup/startup_stm32l452retx.s)
target_include_directories(TempSensor PUBLIC inc)
target_link_libraries(TempSensor PUBLIC Drivers)
target_compile_definitions(TempSensor PUBLIC STM32L452xx USE_HAL_DRIVER)
add_subdirectory(config)
add_subdirectory(drivers)