cmake_minimum_required(VERSION 3.16) project(NixieClock) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED True) set(CMAKE_C_STANDARD 11) set(CMAKE_C_STANDARD_REQUIRED True) set(CMAKE_EXPORT_COMPILE_COMMANDS True) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ") set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-omit-frame-pointer") set(CMAKE_LINKER_FLAGS_DEBUG "${CMAKE_LINKER_FLAGS_DEBUG} -fno-omit-frame-pointer") set(cpu_options -mthumb -mcpu=cortex-m0 -msoft-float) set(nixie_clock_sources "third_party/TouchSense/stmCriticalSection.c" "third_party/TouchSense/STMTouch_Driver/src/tsl_linrot.c" "third_party/TouchSense/STMTouch_Driver/src/tsl_dxs.c" "third_party/TouchSense/STMTouch_Driver/src/tsl_time.c" "third_party/TouchSense/STMTouch_Driver/src/tsl_globals.c" "third_party/TouchSense/STMTouch_Driver/src/tsl_acq_stm32f0xx.c" "third_party/TouchSense/STMTouch_Driver/src/tsl_object.c" "third_party/TouchSense/STMTouch_Driver/src/tsl_filter.c" "third_party/TouchSense/STMTouch_Driver/src/tsl_acq.c" "third_party/TouchSense/STMTouch_Driver/src/tsl_time_stm32f0xx.c" "third_party/TouchSense/STMTouch_Driver/src/tsl_touchkey.c" "third_party/TouchSense/STMTouch_Driver/src/tsl.c" "third_party/TouchSense/STMTouch_Driver/src/tsl_ecs.c" "third_party/TouchSense/tsl_user.c" "third_party/FreeRTOS/queue.c" "third_party/FreeRTOS/timers.c" "third_party/FreeRTOS/tasks.c" "third_party/FreeRTOS/list.c" "third_party/FreeRTOS/croutine.c" "third_party/FreeRTOS/event_groups.c" "third_party/FreeRTOS/heap_2.c" #"third_party/STM32F0xx_StdPeriph_Driver/src/stm32f0xx_exti.c" #"third_party/STM32F0xx_StdPeriph_Driver/src/stm32f0xx_iwdg.c" #"third_party/STM32F0xx_StdPeriph_Driver/src/stm32f0xx_comp.c" "third_party/STM32F0xx_StdPeriph_Driver/src/stm32f0xx_gpio.c" "third_party/STM32F0xx_StdPeriph_Driver/src/stm32f0xx_rcc.c" "third_party/STM32F0xx_StdPeriph_Driver/src/stm32f0xx_spi.c" #"third_party/STM32F0xx_StdPeriph_Driver/src/stm32f0xx_wwdg.c" #"third_party/STM32F0xx_StdPeriph_Driver/src/stm32f0xx_dbgmcu.c" "third_party/STM32F0xx_StdPeriph_Driver/src/stm32f0xx_tim.c" "third_party/STM32F0xx_StdPeriph_Driver/src/stm32f0xx_rtc.c" #"third_party/STM32F0xx_StdPeriph_Driver/src/stm32f0xx_crc.c" #"third_party/STM32F0xx_StdPeriph_Driver/src/stm32f0xx_crs.c" #"third_party/STM32F0xx_StdPeriph_Driver/src/stm32f0xx_syscfg.c" #"third_party/STM32F0xx_StdPeriph_Driver/src/stm32f0xx_dac.c" #"third_party/STM32F0xx_StdPeriph_Driver/src/stm32f0xx_cec.c" #"third_party/STM32F0xx_StdPeriph_Driver/src/stm32f0xx_dma.c" #"third_party/STM32F0xx_StdPeriph_Driver/src/stm32f0xx_can.c" "third_party/STM32F0xx_StdPeriph_Driver/src/stm32f0xx_pwr.c" #"third_party/STM32F0xx_StdPeriph_Driver/src/stm32f0xx_flash.c" "third_party/STM32F0xx_StdPeriph_Driver/src/stm32f0xx_misc.c" "third_party/STM32F0xx_StdPeriph_Driver/src/stm32f0xx_adc.c" #"third_party/STM32F0xx_StdPeriph_Driver/src/stm32f0xx_i2c.c" "third_party/STM32F0xx_StdPeriph_Driver/src/stm32f0xx_usart.c" "third_party/Time/time.c" "app/indicate/indicate_modes_task.c" "app/button/button_handler.c" "app/button/button_task.c" "app/led_driver/led_driver_config.c" "app/led_driver/led_driver_process.c" "app/led_driver/led_driver_task.c" "app/ltimers/ltimers.c" "app/ltimers/ltimers_config.c" "app/nixie_driver/nixie_driver_config.c" "app/nixie_driver/nixie_driver_task.c" "app/nixie_driver/nixie_driver_process.c" "app/head_task/head_task.c" "app/light_sensor/light_sensor_task.c" "app/main.c" "app/stm32f0xx_it.c" "app/system_stm32f0xx.c" "app/platform/stm32f0-gcc/freertos/port.c" "app/platform/stm32f0-gcc/startup/handlers_cm.c" "app/platform/stm32f0-gcc/startup/stack.cpp" "app/platform/stm32f0-gcc/startup/startup.cpp" ) add_executable(${PROJECT_NAME} ${nixie_clock_sources} ) target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_SOURCE_DIR} "third_party/TouchSense/STMTouch_Driver/inc" "third_party/CMSIS/Device/Include" "third_party/FreeRTOS/include" "third_party/TouchSense" "third_party/STM32F0xx_StdPeriph_Driver/inc" "third_party/Time" "app" "app/nixie_driver" "app/ltimers" "app/head_task" "app/indicate" "app/light_sensor" "app/button" "app/led_driver" "app/platform/stm32f0-gcc/freertos" ) target_compile_definitions(${PROJECT_NAME} PRIVATE STM32F0XX=1 LED_DRIVER=1 __FREERTOS__=1 ) # select linker script set(linker_script_mcu "${CMAKE_SOURCE_DIR}/app/ld/stm32f072x8.ld") set(linker_script_flash "${CMAKE_SOURCE_DIR}/app/ld/_flash.ld") set(linker_script_sram "${CMAKE_SOURCE_DIR}/app/ld/_sram.ld") target_compile_options(${PROJECT_NAME} PRIVATE ${cpu_options} $<$:-std=c11> $<$:-std=c++17> $<$:-fms-extensions> $<$:-fno-exceptions> $<$:-fno-rtti> $<$:-fno-use-cxa-atexit> $<$:-fno-threadsafe-statics> $<$:-Wold-style-cast> $<$:-Wsuggest-override> $<$:-Wsuggest-final-types> $<$:-Wsuggest-final-methods> -fstrict-volatile-bitfields -ffunction-sections -g3 -Wall -Wextra -pedantic -Wcast-align -Wshadow -Wlogical-op -Wno-unused # TODO remove ) target_link_options(${PROJECT_NAME} PRIVATE ${cpu_options} -Wl,--gc-sections -T${linker_script_mcu} -T${linker_script_flash} -T${linker_script_sram} -nostartfiles -nostdlib ) link_directories( ${CMAKE_SOURCE_DIR} ) target_link_libraries(${PROJECT_NAME} c gcc ) set_property(TARGET ${PROJECT_NAME} PROPERTY LINK_DEPENDS ${linker_script_mcu} ${linker_script_flash} ${linker_script_sram} )