#################################################################################################### # bsl_nucleo_f042k6.cmake #################################################################################################### set(CPU_MCU "-mcpu=cortex-m0") set(IDIR_BIN "${CMAKE_SOURCE_DIR}/bsl/nucleo_f042k6/bin") set(IDIR_LIB "${CMAKE_SOURCE_DIR}/bsl/nucleo_f042k6/lib") set(IDIR_INC "${CMAKE_SOURCE_DIR}/bsl/nucleo_f042k6/inc") #################################################################################################### #PROJECT & LIBRARIES : defined by user and important that it comes after the VARIABLES otherwise the Set varibale will not be used. #################################################################################################### set(CMAKE_CXX_STANDARD 11) set(CMAKE_SYSTEM_NAME Generic) set(CMAKE_SYSTEM_PROCESSOR arm) set(CMAKE_CROSSCOMPILING TRUE) set(LINKER ${CMAKE_SOURCE_DIR}/bsl/csl/stm32f042/startup/STM32F042K6Tx_FLASH.ld) set(BSL_INC_DIR ${CMAKE_CURRENT_SOURCE_DIR}) set(CLS_USED ${CMAKE_SOURCE_DIR}/bsl/csl/stm32f042) #################################################################################################### #VARIABLES : defined by user #################################################################################################### set(CSL_INCLUDES ${CMAKE_SOURCE_DIR}/bsl/csl/stm32f042/Inc ${CMAKE_SOURCE_DIR}/bsl/csl/stm32f042/Drivers/CMSIS/Include ${CMAKE_SOURCE_DIR}/bsl/csl/stm32f042/Drivers/CMSIS/Device/ST/STM32F0xx/Include ${CMAKE_SOURCE_DIR}/bsl/csl/stm32f042/Drivers/STM32F0xx_HAL_Driver/Inc) # For flags please check https://manned.org/arm-none-eabi-gcc/34fd6095 set(C_FLAGS ${CPU_MCU} -mthumb #Instruction set : https://stackoverflow.com/questions/10638130/what-is-the-arm-thumb-instruction-set -Wall #Error : If you don't know this one please chek basical compiling -fdata-sections #Optimization : Linker can perform optimizations to improve locality of reference in the instruction space. -fdiagnostics-color=always -ffunction-sections #Optimization : used with -fdata-sections $<$:-O -g -gdwarf-2>) set(C_DEFS -DARM_MCU #Defined by kerem to auto configure headers in main.hpp -DUSE_FULL_LL_DRIVER -DSTM32F042x6 -DHSE_VALUE=8000000 -DHSE_STARTUP_TIMEOUT=100 -DLSE_STARTUP_TIMEOUT=5000 -DLSE_VALUE=32768 -DHSI_VALUE=8000000 -DLSI_VALUE=40000 -DVDD_VALUE=3300 -DPREFETCH_ENABLE=1 -DINSTRUCTION_CACHE_ENABLE=0 -DDATA_CACHE_ENABLE=0) set(LINKER_FLAGS ${CPU_MCU} -mthumb -specs=nano.specs -T${LINKER} -lc -lm -lnosys -Wl,-Map=${PROJECT_NAME}.map,--cref -Wl,--gc-sections) #The order is important set (CPP_INCLUDES ${CMAKE_SOURCE_DIR}) set (CPP_FLAGS ${C_FLAGS}) set (CPP_DEFS ${C_DEFS}) list(APPEND EXTRA_LIBS sub::startup) list(APPEND EXTRA_LIBS sub::translator) list(APPEND EXTRA_LIBS sub::sources) list(APPEND EXTRA_LIBS sub::delay) list(APPEND EXTRA_LIBS sub::pin) list(APPEND EXTRA_LIBS sub::usart)