Created STM32 toolchain file

Created an toolchain file `stm32-toolchain.cmake` in the root dir of the
repo.
This commit is contained in:
Jake Goodwin 2024-11-07 00:36:49 -08:00
parent 9343842eae
commit c0faa2322f
1 changed files with 36 additions and 0 deletions

36
stm32-toolchain.cmake Normal file
View File

@ -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}")