From 661e12b7e9614d61d8bdf78bc91964f239c3d21b Mon Sep 17 00:00:00 2001 From: Raphael Coeffic Date: Tue, 23 Nov 2021 14:46:28 +0100 Subject: [PATCH] Some fixes for STM32F2xx --- .../src/targets/common/arm/stm32/extmodule_driver.cpp | 6 ++++++ radio/src/targets/common/arm/stm32/f2/CMakeLists.txt | 4 ++-- radio/src/targets/taranis/CMakeLists.txt | 11 +++++++++++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/radio/src/targets/common/arm/stm32/extmodule_driver.cpp b/radio/src/targets/common/arm/stm32/extmodule_driver.cpp index fd3e8a32a..eb32cdc19 100644 --- a/radio/src/targets/common/arm/stm32/extmodule_driver.cpp +++ b/radio/src/targets/common/arm/stm32/extmodule_driver.cpp @@ -27,6 +27,12 @@ extern "C" { #include "STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_tim.h" #include "STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_dma.h" #elif defined(STM32F2) + + // Workaround to prevent the other CMSIS header to be included + // and fix some missing items in the old one + #include "thirdparty/CMSIS/Include/cmsis_compiler.h" + #define __CORE_CM3_H_GENERIC + #include "CMSIS/Device/ST/STM32F2xx/Include/stm32f2xx.h" #include "STM32F2xx_HAL_Driver/Inc/stm32f2xx_ll_gpio.h" #include "STM32F2xx_HAL_Driver/Inc/stm32f2xx_ll_tim.h" diff --git a/radio/src/targets/common/arm/stm32/f2/CMakeLists.txt b/radio/src/targets/common/arm/stm32/f2/CMakeLists.txt index 96649cd34..2d417f56a 100644 --- a/radio/src/targets/common/arm/stm32/f2/CMakeLists.txt +++ b/radio/src/targets/common/arm/stm32/f2/CMakeLists.txt @@ -1,7 +1,6 @@ set(CPU_FAMILY STM32) set(MCU cortex-m3) set(FPU_FLAGS "") -set(STM32LIB_DIR ${THIRDPARTY_DIR}/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries) # STM32 HAL/LL library set(STM32CUBE_DIR ${THIRDPARTY_DIR}/STM32F2xx_HAL_Driver) @@ -21,9 +20,10 @@ target_include_directories(stm32cube_ll PRIVATE set(FIRMWARE_SRC ${FIRMWARE_SRC} $) # StdPeriph library +set(STM32LIB_DIR ${THIRDPARTY_DIR}/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries) include_directories(${STM32LIB_DIR}/STM32F2xx_StdPeriph_Driver/inc) include_directories(${STM32LIB_DIR}/CMSIS/Device/ST/STM32F2xx/Include) -include_directories(${STM32LIB_DIR}/CMSIS/include) +include_directories(${STM32LIB_DIR}/CMSIS/Include) add_definitions(-DSTM32F2) diff --git a/radio/src/targets/taranis/CMakeLists.txt b/radio/src/targets/taranis/CMakeLists.txt index 0b15f921b..e01333f6d 100644 --- a/radio/src/targets/taranis/CMakeLists.txt +++ b/radio/src/targets/taranis/CMakeLists.txt @@ -88,6 +88,7 @@ elseif(PCB STREQUAL X9D+) set(FLAVOUR x9d+) set(CPU_TYPE STM32F2) set(CPU_TYPE_FULL STM32F205xE) # for size report + add_definitions(-DSTM32F205xx) set(LINKER_SCRIPT targets/taranis/stm32f2_flash.ld) set(AUX_SERIAL_DRIVER ../common/arm/stm32/aux_serial_driver.cpp) set(STATUS_LEDS NO) @@ -97,6 +98,7 @@ elseif(PCB STREQUAL X9D) set(FLAVOUR x9d) set(CPU_TYPE STM32F2) set(CPU_TYPE_FULL STM32F205xE) # for size report + add_definitions(-DSTM32F205xx) set(LINKER_SCRIPT targets/taranis/stm32f2_flash.ld) option(HAPTIC "Haptic support" OFF) set(LUA_EXPORT lua_export_x9d) @@ -132,6 +134,7 @@ elseif(PCB STREQUAL X7) set(NAVIGATION_TYPE 9x) set(CPU_TYPE STM32F2) set(CPU_TYPE_FULL STM32F205xE) # for size report + add_definitions(-DSTM32F205xx) set(LINKER_SCRIPT targets/taranis/stm32f2_flash.ld) set(LUA_EXPORT lua_export_t12) add_definitions(-DRADIO_T12) @@ -161,6 +164,7 @@ elseif(PCB STREQUAL X7) set(NAVIGATION_TYPE 9x) set(CPU_TYPE STM32F2) set(CPU_TYPE_FULL STM32F205xE) # for size report + add_definitions(-DSTM32F205xx) set(LINKER_SCRIPT targets/taranis/stm32f2_flash.ld) set(LUA_EXPORT lua_export_tlite) add_definitions(-DRADIO_TLITE) @@ -174,6 +178,7 @@ elseif(PCB STREQUAL X7) set(NAVIGATION_TYPE x7) set(CPU_TYPE STM32F2) set(CPU_TYPE_FULL STM32F205xE) # for size report + add_definitions(-DSTM32F205xx) set(LINKER_SCRIPT targets/taranis/stm32f2_flash.ld) set(ROTARY_ENCODER YES) set(LUA_EXPORT lua_export_tx12) @@ -215,6 +220,7 @@ elseif(PCB STREQUAL X7) set(NAVIGATION_TYPE x7) set(CPU_TYPE STM32F2) set(CPU_TYPE_FULL STM32F205xE) # for size report + add_definitions(-DSTM32F205xx) set(LINKER_SCRIPT targets/taranis/stm32f2_flash.ld) set(ROTARY_ENCODER NO) set(LUA_EXPORT lua_export_t8) @@ -255,6 +261,7 @@ elseif(PCB STREQUAL X7) set(NAVIGATION_TYPE x7) set(CPU_TYPE STM32F2) set(CPU_TYPE_FULL STM32F205xE) # for size report + add_definitions(-DSTM32F205xx) set(LINKER_SCRIPT targets/taranis/stm32f2_flash.ld) set(LUA_EXPORT lua_export_x7) add_definitions(-DRADIO_X7) @@ -279,6 +286,7 @@ elseif(PCB STREQUAL X9LITE) set(PWR_BUTTON "PRESS" CACHE STRING "Pwr button type (PRESS/SWITCH)") set(CPU_TYPE STM32F2) set(CPU_TYPE_FULL STM32F205xE) # for size report + add_definitions(-DSTM32F205xx) set(LINKER_SCRIPT targets/taranis/stm32f2_flash.ld) set(HAPTIC YES) set(LUA_EXPORT lua_export_x9lite) @@ -305,6 +313,7 @@ elseif(PCB STREQUAL X9LITES) set(PWR_BUTTON "PRESS" CACHE STRING "Pwr button type (PRESS/SWITCH)") set(CPU_TYPE STM32F2) set(CPU_TYPE_FULL STM32F205xE) # for size report + add_definitions(-DSTM32F205xx) set(LINKER_SCRIPT targets/taranis/stm32f2_flash.ld) set(HAPTIC YES) set(LUA_EXPORT lua_export_x9lites) @@ -332,6 +341,7 @@ elseif(PCB STREQUAL XLITE) set(PWR_BUTTON "PRESS" CACHE STRING "Pwr button type (PRESS/SWITCH)") set(CPU_TYPE STM32F2) set(CPU_TYPE_FULL STM32F205xE) # for size report + add_definitions(-DSTM32F205xx) set(LINKER_SCRIPT targets/taranis/stm32f2_flash.ld) set(HAPTIC YES) set(LUA_EXPORT lua_export_xlite) @@ -357,6 +367,7 @@ elseif(PCB STREQUAL XLITES) set(PWR_BUTTON "PRESS" CACHE STRING "Pwr button type (PRESS/SWITCH)") set(CPU_TYPE STM32F2) set(CPU_TYPE_FULL STM32F205xE) # for size report + add_definitions(-DSTM32F205xx) set(LINKER_SCRIPT targets/taranis/stm32f2_flash.ld) set(HAPTIC YES) set(LUA_EXPORT lua_export_xlites)