Basic application skeleton for pico-stm32 board with STM32F103C8
Signed-off-by: Matthias Blankertz <matthias@blankertz.org>
This commit is contained in:
69
CMakeLists.txt
Normal file
69
CMakeLists.txt
Normal file
@@ -0,0 +1,69 @@
|
||||
cmake_minimum_required(VERSION 3.29)
|
||||
|
||||
project(pico-stm32-playground LANGUAGES C ASM)
|
||||
|
||||
set(CMAKE_C_STANDARD 11)
|
||||
set(CMAKE_C_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_C_EXTENSIONS ON)
|
||||
|
||||
# Set up STM32 HAL
|
||||
set(STM32_HAL_DEFINES
|
||||
STM32F103xB
|
||||
HSE_VALUE=16000000U
|
||||
)
|
||||
|
||||
set(HAL_DIR ${CMAKE_CURRENT_SOURCE_DIR}/HAL)
|
||||
|
||||
add_library(stm32-hal STATIC)
|
||||
|
||||
target_include_directories(stm32-hal PUBLIC
|
||||
${HAL_DIR}/Drivers/CMSIS/Include
|
||||
${HAL_DIR}/Drivers/CMSIS/Device/ST/STM32F1xx/Include
|
||||
${HAL_DIR}/Drivers/STM32F1xx_HAL_Driver/Inc
|
||||
include/
|
||||
)
|
||||
|
||||
target_compile_definitions(stm32-hal PUBLIC
|
||||
${STM32_HAL_DEFINES}
|
||||
)
|
||||
|
||||
target_sources(stm32-hal PRIVATE
|
||||
# LL drivers
|
||||
${HAL_DIR}/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_adc.c
|
||||
${HAL_DIR}/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_crc.c
|
||||
${HAL_DIR}/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.c
|
||||
${HAL_DIR}/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.c
|
||||
${HAL_DIR}/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.c
|
||||
${HAL_DIR}/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_i2c.c
|
||||
${HAL_DIR}/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_pwr.c
|
||||
${HAL_DIR}/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rcc.c
|
||||
${HAL_DIR}/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rtc.c
|
||||
${HAL_DIR}/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_spi.c
|
||||
${HAL_DIR}/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.c
|
||||
${HAL_DIR}/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.c
|
||||
${HAL_DIR}/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.c
|
||||
# Startup code
|
||||
${HAL_DIR}/Drivers/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/startup_stm32f103xb.s
|
||||
${HAL_DIR}/Drivers/CMSIS/Device/ST/STM32F1xx/Source/Templates/system_stm32f1xx.c
|
||||
)
|
||||
|
||||
# Set up target executable
|
||||
add_executable(pico-stm32-playground)
|
||||
|
||||
target_link_libraries(pico-stm32-playground
|
||||
PRIVATE stm32-hal
|
||||
)
|
||||
|
||||
target_sources(pico-stm32-playground PRIVATE
|
||||
src/main.c
|
||||
)
|
||||
|
||||
# clang-format
|
||||
add_custom_target(check-format
|
||||
find include/ src/ -iname '*.[ch]' -exec clang-format -Werror --dry-run {} +
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
add_custom_target(clang-format
|
||||
find include/ src/ -iname '*.[ch]' -exec clang-format -i {} +
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
Reference in New Issue
Block a user