1# Deferring this config until we decide how to include other CMSIS libraries... it is likely that we always want to use the stub version of the core 2# at least if the vendor/device is RaspberryPi/RP2040... 3 4## PICO_CMAKE_CONFIG: PICO_CMSIS_PATH, directory to locate CMSIS installation, default="included stub CORE only impl", group=build 5#if (DEFINED PICO_CMSIS_PATH) 6# set(PICO_CMSIS_PATH "${PICO_CMSIS_PATH}" CACHE PATH "Path to the CMSIS tree to use with Raspberry Pi Pico SDK") 7# message("Using specified PICO_CMSIS_PATH for CMSIS ('${PICO_CMSIS_PATH}')") 8#elseif (DEFINED ENV{PICO_CMSIS_PATH}) 9# set(PICO_CMSIS_PATH $ENV{PICO_CMSIS_PATH}) 10# message("Using PICO_CMSIS_PATH from environment for CMSIS ('${PICO_CMSIS_PATH}')") 11#endif() 12# 13## PICO_CMAKE_CONFIG: PICO_CMSIS_VENDOR, vendor name for CMSIS, default="RaspberryPi", group=build 14#if (DEFINED PICO_CMSIS_VENDOR) 15# set(PICO_CMSIS_VENDOR "${PICO_CMSIS_VENDOR}" CACHE STRING "CMSIS vendor name to use") 16# message("Using specified PICO_CMSIS_VENDOR for CMSIS ('${PICO_CMSIS_VENDOR}')") 17#elseif (DEFINED ENV{PICO_CMSIS_VENDOR}) 18# set(PICO_CMSIS_VENDOR $ENV{PICO_CMSIS_VENDOR}) 19# message("Using PICO_CMSIS_VENDOR from environment for CMSIS ('${PICO_CMSIS_VENDOR}')") 20#else() 21# set(PICO_CMSIS_VENDOR RaspberryPi) 22#endif() 23# 24## PICO_CMAKE_CONFIG: PICO_CMSIS_DEVICE, device name for CMSIS, default="RP2040", group=build 25#if (DEFINED PICO_CMSIS_DEVICE) 26# set(PICO_CMSIS_DEVICE "${PICO_CMSIS_DEVICE}" CACHE STRING "CMSIS device name to use") 27# message("Using specified PICO_CMSIS_DEVICE for CMSIS ('${PICO_CMSIS_DEVICE}')") 28#elseif (DEFINED ENV{PICO_CMSIS_DEVICE}) 29# set(PICO_CMSIS_DEVICE $ENV{PICO_CMSIS_DEVICE}) 30# message("Using PICO_CMSIS_DEVICE from environment for CMSIS ('${PICO_CMSIS_DEVICE}')") 31#else() 32# set(PICO_CMSIS_DEVICE RP2040) 33#endif() 34# 35#if (PICO_CMSIS_PATH AND EXISTS ${PICO_CMSIS_PATH}/CMSIS/Core/${PICO_CMSIS_VENDOR}/${PICO_CMSIS_DEVICE}) 36# message("CMSIS Core found for path ${PICO_CMSIS_PATH}, vendor ${PICO_CMSIS_VENDOR}, device ${PICO_CMSIS_DEVICE}") 37# set(PICO_CMSIS_CORE_PATH ${PICO_CMSIS_PATH}/CMSIS/Core) 38#elseif (PICO_CMSIS_VENDOR STREQUAL "RaspberryPi" AND PICO_CMSIS_DEVICE STREQUAL "RP2040") 39# set(PICO_CMSIS_CORE_PATH ${CMAKE_CURRENT_LIST_DIR}/stub) 40#elseif (PICO_CMSIS_PATH) 41# message(WARNING "CMSIS core not found in ${PICO_CMSIS_PATH} for vendor ${PICO_CMSIS_VENDOR}, device ${PICO_CMSIS_DEVICE}") 42# set(PICO_CMSIS_CORE_PATH) 43#else() 44# message(WARNING "Non-standard vendor ${PICO_CMSIS_VENDOR} amd device ${PICO_CMSIS_DEVICE} specified, but PICO_CMSIS_PATH was not set") 45#endif() 46 47# ... using these 3 lines instead 48set(PICO_CMSIS_CORE_PATH ${CMAKE_CURRENT_LIST_DIR}/stub) 49set(PICO_CMSIS_VENDOR RaspberryPi) 50set(PICO_CMSIS_DEVICE RP2040) 51 52if (PICO_CMSIS_CORE_PATH) 53 pico_add_library(cmsis_core) 54 target_sources(cmsis_core INTERFACE 55 ${PICO_CMSIS_CORE_PATH}/CMSIS/Device/${PICO_CMSIS_VENDOR}/${PICO_CMSIS_DEVICE}/Source/system_${PICO_CMSIS_DEVICE}.c 56 ) 57 target_include_directories(cmsis_core_headers INTERFACE 58 ${PICO_CMSIS_CORE_PATH}/CMSIS/Core/Include 59 ${PICO_CMSIS_CORE_PATH}/CMSIS/Device/${PICO_CMSIS_VENDOR}/${PICO_CMSIS_DEVICE}/Include 60 ) 61 pico_mirrored_target_link_libraries(cmsis_core INTERFACE hardware_clocks pico_platform) 62 63 list(APPEND PICO_RP2040_CONFIG_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/include/cmsis/rename_exceptions.h) 64 pico_promote_common_scope_vars() 65endif() 66 67