1# Makefile - Gecko SDK 2# 3# Copyright (c) 2017, Christian Taedcke 4# Copyright (c) 2021, Safran Passenger Innovations Germany GmbH 5# Copyright (c) 2022, Antmicro <www.antmicro.com> 6# 7# SPDX-License-Identifier: Apache-2.0 8# 9 10set(EMLIB_DIR ${ZEPHYR_HAL_SILABS_MODULE_DIR}/gecko/emlib) 11set(COMMON_DIR ${ZEPHYR_HAL_SILABS_MODULE_DIR}/gecko/common) 12set(DEVICE_DIR ${ZEPHYR_HAL_SILABS_MODULE_DIR}/gecko/Device) 13set(RADIO_DIR ${ZEPHYR_HAL_SILABS_MODULE_DIR}/gecko/platform/radio) 14set(BLOBS_DIR ${ZEPHYR_HAL_SILABS_MODULE_DIR/zephyr/blobs}) 15 16# Translate the SoC name and part number into the gecko device and cpu name 17# respectively. 18string(TOUPPER ${CONFIG_SOC_SERIES} SILABS_GECKO_DEVICE) 19 20# Get SoC series number, i.e. translate e.g. efr32bg22 -> 22 21string(SUBSTRING ${CONFIG_SOC_SERIES} 7 2 GECKO_SERIES_NUMBER) 22 23set(SILABS_GECKO_PART_NUMBER ${CONFIG_SOC_PART_NUMBER}) 24 25function(add_prebuilt_library lib_name prebuilt_path) 26 add_library(${lib_name} STATIC IMPORTED GLOBAL) 27 set_target_properties(${lib_name} PROPERTIES 28 IMPORTED_LOCATION ${BLOBS_DIR}/${prebuilt_path} 29 ) 30 zephyr_link_libraries(${lib_name}) 31endfunction() 32 33if(${CONFIG_SOC_GECKO_HAS_RADIO}) 34 if(${CONFIG_SOC_FAMILY_SILABS_S1}) 35 zephyr_include_directories( 36 ${RADIO_DIR}/rail_lib/plugin/pa-conversions/efr32xg1x/config 37 ${RADIO_DIR}/rail_lib/chip/efr32/efr32xg1x 38 ) 39 endif() 40 41 zephyr_include_directories( 42 ${RADIO_DIR}/rail_lib/common 43 ${RADIO_DIR}/rail_lib/plugin/pa-conversions 44 ) 45 46 if(CONFIG_SOC_GECKO_USE_RAIL) 47 # rail 48 zephyr_library_sources(${RADIO_DIR}/rail_lib/plugin/pa-conversions/pa_conversions_efr32.c) 49 zephyr_library_sources(${RADIO_DIR}/rail_lib/plugin/pa-conversions/pa_curves_efr32.c) 50 51 # prebuilt libs 52 add_prebuilt_library(librail platform/radio/rail_lib/autogen/librail_release/librail_efr32xg${GECKO_SERIES_NUMBER}_gcc_release.a) 53 54 if(CONFIG_SOC_GECKO_CUSTOM_RADIO_PHY) 55 zephyr_include_directories( 56 ${RADIO_DIR}/rail_lib/plugin/rail_util_init/config/proprietary 57 ${RADIO_DIR}/rail_lib/plugin/rail_util_callbacks 58 ${RADIO_DIR}/rail_lib/plugin/rail_util_callbacks/config 59 ${RADIO_DIR}/rail_lib/plugin/rail_util_protocol 60 ${RADIO_DIR}/rail_lib/plugin/rail_util_protocol/config/efr32xg${GECKO_SERIES_NUMBER}/ 61 ${RADIO_DIR}/rail_lib/protocol/ble 62 ${RADIO_DIR}/rail_lib/protocol/ieee802154 63 ${RADIO_DIR}/rail_lib/protocol/zwave 64 ) 65 zephyr_library_sources(${RADIO_DIR}/rail_lib/plugin/rail_util_protocol/sl_rail_util_protocol.c) 66 endif() 67 68 endif() 69endif() 70 71zephyr_include_directories( 72 ${DEVICE_DIR}/SiliconLabs/${SILABS_GECKO_DEVICE}/Include 73 ${COMMON_DIR}/inc 74 ${EMLIB_DIR}/inc 75 ${BOARD_DIR} 76) 77 78# The gecko SDK uses the cpu name to include the matching device header. 79# See Device/SiliconLabs/$(SILABS_GECKO_DEVICE)/Include/em_device.h for an example. 80zephyr_compile_definitions( 81 ${SILABS_GECKO_PART_NUMBER} 82) 83 84zephyr_library_sources( ${EMLIB_DIR}/src/em_system.c) 85zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_ADC ${EMLIB_DIR}/src/em_adc.c) 86zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_BURTC ${EMLIB_DIR}/src/em_burtc.c) 87zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_CMU ${EMLIB_DIR}/src/em_cmu.c) 88 89zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_CORE ${EMLIB_DIR}/src/em_core.c) 90zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_CRYOTIMER ${EMLIB_DIR}/src/em_cryotimer.c) 91zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_EMU ${EMLIB_DIR}/src/em_emu.c) 92zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_GPIO ${EMLIB_DIR}/src/em_gpio.c) 93zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_I2C ${EMLIB_DIR}/src/em_i2c.c) 94zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_LETIMER ${EMLIB_DIR}/src/em_letimer.c) 95zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_LEUART ${EMLIB_DIR}/src/em_leuart.c) 96zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_MSC ${EMLIB_DIR}/src/em_msc.c) 97zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_PRS ${EMLIB_DIR}/src/em_prs.c) 98zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_RMU ${EMLIB_DIR}/src/em_rmu.c) 99zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_RTC ${EMLIB_DIR}/src/em_rtc.c) 100zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_RTCC ${EMLIB_DIR}/src/em_rtcc.c) 101zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_TIMER ${EMLIB_DIR}/src/em_timer.c) 102zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_USART ${EMLIB_DIR}/src/em_usart.c) 103zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_WDOG ${EMLIB_DIR}/src/em_wdog.c) 104zephyr_library_sources_ifdef(CONFIG_SOC_SERIES_EFM32WG ${DEVICE_DIR}/SiliconLabs/EFM32WG/Source/system_efm32wg.c) 105zephyr_library_sources_ifdef(CONFIG_SOC_SERIES_EFR32BG13P ${DEVICE_DIR}/SiliconLabs/EFR32BG13P/Source/system_efr32bg13p.c) 106zephyr_library_sources_ifdef(CONFIG_SOC_SERIES_EFR32FG1P ${DEVICE_DIR}/SiliconLabs/EFR32FG1P/Source/system_efr32fg1p.c) 107zephyr_library_sources_ifdef(CONFIG_SOC_SERIES_EFR32FG13P ${DEVICE_DIR}/SiliconLabs/EFR32FG13P/Source/system_efr32fg13p.c) 108zephyr_library_sources_ifdef(CONFIG_SOC_SERIES_EFM32HG ${DEVICE_DIR}/SiliconLabs/EFM32HG/Source/system_efm32hg.c) 109zephyr_library_sources_ifdef(CONFIG_SOC_SERIES_EFR32MG12P ${DEVICE_DIR}/SiliconLabs/EFR32MG12P/Source/system_efr32mg12p.c) 110zephyr_library_sources_ifdef(CONFIG_SOC_SERIES_EFM32PG12B ${DEVICE_DIR}/SiliconLabs/EFM32PG12B/Source/system_efm32pg12b.c) 111zephyr_library_sources_ifdef(CONFIG_SOC_SERIES_EFM32GG11B ${DEVICE_DIR}/SiliconLabs/EFM32GG11B/Source/system_efm32gg11b.c) 112zephyr_library_sources_ifdef(CONFIG_SOC_SERIES_EFM32GG12B ${DEVICE_DIR}/SiliconLabs/EFM32GG12B/Source/system_efm32gg12b.c) 113zephyr_library_sources_ifdef(CONFIG_SOC_SERIES_EFM32JG12B ${DEVICE_DIR}/SiliconLabs/EFM32JG12B/Source/system_efm32jg12b.c) 114zephyr_library_sources_ifdef(CONFIG_SOC_SERIES_EFM32PG1B ${DEVICE_DIR}/SiliconLabs/EFM32PG1B/Source/system_efm32pg1b.c) 115