diff --git a/stm32-toolchain.cmake b/stm32-toolchain.cmake new file mode 100644 index 0000000..83b1aea --- /dev/null +++ b/stm32-toolchain.cmake @@ -0,0 +1,36 @@ +# ############################### +# STM32 toolchain file +# ############################### + +# Specify the cross-compiler +set(CROSS_TOOLCHAIN arm-none-eabi-) +set(CMAKE_SYSTEM_NAME Generic) +set(CMAKE_SYSTEM_PROCESSOR arm) +set(CMAKE_CROSSCOMPILING 1) +set(CMAKE_SYSTEM_VERSION 1) + +# Specify the exact Chip + + +# Programmer and debugging +set(PROGRAMMER serialupdi) +set(PORT /dev/ttyU0) + + +# Define the toolchain executables +set(CMAKE_C_COMPILER avr-gcc) +set(CMAKE_CXX_COMPILER avr-g++) +set(CMAKE_ASM_COMPILER avr-gcc) +set(CMAKE_LINKER avr-ld) +set(CMAKE_OBJCOPY avr-objcopy) +set(CMAKE_SIZE avr-size) + + + + +# Define compile options +set(CMAKE_C_FLAGS " -Os -mmcu=${AVR_MCU} -DF_CPU=${F_CPU}") +set(CMAKE_CXX_FLAGS "-mmcu=${AVR_MCU} -DF_CPU=${F_CPU}") +set(CMAKE_EXE_LINKER_FLAGS_INIT "-mmcu=${AVR_MCU}") + +