Skip to content

Commit

Permalink
Remove all the STM32 cmake setup from reactor-c. This happens outside
Browse files Browse the repository at this point in the history
  • Loading branch information
erlingrj committed Nov 5, 2024
1 parent 68bd26a commit 335d52b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 37 deletions.
35 changes: 1 addition & 34 deletions low_level_platform/api/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,41 +14,8 @@ elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Rp2040")
target_link_libraries(lf-low-level-platform-api INTERFACE pico_stdlib)
target_link_libraries(lf-low-level-platform-api INTERFACE pico_multicore)
target_link_libraries(lf-low-level-platform-api INTERFACE pico_sync)
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Stm32")
if(DEFINED ENV{STM_SDK_DIR})
message(STATUS "STM_SDK_DIR is set to $ENV{STM_SDK_DIR}")
else()
message(FATAL_ERROR "The STM_SDK_DIR environment variable must be set to point to the directory generated by CUBEMX for you project.")
endif()
set(STM_SDK_DIR $ENV{STM_SDK_DIR})
set(MCU_FAMILY STM32F4xx)
set(MCU_MODEL STM32F446xx)
set(CPU_PARAMETERS -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=softfp)

file(GLOB_RECURSE STM32CUBEMX_SOURCES ${STM_DIR}/Core/*.c ${STM_DIR}/Drivers/${MCU_FAMILY}_HAL_Driver/*.c)
set(CUBEMX_INCLUDE_DIRECTORIES
${STM_DIR}/Core/Inc
${STM_DIR}/Drivers/${MCU_FAMILY}_HAL_Driver/Inc
${STM_DIR}/Drivers/CMSIS/Device/ST/${MCU_FAMILY}/Include
${STM_DIR}/Drivers/CMSIS/Include
)
target_compile_options(lf-low-level-platform-api INTERFACE
${CPU_PARAMETERS}
-Wall
-Wextra
-Wpedantic
-Wno-unused-parameter
$<$<COMPILE_LANGUAGE:CXX>:
-Wno-volatile
-Wold-style-cast
-Wuseless-cast
-Wsuggest-override>
$<$<CONFIG:Debug>:-Og -g3 -ggdb>
$<$<CONFIG:Release>:-Og -g0>)

elseif(${CMAKE_SYSTEM_NAME} STREQUAL "STM32F4")
target_compile_definitions(lf-low-level-platform-api INTERFACE PLATFORM_STM32F4)
target_include_directories(lf-low-level-platform-api INTERFACE ${CUBEMX_INCLUDE_DIRECTORIES})
target_compile_definitions(lf-low-level-platform-api INTERFACE ${MCU_MODEL} USE_HAL_DRIVER)
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "FlexPRET")
target_compile_definitions(lf-low-level-platform-api INTERFACE PLATFORM_FLEXPRET)
target_link_libraries(lf-low-level-platform-api INTERFACE fp-sdk)
Expand Down
1 change: 0 additions & 1 deletion low_level_platform/api/platform/lf_STM32f4_support.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#define PRINTF_TIME "%lld"
#define PRINTF_MICROSTEP "%d"

#define LF_TIME_BUFFER_LENGTH 80
#define _LF_TIMEOUT 1

#ifdef LF_THREADED
Expand Down
4 changes: 2 additions & 2 deletions low_level_platform/impl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Rp2040")
${CMAKE_CURRENT_LIST_DIR}/src/lf_rp2040_support.c
${CMAKE_CURRENT_LIST_DIR}/src/lf_atomic_irq.c
)
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Stm32")
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "STM32F4")
set(LF_LOW_LEVEL_PLATFORM_FILES
${CMAKE_CURRENT_LIST_DIR}/src/lf_STM32f4_support.c
${CMAKE_CURRENT_LIST_DIR}/src/lf_atomic_irq.c
Expand All @@ -55,7 +55,7 @@ elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Patmos")
${CMAKE_CURRENT_LIST_DIR}/src/lf_atomic_irq.c
)
else()
message(FATAL_ERROR "Your platform is not supported! The C target supports FlexPRET, Patmos, Linux, MacOS, nRF52, RP2040, Windows, and Zephyr.")
message(FATAL_ERROR "Your platform is not supported! The C target supports FlexPRET, Patmos, Linux, MacOS, nRF52, RP2040, STM32F4, Windows, and Zephyr.")
endif()

list(APPEND LF_LOW_LEVEL_PLATFORM_FILES ${CMAKE_CURRENT_LIST_DIR}/src/lf_platform_util.c)
Expand Down

0 comments on commit 335d52b

Please sign in to comment.