project(cpp_sources) set(CPU_MCU "-mcpu=cortex-m0") set(CPP_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(CPP_DEFS -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 (CPP_SOURCES transfer.cpp) set (CPP_INCLUDES .) add_library(${PROJECT_NAME} ${CPP_SOURCES}) target_compile_options(${PROJECT_NAME} PUBLIC ${CPP_FLAGS}) target_compile_definitions(${PROJECT_NAME} PUBLIC ${CPP_DEFS}) target_include_directories(${PROJECT_NAME} PUBLIC ${CPP_INCLUDES}) add_library(sub::stmSources ALIAS ${PROJECT_NAME})