This commit is contained in:
2025-12-21 15:54:10 +01:00
commit 48ad2fdb20
1152 changed files with 639916 additions and 0 deletions

View File

@@ -0,0 +1,48 @@
set(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_SYSTEM_PROCESSOR arm)
set(CMAKE_C_COMPILER_FORCED TRUE)
set(CMAKE_CXX_COMPILER_FORCED TRUE)
set(CMAKE_C_COMPILER_ID GNU)
set(CMAKE_CXX_COMPILER_ID GNU)
# Some default GCC settings
# arm-none-eabi- must be part of path environment
set(TOOLCHAIN_PREFIX arm-none-eabi-)
set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}gcc)
set(CMAKE_ASM_COMPILER ${CMAKE_C_COMPILER})
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}g++)
set(CMAKE_LINKER ${TOOLCHAIN_PREFIX}g++)
set(CMAKE_OBJCOPY ${TOOLCHAIN_PREFIX}objcopy)
set(CMAKE_SIZE ${TOOLCHAIN_PREFIX}size)
set(CMAKE_EXECUTABLE_SUFFIX_ASM ".elf")
set(CMAKE_EXECUTABLE_SUFFIX_C ".elf")
set(CMAKE_EXECUTABLE_SUFFIX_CXX ".elf")
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
# MCU specific flags
set(TARGET_FLAGS "-mcpu=cortex-m0plus ")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${TARGET_FLAGS}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wpedantic -fdata-sections -ffunction-sections")
if(CMAKE_BUILD_TYPE MATCHES Debug)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 -g3")
endif()
if(CMAKE_BUILD_TYPE MATCHES Release)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Os -g0")
endif()
set(CMAKE_ASM_FLAGS "${CMAKE_C_FLAGS} -x assembler-with-cpp -MMD -MP")
set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -fno-rtti -fno-exceptions -fno-threadsafe-statics")
set(CMAKE_C_LINK_FLAGS "${TARGET_FLAGS}")
set(CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS} -T \"${CMAKE_SOURCE_DIR}/stm32g030f6px_flash.ld\"")
set(CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS} --specs=nano.specs")
set(CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS} -Wl,-Map=${CMAKE_PROJECT_NAME}.map -Wl,--gc-sections")
set(CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS} -Wl,--start-group -lc -lm -Wl,--end-group")
set(CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS} -Wl,--print-memory-usage")
set(CMAKE_CXX_LINK_FLAGS "${CMAKE_C_LINK_FLAGS} -Wl,--start-group -lstdc++ -lsupc++ -Wl,--end-group")

View File

@@ -0,0 +1,62 @@
cmake_minimum_required(VERSION 3.22)
project(stm32cubemx)
add_library(stm32cubemx INTERFACE)
# Enable CMake support for ASM and C languages
enable_language(C ASM)
target_compile_definitions(stm32cubemx INTERFACE
USE_HAL_DRIVER
STM32G030xx
$<$<CONFIG:Debug>:DEBUG>
)
target_include_directories(stm32cubemx INTERFACE
../../Core/Inc
../../Drivers/STM32G0xx_HAL_Driver/Inc
../../Drivers/STM32G0xx_HAL_Driver/Inc/Legacy
../../Drivers/CMSIS/Device/ST/STM32G0xx/Include
../../Drivers/CMSIS/Include
)
target_sources(stm32cubemx INTERFACE
../../Core/Src/main.cpp
../../Core/Src/stm32g0xx_it.c
../../Core/Src/stm32g0xx_hal_msp.c
../../Drivers/STM32G0xx_HAL_Driver/Src/stm32g0xx_hal_spi.c
../../Drivers/STM32G0xx_HAL_Driver/Src/stm32g0xx_hal_spi_ex.c
../../Drivers/STM32G0xx_HAL_Driver/Src/stm32g0xx_hal_rcc.c
../../Drivers/STM32G0xx_HAL_Driver/Src/stm32g0xx_hal_rcc_ex.c
../../Drivers/STM32G0xx_HAL_Driver/Src/stm32g0xx_ll_rcc.c
../../Drivers/STM32G0xx_HAL_Driver/Src/stm32g0xx_hal_flash.c
../../Drivers/STM32G0xx_HAL_Driver/Src/stm32g0xx_hal_flash_ex.c
../../Drivers/STM32G0xx_HAL_Driver/Src/stm32g0xx_hal_gpio.c
../../Drivers/STM32G0xx_HAL_Driver/Src/stm32g0xx_hal_dma.c
../../Drivers/STM32G0xx_HAL_Driver/Src/stm32g0xx_hal_dma_ex.c
../../Drivers/STM32G0xx_HAL_Driver/Src/stm32g0xx_hal_pwr.c
../../Drivers/STM32G0xx_HAL_Driver/Src/stm32g0xx_hal_pwr_ex.c
../../Drivers/STM32G0xx_HAL_Driver/Src/stm32g0xx_hal_cortex.c
../../Drivers/STM32G0xx_HAL_Driver/Src/stm32g0xx_hal.c
../../Drivers/STM32G0xx_HAL_Driver/Src/stm32g0xx_hal_exti.c
../../Drivers/STM32G0xx_HAL_Driver/Src/stm32g0xx_hal_uart.c
../../Drivers/STM32G0xx_HAL_Driver/Src/stm32g0xx_hal_uart_ex.c
../../Core/Src/system_stm32g0xx.c
../../Core/Src/sysmem.c
../../Core/Src/TLE5012.cpp
../../Core/Src/syscalls.c
../../startup_stm32g030xx.s
)
target_link_directories(stm32cubemx INTERFACE
)
target_link_libraries(stm32cubemx INTERFACE
)
# Validate that STM32CubeMX code is compatible with C standard
if(CMAKE_C_STANDARD LESS 11)
message(ERROR "Generated code requires C11 or higher")
endif()

View File

@@ -0,0 +1,39 @@
# Install script for directory: /home/johannes/Dokumente/STM32Tests/G0Test1/cmake/stm32cubemx
# Set the install prefix
if(NOT DEFINED CMAKE_INSTALL_PREFIX)
set(CMAKE_INSTALL_PREFIX "/usr/local")
endif()
string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
# Set the install configuration name.
if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)
if(BUILD_TYPE)
string(REGEX REPLACE "^[^A-Za-z0-9_]+" ""
CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}")
else()
set(CMAKE_INSTALL_CONFIG_NAME "Debug")
endif()
message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"")
endif()
# Set the component getting installed.
if(NOT CMAKE_INSTALL_COMPONENT)
if(COMPONENT)
message(STATUS "Install component: \"${COMPONENT}\"")
set(CMAKE_INSTALL_COMPONENT "${COMPONENT}")
else()
set(CMAKE_INSTALL_COMPONENT)
endif()
endif()
# Is this installation the result of a crosscompile?
if(NOT DEFINED CMAKE_CROSSCOMPILING)
set(CMAKE_CROSSCOMPILING "TRUE")
endif()
# Set default install directory permissions.
if(NOT DEFINED CMAKE_OBJDUMP)
set(CMAKE_OBJDUMP "/home/johannes/st/stm32cubeclt_1.17.0_2/GNU-tools-for-STM32/bin/arm-none-eabi-objdump")
endif()