#################################################################################################### # bsl_nucleo_f042k6.cmake #################################################################################################### set(CPU_MCU "-mcpu=cortex-m0") #################################################################################################### #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) #################################################################################################### #VARIABLES : defined by user #################################################################################################### set(LINKER ${CSL_STARTUP_DIR}/STM32F042K6Tx_FLASH.ld) # For flags please check https://manned.org/arm-none-eabi-gcc/34fd6095 set(MAIN_FLAGS ${CPU_MCU} -mthumb #Instruction set : https://stackoverflow.com/questions/10638130/what-is-the-arm-thumb-instruction-set ## -O1 -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(MAIN_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) #The order is important set(LINKER_FLAGS ${CPU_MCU} -mthumb -specs=nano.specs -T${LINKER} -lc -lm -lnosys -Wl,-Map=${PROJECT_NAME}.map,--cref -Wl,--gc-sections)