From 60462266e317b6fec000533bdf8e111d9bd6d574 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Mon, 21 Oct 2024 14:30:11 +0300 Subject: [PATCH] modules: hal_silabs: Move CMake and Kconfig to the main tree Move the CMakeLists.txt and Kconfig files from the hal_silabs tree under modules/hal_silabs in the main tree. This also includes all Zephyr shim code from the hal_silabs tree. Signed-off-by: Johan Hedberg --- MAINTAINERS.yml | 2 +- modules/Kconfig | 1 - modules/hal_silabs/CMakeLists.txt | 4 + .../{Kconfig.silabs => hal_silabs/Kconfig} | 0 modules/hal_silabs/gecko/CMakeLists.txt | 114 ++++++++++ modules/hal_silabs/si32/CMakeLists.txt | 13 ++ .../hal_silabs/simplicity_sdk/CMakeLists.txt | 205 ++++++++++++++++++ .../src/sl_memory_manager_shim.c | 31 +++ west.yml | 2 +- 9 files changed, 369 insertions(+), 3 deletions(-) create mode 100644 modules/hal_silabs/CMakeLists.txt rename modules/{Kconfig.silabs => hal_silabs/Kconfig} (100%) create mode 100644 modules/hal_silabs/gecko/CMakeLists.txt create mode 100644 modules/hal_silabs/si32/CMakeLists.txt create mode 100644 modules/hal_silabs/simplicity_sdk/CMakeLists.txt create mode 100644 modules/hal_silabs/simplicity_sdk/src/sl_memory_manager_shim.c diff --git a/MAINTAINERS.yml b/MAINTAINERS.yml index 5764d0f1f63..9ff972e9376 100644 --- a/MAINTAINERS.yml +++ b/MAINTAINERS.yml @@ -4815,7 +4815,7 @@ West: - mnkp - rettichschnidi files: - - modules/Kconfig.silabs + - modules/hal_silabs/ labels: - "platform: Silabs" diff --git a/modules/Kconfig b/modules/Kconfig index 21ccad7ff2f..7e0e2b2872d 100644 --- a/modules/Kconfig +++ b/modules/Kconfig @@ -30,7 +30,6 @@ source "modules/Kconfig.picolibc" source "modules/Kconfig.nxp_s32" source "modules/Kconfig.renesas_fsp" source "modules/Kconfig.rust" -source "modules/Kconfig.silabs" source "modules/Kconfig.simplelink" source "modules/Kconfig.sof" source "modules/Kconfig.stm32" diff --git a/modules/hal_silabs/CMakeLists.txt b/modules/hal_silabs/CMakeLists.txt new file mode 100644 index 00000000000..62d7ed54a15 --- /dev/null +++ b/modules/hal_silabs/CMakeLists.txt @@ -0,0 +1,4 @@ +add_subdirectory_ifdef(CONFIG_SOC_FAMILY_SILABS_S0 gecko) +add_subdirectory_ifdef(CONFIG_SOC_FAMILY_SILABS_S1 gecko) +add_subdirectory_ifdef(CONFIG_SOC_FAMILY_SILABS_S2 simplicity_sdk) +add_subdirectory_ifdef(CONFIG_HAS_SILABS_SI32 si32) diff --git a/modules/Kconfig.silabs b/modules/hal_silabs/Kconfig similarity index 100% rename from modules/Kconfig.silabs rename to modules/hal_silabs/Kconfig diff --git a/modules/hal_silabs/gecko/CMakeLists.txt b/modules/hal_silabs/gecko/CMakeLists.txt new file mode 100644 index 00000000000..acf8ead687d --- /dev/null +++ b/modules/hal_silabs/gecko/CMakeLists.txt @@ -0,0 +1,114 @@ +# Makefile - Gecko SDK +# +# Copyright (c) 2017, Christian Taedcke +# Copyright (c) 2021, Safran Passenger Innovations Germany GmbH +# Copyright (c) 2022, Antmicro +# +# SPDX-License-Identifier: Apache-2.0 +# + +set(EMLIB_DIR ${ZEPHYR_HAL_SILABS_MODULE_DIR}/gecko/emlib) +set(COMMON_DIR ${ZEPHYR_HAL_SILABS_MODULE_DIR}/gecko/common) +set(DEVICE_DIR ${ZEPHYR_HAL_SILABS_MODULE_DIR}/gecko/Device) +set(RADIO_DIR ${ZEPHYR_HAL_SILABS_MODULE_DIR}/gecko/platform/radio) +set(BLOBS_DIR ${ZEPHYR_HAL_SILABS_MODULE_DIR/zephyr/blobs}) + +# Translate the SoC name and part number into the gecko device and cpu name +# respectively. +string(TOUPPER ${CONFIG_SOC_SERIES} SILABS_GECKO_DEVICE) + +# Get SoC series number, i.e. translate e.g. efr32bg22 -> 22 +string(SUBSTRING ${CONFIG_SOC_SERIES} 7 2 GECKO_SERIES_NUMBER) + +set(SILABS_GECKO_PART_NUMBER ${CONFIG_SOC_PART_NUMBER}) + +function(add_prebuilt_library lib_name prebuilt_path) + add_library(${lib_name} STATIC IMPORTED GLOBAL) + set_target_properties(${lib_name} PROPERTIES + IMPORTED_LOCATION ${BLOBS_DIR}/${prebuilt_path} + ) + zephyr_link_libraries(${lib_name}) +endfunction() + +if(${CONFIG_SOC_GECKO_HAS_RADIO}) + if(${CONFIG_SOC_FAMILY_SILABS_S1}) + zephyr_include_directories( + ${RADIO_DIR}/rail_lib/plugin/pa-conversions/efr32xg1x/config + ${RADIO_DIR}/rail_lib/chip/efr32/efr32xg1x + ) + endif() + + zephyr_include_directories( + ${RADIO_DIR}/rail_lib/common + ${RADIO_DIR}/rail_lib/plugin/pa-conversions + ) + + if(CONFIG_SOC_GECKO_USE_RAIL) + # rail + zephyr_library_sources(${RADIO_DIR}/rail_lib/plugin/pa-conversions/pa_conversions_efr32.c) + zephyr_library_sources(${RADIO_DIR}/rail_lib/plugin/pa-conversions/pa_curves_efr32.c) + + # prebuilt libs + add_prebuilt_library(librail platform/radio/rail_lib/autogen/librail_release/librail_efr32xg${GECKO_SERIES_NUMBER}_gcc_release.a) + + if(CONFIG_SOC_GECKO_CUSTOM_RADIO_PHY) + zephyr_include_directories( + ${RADIO_DIR}/rail_lib/plugin/rail_util_init/config/proprietary + ${RADIO_DIR}/rail_lib/plugin/rail_util_callbacks + ${RADIO_DIR}/rail_lib/plugin/rail_util_callbacks/config + ${RADIO_DIR}/rail_lib/plugin/rail_util_protocol + ${RADIO_DIR}/rail_lib/plugin/rail_util_protocol/config/efr32xg${GECKO_SERIES_NUMBER}/ + ${RADIO_DIR}/rail_lib/protocol/ble + ${RADIO_DIR}/rail_lib/protocol/ieee802154 + ${RADIO_DIR}/rail_lib/protocol/zwave + ) + zephyr_library_sources(${RADIO_DIR}/rail_lib/plugin/rail_util_protocol/sl_rail_util_protocol.c) + endif() + + endif() +endif() + +zephyr_include_directories( + ${DEVICE_DIR}/SiliconLabs/${SILABS_GECKO_DEVICE}/Include + ${COMMON_DIR}/inc + ${EMLIB_DIR}/inc + ${BOARD_DIR} +) + +# The gecko SDK uses the cpu name to include the matching device header. +# See Device/SiliconLabs/$(SILABS_GECKO_DEVICE)/Include/em_device.h for an example. +zephyr_compile_definitions( + ${SILABS_GECKO_PART_NUMBER} +) + +zephyr_library_sources( ${EMLIB_DIR}/src/em_system.c) +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_ADC ${EMLIB_DIR}/src/em_adc.c) +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_BURTC ${EMLIB_DIR}/src/em_burtc.c) +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_CMU ${EMLIB_DIR}/src/em_cmu.c) + +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_CORE ${EMLIB_DIR}/src/em_core.c) +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_CRYOTIMER ${EMLIB_DIR}/src/em_cryotimer.c) +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_EMU ${EMLIB_DIR}/src/em_emu.c) +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_GPIO ${EMLIB_DIR}/src/em_gpio.c) +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_I2C ${EMLIB_DIR}/src/em_i2c.c) +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_LETIMER ${EMLIB_DIR}/src/em_letimer.c) +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_LEUART ${EMLIB_DIR}/src/em_leuart.c) +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_MSC ${EMLIB_DIR}/src/em_msc.c) +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_PRS ${EMLIB_DIR}/src/em_prs.c) +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_RMU ${EMLIB_DIR}/src/em_rmu.c) +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_RTC ${EMLIB_DIR}/src/em_rtc.c) +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_RTCC ${EMLIB_DIR}/src/em_rtcc.c) +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_TIMER ${EMLIB_DIR}/src/em_timer.c) +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_USART ${EMLIB_DIR}/src/em_usart.c) +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_WDOG ${EMLIB_DIR}/src/em_wdog.c) +zephyr_library_sources_ifdef(CONFIG_SOC_SERIES_EFM32WG ${DEVICE_DIR}/SiliconLabs/EFM32WG/Source/system_efm32wg.c) +zephyr_library_sources_ifdef(CONFIG_SOC_SERIES_EFR32BG13P ${DEVICE_DIR}/SiliconLabs/EFR32BG13P/Source/system_efr32bg13p.c) +zephyr_library_sources_ifdef(CONFIG_SOC_SERIES_EFR32FG1P ${DEVICE_DIR}/SiliconLabs/EFR32FG1P/Source/system_efr32fg1p.c) +zephyr_library_sources_ifdef(CONFIG_SOC_SERIES_EFR32FG13P ${DEVICE_DIR}/SiliconLabs/EFR32FG13P/Source/system_efr32fg13p.c) +zephyr_library_sources_ifdef(CONFIG_SOC_SERIES_EFM32HG ${DEVICE_DIR}/SiliconLabs/EFM32HG/Source/system_efm32hg.c) +zephyr_library_sources_ifdef(CONFIG_SOC_SERIES_EFR32MG12P ${DEVICE_DIR}/SiliconLabs/EFR32MG12P/Source/system_efr32mg12p.c) +zephyr_library_sources_ifdef(CONFIG_SOC_SERIES_EFM32PG12B ${DEVICE_DIR}/SiliconLabs/EFM32PG12B/Source/system_efm32pg12b.c) +zephyr_library_sources_ifdef(CONFIG_SOC_SERIES_EFM32GG11B ${DEVICE_DIR}/SiliconLabs/EFM32GG11B/Source/system_efm32gg11b.c) +zephyr_library_sources_ifdef(CONFIG_SOC_SERIES_EFM32GG12B ${DEVICE_DIR}/SiliconLabs/EFM32GG12B/Source/system_efm32gg12b.c) +zephyr_library_sources_ifdef(CONFIG_SOC_SERIES_EFM32JG12B ${DEVICE_DIR}/SiliconLabs/EFM32JG12B/Source/system_efm32jg12b.c) +zephyr_library_sources_ifdef(CONFIG_SOC_SERIES_EFM32PG1B ${DEVICE_DIR}/SiliconLabs/EFM32PG1B/Source/system_efm32pg1b.c) diff --git a/modules/hal_silabs/si32/CMakeLists.txt b/modules/hal_silabs/si32/CMakeLists.txt new file mode 100644 index 00000000000..e0ad957b673 --- /dev/null +++ b/modules/hal_silabs/si32/CMakeLists.txt @@ -0,0 +1,13 @@ +set(SI32_HAL_DIR ${ZEPHYR_HAL_SILABS_MODULE_DIR}/si32/si32Hal) + +zephyr_include_directories( + ${SI32_HAL_DIR}/sim3u1xx + ${SI32_HAL_DIR}/SI32_Modules +) + +if(CONFIG_SOC_SERIES_SIM3U) + zephyr_library_sources(${SI32_HAL_DIR}/sim3u1xx/SI32_PBCFG_A_Type.c) + zephyr_library_sources_ifdef(CONFIG_DMA ${SI32_HAL_DIR}/sim3u1xx/SI32_DMAXBAR_A_Type.c) + zephyr_library_sources_ifdef(CONFIG_DMA ${SI32_HAL_DIR}/SI32_Modules/SI32_DMADESC_A_Type.c) + zephyr_library_sources_ifdef(CONFIG_SPI ${SI32_HAL_DIR}/SI32_Modules/SI32_SPI_A_Type.c) +endif() diff --git a/modules/hal_silabs/simplicity_sdk/CMakeLists.txt b/modules/hal_silabs/simplicity_sdk/CMakeLists.txt new file mode 100644 index 00000000000..842d5383e83 --- /dev/null +++ b/modules/hal_silabs/simplicity_sdk/CMakeLists.txt @@ -0,0 +1,205 @@ +# CMake integration for Simplicity SDK +# +# Copyright (c) 2017, Christian Taedcke +# Copyright (c) 2021, Safran Passenger Innovations Germany GmbH +# Copyright (c) 2022, Antmicro +# Copyright (c) 2024, Silicon Laboratories Inc. +# +# SPDX-License-Identifier: Apache-2.0 + +set(EMLIB_DIR ${ZEPHYR_HAL_SILABS_MODULE_DIR}/simplicity_sdk/platform/emlib) +set(COMMON_DIR ${ZEPHYR_HAL_SILABS_MODULE_DIR}/simplicity_sdk/platform/common) +set(DEVICE_DIR ${ZEPHYR_HAL_SILABS_MODULE_DIR}/simplicity_sdk/platform/Device) +set(RADIO_DIR ${ZEPHYR_HAL_SILABS_MODULE_DIR}/simplicity_sdk/platform/radio) +set(SECURITY_DIR ${ZEPHYR_HAL_SILABS_MODULE_DIR}/simplicity_sdk/platform/security) +set(SERVICE_DIR ${ZEPHYR_HAL_SILABS_MODULE_DIR}/simplicity_sdk/platform/service) +set(PERIPHERAL_DIR ${ZEPHYR_HAL_SILABS_MODULE_DIR}/simplicity_sdk/platform/peripheral) +set(BLUETOOTH_DIR ${ZEPHYR_HAL_SILABS_MODULE_DIR}/simplicity_sdk/protocol/bluetooth) +set(BLOBS_DIR ${ZEPHYR_HAL_SILABS_MODULE_DIR}/zephyr/blobs/simplicity_sdk) + +# Translate the SoC name and part number into the gecko device and cpu name +# respectively. +string(TOUPPER ${CONFIG_SOC_SERIES} SILABS_DEVICE_FAMILY) + +# Get SoC series number, i.e. translate e.g. efr32bg22 -> 22 +string(SUBSTRING ${CONFIG_SOC_SERIES} 7 2 SILABS_DEVICE_FAMILY_NUMBER) + +set(SILABS_DEVICE_PART_NUMBER ${CONFIG_SOC_PART_NUMBER}) + +function(add_prebuilt_library lib_name prebuilt_path) + add_library(${lib_name} STATIC IMPORTED GLOBAL) + set_target_properties(${lib_name} PROPERTIES + IMPORTED_LOCATION ${BLOBS_DIR}/${prebuilt_path} + ) + zephyr_link_libraries(${lib_name}) +endfunction() + +if(CONFIG_SOC_GECKO_HAS_RADIO) + zephyr_include_directories_ifdef(CONFIG_SOC_FAMILY_SILABS_S2 + ${RADIO_DIR}/rail_lib/plugin/pa-conversions/efr32xg${SILABS_DEVICE_FAMILY_NUMBER}/config + ${RADIO_DIR}/rail_lib/chip/efr32/efr32xg2x + ) + + zephyr_include_directories( + ${RADIO_DIR}/rail_lib/common + ${RADIO_DIR}/rail_lib/plugin/pa-conversions + ${BLUETOOTH_DIR}/bgstack/ll/inc + ) + + # sl_protocol_crypto + zephyr_library_sources_ifdef(CONFIG_BT_SILABS_HCI + ${SECURITY_DIR}/sl_component/sl_protocol_crypto/src/sli_radioaes_management.c + ${SECURITY_DIR}/sl_component/sl_protocol_crypto/src/sli_protocol_crypto_radioaes.c + ) + + if(CONFIG_BT_SILABS_HCI) + # prebuilt libs + add_prebuilt_library(liblinklayer protocol/bluetooth/bgstack/ll/lib/libbluetooth_controller_efr32xg${SILABS_DEVICE_FAMILY_NUMBER}_gcc_release.a) + add_prebuilt_library(libbgcommon protocol/bluetooth/bgcommon/lib/build/gcc/cortex-m33/bgcommon/release/libbgcommon.a) + + # link mbedTLS + if(CONFIG_MBEDTLS) + zephyr_link_libraries(mbedTLS) + endif() + endif() + + if(CONFIG_SOC_GECKO_USE_RAIL) + # rail + zephyr_library_sources(${RADIO_DIR}/rail_lib/plugin/pa-conversions/pa_curves_efr32.c) + zephyr_library_sources(${RADIO_DIR}/rail_lib/plugin/pa-conversions/pa_conversions_efr32.c) + + # prebuilt libs + add_prebuilt_library(librail platform/radio/rail_lib/autogen/librail_release/librail_efr32xg${SILABS_DEVICE_FAMILY_NUMBER}_gcc_release.a) + + zephyr_include_directories_ifdef(CONFIG_SOC_GECKO_CUSTOM_RADIO_PHY + ${RADIO_DIR}/rail_lib/protocol/ble + ${RADIO_DIR}/rail_lib/protocol/ieee802154 + ${RADIO_DIR}/rail_lib/protocol/zwave + ${RADIO_DIR}/rail_lib/protocol/sidewalk + ${RADIO_DIR}/rail_lib/plugin/rail_util_protocol + ${RADIO_DIR}/rail_lib/plugin/rail_util_protocol/config/efr32xg${SILABS_DEVICE_FAMILY_NUMBER} + ) + zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_CUSTOM_RADIO_PHY + ${RADIO_DIR}/rail_lib/plugin/rail_util_protocol/sl_rail_util_protocol.c + ) + endif() +endif() + +zephyr_include_directories( + ${DEVICE_DIR}/SiliconLabs/${SILABS_DEVICE_FAMILY}/Include + ${COMMON_DIR}/config + ${COMMON_DIR}/inc + ${EMLIB_DIR}/inc + ${PERIPHERAL_DIR}/inc + ${SERVICE_DIR}/device_init/config/s2 + ${SERVICE_DIR}/device_init/config/s2/sdid${CONFIG_SOC_GECKO_SDID} + ${SERVICE_DIR}/clock_manager/inc + ${SERVICE_DIR}/device_init/inc + ${SERVICE_DIR}/device_manager/inc + ${SERVICE_DIR}/hfxo_manager/config + ${SERVICE_DIR}/hfxo_manager/inc + ${SERVICE_DIR}/hfxo_manager/src + ${SERVICE_DIR}/memory_manager/inc + ${SERVICE_DIR}/memory_manager/profiler/inc + ${SERVICE_DIR}/power_manager/config + ${SERVICE_DIR}/power_manager/inc + ${SERVICE_DIR}/power_manager/src + ${SERVICE_DIR}/sleeptimer/config + ${SERVICE_DIR}/sleeptimer/inc + ${SERVICE_DIR}/sleeptimer/src + ${SECURITY_DIR}/sl_component/sl_protocol_crypto/src + ${BOARD_DIR} +) + +zephyr_compile_definitions( + ${SILABS_DEVICE_PART_NUMBER} +) + +zephyr_compile_definitions_ifdef(CONFIG_SOC_GECKO_DEV_INIT + SL_CATALOG_POWER_MANAGER_PRESENT + SL_CATALOG_HFXO_MANAGER_PRESENT +) + +zephyr_compile_options( + -mcmse # Cortex-M Security Extensions are needed for startup code +) + +zephyr_library_sources( + ${DEVICE_DIR}/SiliconLabs/${SILABS_DEVICE_FAMILY}/Source/system_${CONFIG_SOC_SERIES}.c + ${EMLIB_DIR}/src/em_system.c + ${SERVICE_DIR}/clock_manager/src/sl_clock_manager.c + ${SERVICE_DIR}/clock_manager/src/sl_clock_manager_hal_s2.c + ${SERVICE_DIR}/device_manager/devices/sl_device_peripheral_hal_efr32xg${SILABS_DEVICE_FAMILY_NUMBER}.c + ${SERVICE_DIR}/device_manager/gpios/sl_device_gpio_common.c + ${SERVICE_DIR}/device_manager/src/sl_device_clock.c + ${SERVICE_DIR}/device_manager/src/sl_device_gpio.c + ${SERVICE_DIR}/device_manager/src/sl_device_peripheral.c +) + +if(NOT SILABS_DEVICE_FAMILY_NUMBER EQUAL "21") + zephyr_library_sources( + ${SERVICE_DIR}/device_manager/clocks/sl_device_clock_efr32xg${SILABS_DEVICE_FAMILY_NUMBER}.c + ) +endif() + +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_IADC ${EMLIB_DIR}/src/em_iadc.c) +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_BURTC ${EMLIB_DIR}/src/em_burtc.c) +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_CMU ${EMLIB_DIR}/src/em_cmu.c) + +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_DEV_INIT + ${SERVICE_DIR}/device_init/src/sl_device_init_dcdc_s2.c + ${SERVICE_DIR}/device_init/src/sl_device_init_dpll_s2.c + ${SERVICE_DIR}/device_init/src/sl_device_init_hfrco.c + ${SERVICE_DIR}/device_init/src/sl_device_init_hfxo_s2.c + ${SERVICE_DIR}/device_init/src/sl_device_init_nvic.c + ${SERVICE_DIR}/power_manager/src/sl_power_manager.c + ${SERVICE_DIR}/power_manager/src/sl_power_manager_hal_s2.c + ${SERVICE_DIR}/hfxo_manager/src/sl_hfxo_manager.c + ${SERVICE_DIR}/hfxo_manager/src/sl_hfxo_manager_hal_s2.c + ${SERVICE_DIR}/memory_manager/profiler/src/sli_memory_profiler_stubs.c +) + +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_DEV_INIT ${COMMON_DIR}/src/sl_slist.c) +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_CORE + ${EMLIB_DIR}/src/em_core.c + ${COMMON_DIR}/src/sl_core_cortexm.c +) +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_CRYOTIMER ${EMLIB_DIR}/src/em_cryotimer.c) +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_EMU ${EMLIB_DIR}/src/em_emu.c) +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_GPIO ${EMLIB_DIR}/src/em_gpio.c) +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_I2C ${EMLIB_DIR}/src/em_i2c.c) +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_LETIMER ${EMLIB_DIR}/src/em_letimer.c) +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_LEUART ${EMLIB_DIR}/src/em_leuart.c) +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_MSC ${EMLIB_DIR}/src/em_msc.c) +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_PRS ${EMLIB_DIR}/src/em_prs.c) +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_RMU ${EMLIB_DIR}/src/em_rmu.c) +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_RTC ${EMLIB_DIR}/src/em_rtc.c) +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_RTCC ${EMLIB_DIR}/src/em_rtcc.c) +zephyr_library_sources_ifdef(CONFIG_COUNTER_GECKO_STIMER + ${PERIPHERAL_DIR}/src/sl_hal_sysrtc.c + ${SERVICE_DIR}/sleeptimer/src/sl_sleeptimer_hal_rtcc.c + ${SERVICE_DIR}/sleeptimer/src/sl_sleeptimer_hal_sysrtc.c + ${SERVICE_DIR}/sleeptimer/src/sl_sleeptimer.c +) +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_EUSART ${EMLIB_DIR}/src/em_eusart.c) +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_TIMER ${EMLIB_DIR}/src/em_timer.c) +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_USART ${EMLIB_DIR}/src/em_usart.c) +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_WDOG ${EMLIB_DIR}/src/em_wdog.c) + +zephyr_include_directories_ifdef(CONFIG_SOC_GECKO_SE + ${SECURITY_DIR}/sl_component/se_manager/src + ${SECURITY_DIR}/sl_component/se_manager/inc +) + +zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_SE + ${EMLIB_DIR}/src/em_se.c + ${SECURITY_DIR}/sl_component/se_manager/src/sl_se_manager.c + ${SECURITY_DIR}/sl_component/se_manager/src/sl_se_manager_util.c + ${SECURITY_DIR}/sl_component/se_manager/src/sli_se_manager_mailbox.c +) + +zephyr_library_sources_ifdef(CONFIG_ENTROPY_GECKO_SE + ${SECURITY_DIR}/sl_component/se_manager/src/sl_se_manager_entropy.c +) + +zephyr_library_sources(src/sl_memory_manager_shim.c) diff --git a/modules/hal_silabs/simplicity_sdk/src/sl_memory_manager_shim.c b/modules/hal_silabs/simplicity_sdk/src/sl_memory_manager_shim.c new file mode 100644 index 00000000000..d08ccd61d3d --- /dev/null +++ b/modules/hal_silabs/simplicity_sdk/src/sl_memory_manager_shim.c @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2024 Silicon Laboratories Inc. + * + * SPDX-License-Identifier: Apache-2.0 + * + * Shim basic sl_* allocation functions to libc malloc, which again + * will get redirected to the Zephyr sys_heap. + */ + +#include "sl_memory_manager.h" +#include + +void *sl_malloc(size_t size) +{ + return malloc(size); +} + +void sl_free(void *ptr) +{ + free(ptr); +} + +void *sl_calloc(size_t item_count, size_t size) +{ + return calloc(item_count, size); +} + +void *sl_realloc(void *ptr, size_t size) +{ + return realloc(ptr, size); +} diff --git a/west.yml b/west.yml index f1146918cd9..626c14ab507 100644 --- a/west.yml +++ b/west.yml @@ -223,7 +223,7 @@ manifest: groups: - hal - name: hal_silabs - revision: d07d744a933bada3a87377dc46241960f620011f + revision: 5c7a7834a6df7882518a2da127f950d80987dfcb path: modules/hal/silabs groups: - hal