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)