@@ -5,57 +5,38 @@ cmake_minimum_required(VERSION "3.21")
55project (si LANGUAGES C)
66
77# Define the library
8- add_library (si STATIC "src/crc8.c" "src/device/commands.c" "src/device/gc_controller.c" )
9-
10- # Configure SI peripheral selection
11- if (DEFINED SI_RX_TIMER_IDX)
12- target_compile_definitions (si PUBLIC SI_RX_TIMER_IDX=${SI_RX_TIMER_IDX} )
13- endif ()
14-
15- if (DEFINED SI_TX_USART_IDX)
16- target_compile_definitions (si PUBLIC SI_TX_USART_IDX=${SI_TX_USART_IDX} )
17- endif ()
8+ add_library (si STATIC src/crc8.c src/device/commands.c src/device/gc_controller.c)
189
1910# Specify the include paths
2011target_include_directories (si PUBLIC include )
2112
2213# EFR32 platform specific settings
2314if (CMAKE_CROSSCOMPILING )
24- if (DEFINED ZEPHYR_BASE)
25- # Building for EFR32 using Zephyr
26- # Note: rail_config.h and rail_config.c are not automatically generated by Zephyr,
27- # so we expect them to be already present in the src/autogen directory.
28- if (NOT CONFIG_SOC_FAMILY_SILABS_S2)
29- message (FATAL_ERROR "Only EFR32 Series 2 SoCs are currently supported." )
30- endif ()
31-
32- # Pull in the Zephyr interface library
33- target_link_libraries (si PUBLIC zephyr_interface)
34-
35- # Pull in additional EMLIB sources required for libsi
36- zephyr_library_sources(
37- ${ZEPHYR_HAL_SILABS_MODULE_DIR} /simplicity_sdk/platform/emlib/src/em_timer.c
38- ${ZEPHYR_HAL_SILABS_MODULE_DIR} /simplicity_sdk/platform/emlib/src/em_ldma.c
39- ${ZEPHYR_HAL_SILABS_MODULE_DIR} /simplicity_sdk/platform/emdrv/dmadrv/src/dmadrv.c
15+ # Building for EFR32 using gecko-sdk-cmake
16+ if (NOT GeckoSDK_FOUND)
17+ include (FetchContent)
18+ FetchContent_Declare(
19+ GeckoSDK
20+ GIT_REPOSITORY https://github.com/loopj/gecko-sdk-cmake.git
21+ GIT_TAG main
4022 )
41- else ()
42- # Building for EFR32 using gecko-sdk-cmake
43- if (NOT GeckoSDK_FOUND)
44- include (FetchContent)
45- FetchContent_Declare(
46- GeckoSDK
47- GIT_REPOSITORY https://github.com/loopj/gecko-sdk-cmake.git
48- GIT_TAG main
49- )
50- FetchContent_MakeAvailable(GeckoSDK)
51- endif ()
23+ FetchContent_MakeAvailable(GeckoSDK)
24+ endif ()
5225
53- # Depend on emlib from the Gecko SDK
54- target_link_libraries (si GeckoSDK::emlib GeckoSDK::emdrv::dmadrv)
26+ # Configure SI peripheral selection
27+ if (DEFINED SI_RX_TIMER_IDX)
28+ target_compile_definitions (si PUBLIC SI_RX_TIMER_IDX=${SI_RX_TIMER_IDX} )
29+ endif ()
30+
31+ if (DEFINED SI_TX_USART_IDX)
32+ target_compile_definitions (si PUBLIC SI_TX_USART_IDX=${SI_TX_USART_IDX} )
5533 endif ()
5634
5735 # Add the platform-specific source files
5836 target_sources (si PRIVATE "src/platform/efr32/si_efr32_emlib.c" )
37+
38+ # Depend on emlib from the Gecko SDK
39+ target_link_libraries (si GeckoSDK::emlib GeckoSDK::emdrv::dmadrv)
5940endif ()
6041
6142# Add the test target
0 commit comments