From 68bd26af438e2779431e6450846df7602b949b38 Mon Sep 17 00:00:00 2001 From: erlingrj Date: Tue, 29 Oct 2024 11:58:54 -0700 Subject: [PATCH] Dont rely on hardcoded relative path to the "STM_SDK" --- low_level_platform/api/CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/low_level_platform/api/CMakeLists.txt b/low_level_platform/api/CMakeLists.txt index 18f774c14..b143b9a1f 100644 --- a/low_level_platform/api/CMakeLists.txt +++ b/low_level_platform/api/CMakeLists.txt @@ -15,7 +15,12 @@ elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Rp2040") 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") - set(STM_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../../STM_sdk) + 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)