You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
84 lines
2.8 KiB
84 lines
2.8 KiB
####################################################################################################
|
|
# 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}/csl/stm32f042/startup/STM32F042K6Tx_FLASH.ld)
|
|
set(CSL_USED ${CMAKE_SOURCE_DIR}/csl/stm32f042)
|
|
####################################################################################################
|
|
#VARIABLES : defined by user
|
|
####################################################################################################
|
|
|
|
set(CSL_INCLUDES
|
|
${UTILS_DIR}
|
|
${CMAKE_SOURCE_DIR}/csl/stm32f042/CMSIS/Include
|
|
${CMAKE_SOURCE_DIR}/csl/stm32f042/Device)
|
|
|
|
# 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
|
|
## -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
|
|
$<$<CONFIG:Debug>:-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 (MAIN_INCLUDES ${CMAKE_SOURCE_DIR})
|
|
set (MAIN_FLAGS ${C_FLAGS})
|
|
set (MAIN_DEFS ${C_DEFS})
|
|
|
|
list(APPEND EXTRA_LIBS sub::startup)
|
|
list(APPEND EXTRA_LIBS sub::delay)
|
|
list(APPEND EXTRA_LIBS sub::timer)
|
|
list(APPEND EXTRA_LIBS sub::usart)
|
|
list(APPEND EXTRA_LIBS sub::init)
|
|
list(APPEND EXTRA_LIBS sub::max7219)
|
|
list(APPEND EXTRA_LIBS sub::spi)
|
|
list(APPEND EXTRA_LIBS sub::imp_spi)
|
|
list(APPEND EXTRA_LIBS sub::pin)
|
|
list(APPEND EXTRA_LIBS sub::ad9833)
|
|
|