Skip to content

Commit

Permalink
modules: hal_silabs: Update HAL version
Browse files Browse the repository at this point in the history
Update HAL to Simplicity SDK 2024.12.

Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
  • Loading branch information
asmellby committed Jan 13, 2025
1 parent 5faf471 commit 8d6fe1e
Show file tree
Hide file tree
Showing 6 changed files with 174 additions and 13 deletions.
63 changes: 51 additions & 12 deletions modules/hal_silabs/simplicity_sdk/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
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(DRIVER_DIR ${ZEPHYR_HAL_SILABS_MODULE_DIR}/simplicity_sdk/platform/driver)
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)
Expand Down Expand Up @@ -52,12 +53,14 @@ if(CONFIG_SOC_GECKO_HAS_RADIO)
zephyr_library_sources_ifdef(CONFIG_BT_SILABS_EFR32
${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
${SECURITY_DIR}/sl_component/sli_crypto/src/sl_crypto_s2.c
)

if(CONFIG_BT_SILABS_EFR32)
# prebuilt libs
add_prebuilt_library(liblinklayer protocol/bluetooth/bgstack/ll/lib/libbluetooth_controller_efr32xg${SILABS_DEVICE_FAMILY_NUMBER}_gcc_release.a)
add_prebuilt_library(liblinklayer protocol/bluetooth/bgstack/ll/build/gcc/xg${SILABS_DEVICE_FAMILY_NUMBER}/release/liblinklayer.a)
add_prebuilt_library(libbgcommon protocol/bluetooth/bgcommon/lib/build/gcc/cortex-m33/bgcommon/release/libbgcommon.a)
zephyr_library_sources(src/sl_btctrl_hci_reset_shim.c)

# link mbedTLS
if(CONFIG_MBEDTLS)
Expand Down Expand Up @@ -92,6 +95,7 @@ zephyr_include_directories(
${DEVICE_DIR}/SiliconLabs/${SILABS_DEVICE_FAMILY}/Include
${COMMON_DIR}/config
${COMMON_DIR}/inc
${DRIVER_DIR}/gpio/inc
${EMLIB_DIR}/inc
${PERIPHERAL_DIR}/inc
${SERVICE_DIR}/clock_manager/inc
Expand All @@ -100,20 +104,25 @@ zephyr_include_directories(
${SERVICE_DIR}/hfxo_manager/config
${SERVICE_DIR}/hfxo_manager/inc
${SERVICE_DIR}/hfxo_manager/src
${SERVICE_DIR}/interrupt_manager/inc
${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
${SECURITY_DIR}/sl_component/sli_crypto/inc
${BOARD_DIR}
)

zephyr_compile_definitions(
${SILABS_DEVICE_PART_NUMBER}
SL_CODE_COMPONENT_CLOCK_MANAGER=clock_manager
SL_CODE_COMPONENT_DEVICE_PERIPHERAL=peripheral
SL_CODE_COMPONENT_HAL_COMMON=hal_common
SL_CODE_COMPONENT_SYSTEM=system
)

zephyr_library_sources(
Expand All @@ -124,7 +133,6 @@ zephyr_library_sources(
${SERVICE_DIR}/clock_manager/src/sl_clock_manager_init.c
${SERVICE_DIR}/clock_manager/src/sl_clock_manager_init_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
Expand All @@ -147,6 +155,8 @@ if(CONFIG_SOC_SILABS_SLEEPTIMER)
)
zephyr_compile_definitions(
SL_CATALOG_SLEEPTIMER_PRESENT
SL_CODE_COMPONENT_SLEEPTIMER=sleeptimer
SL_CODE_COMPONENT_HAL_SYSRTC=hal_sysrtc
)
endif()

Expand All @@ -164,11 +174,14 @@ endif()
# Power Manager
if(CONFIG_SOC_GECKO_PM_BACKEND_PMGR)
zephyr_library_sources(
${SERVICE_DIR}/power_manager/src/sl_power_manager.c
${SERVICE_DIR}/power_manager/src/sl_power_manager_hal_s2.c
${SERVICE_DIR}/power_manager/src/common/sl_power_manager_common.c
${SERVICE_DIR}/power_manager/src/common/sl_power_manager_em4.c
${SERVICE_DIR}/power_manager/src/sleep_loop/sl_power_manager.c
${SERVICE_DIR}/power_manager/src/sleep_loop/sl_power_manager_hal_s2.c
)
zephyr_compile_definitions(
SL_CATALOG_POWER_MANAGER_PRESENT
SL_CODE_COMPONENT_POWER_MANAGER=power_manager
)
zephyr_compile_definitions_ifdef(CONFIG_SOC_GECKO_RTCC
SL_CATALOG_POWER_MANAGER_DEEPSLEEP_BLOCKING_HFXO_RESTORE_PRESENT
Expand All @@ -187,13 +200,28 @@ if(CONFIG_SOC_SILABS_HFXO_MANAGER)
endif()

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
)
if(CONFIG_SOC_GECKO_CORE)
zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_CORE
${EMLIB_DIR}/src/em_core.c
${COMMON_DIR}/src/sl_core_cortexm.c
)
zephyr_compile_definitions(
SL_CODE_COMPONENT_CORE=core
)
endif()
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)
if(CONFIG_SOC_GECKO_GPIO)
zephyr_library_sources(
${EMLIB_DIR}/src/em_gpio.c
${DRIVER_DIR}/gpio/src/sl_gpio.c
${PERIPHERAL_DIR}/src/sl_hal_gpio.c
)
zephyr_library_compile_definitions(
SL_CATALOG_GPIO_PRESENT
SL_CODE_COMPONENT_HAL_GPIO=hal_gpio
)
endif()
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)
Expand All @@ -211,22 +239,33 @@ zephyr_library_sources_ifdef(CONFIG_SOC_GECKO_WDOG ${EMLIB_DIR}/src/em_w
zephyr_include_directories_ifdef(CONFIG_SOC_GECKO_SE
${SECURITY_DIR}/sl_component/se_manager/src
${SECURITY_DIR}/sl_component/se_manager/inc
${SECURITY_DIR}/sl_component/sli_psec_osal/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_compile_definitions_ifdef(CONFIG_SOC_GECKO_SE
SL_CODE_COMPONENT_SE_MANAGER=se_manager
SL_CODE_COMPONENT_PSEC_OSAL=psec_osal
)

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)
zephyr_library_sources(
src/sl_interrupt_manager_shim.c
src/sl_memory_manager_shim.c
)

zephyr_library_sources_ifdef(
CONFIG_BUILD_ONLY_NO_BLOBS
src/blob_stubs.c
)

zephyr_linker_sources(ROM_SECTIONS linker/code_classification_text.ld)
zephyr_linker_sources(RAMFUNC_SECTION linker/code_classification_ramfunc.ld)
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
* Copyright (c) 2025 Silicon Laboratories Inc.
*
* SPDX-License-Identifier: Apache-2.0
*
* Place data annotated as ramfunc into the Zephyr .ramfunc section.
*/

*(text_application_ram)
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* Copyright (c) 2025 Silicon Laboratories Inc.
*
* SPDX-License-Identifier: Apache-2.0
*
* Place text sections tagged with Silicon Labs code classification annotations into flash.
*/

SECTION_PROLOGUE(.cc_text,,)
{
_cc_text_start = .;
*(SORT_BY_ALIGNMENT(text_*[0-9]))
_cc_text_end = .;
} GROUP_LINK_IN(ROMABLE_REGION)
_cc_text_size = _cc_text_end - _cc_text_start;
26 changes: 26 additions & 0 deletions modules/hal_silabs/simplicity_sdk/src/sl_btctrl_hci_reset_shim.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Copyright (c) 2025 Silicon Laboratories Inc.
*
* SPDX-License-Identifier: Apache-2.0
*
* Shim for sl_btctrl_hci_reset API
*/

#include <stdbool.h>

bool sl_btctrl_hci_reset_reason_is_sys_reset(void)
{
/* If this function returns true, the LL will emit command complete for HCI Reset during
* init. This only makes sense when the LL runs on a separate device from the host stack.
* Always return false.
*/
return false;
}

void sl_btctrl_hci_reset(void)
{
/* This function works as a callback during processing of the HCI Reset command, and allows
* for custom processing (such as fully resetting the device). This only makes sense when
* the LL runs on a separate device from the host stack. Do nothing.
*/
}
72 changes: 72 additions & 0 deletions modules/hal_silabs/simplicity_sdk/src/sl_interrupt_manager_shim.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/*
* Copyright (c) 2025 Silicon Laboratories Inc.
*
* SPDX-License-Identifier: Apache-2.0
*
* Shim for sl_interrupt_manager API using Zephyr API
*/

#include <zephyr/kernel.h>

#include "sl_interrupt_manager.h"

#define LOCK_KEY_DEFAULT 0xFFFFFFFFU

static unsigned int lock_key = LOCK_KEY_DEFAULT;

void sl_interrupt_manager_disable_interrupts(void)
{
__ASSERT(lock_key == LOCK_KEY_DEFAULT, "Interrupt manager doesn't support nested disable");
lock_key = irq_lock();
}

void sl_interrupt_manager_enable_interrupts(void)
{
irq_unlock(lock_key);
lock_key = LOCK_KEY_DEFAULT;
}

void sl_interrupt_manager_disable_irq(int32_t irqn)
{
irq_disable(irqn);
}

void sl_interrupt_manager_enable_irq(int32_t irqn)
{
irq_enable(irqn);
}

bool sl_interrupt_manager_is_irq_disabled(int32_t irqn)
{
return !irq_is_enabled(irqn);
}

bool sl_interrupt_manager_is_irq_pending(int32_t irqn)
{
return NVIC_GetPendingIRQ(irqn);
}

void sl_interrupt_manager_set_irq_pending(int32_t irqn)
{
NVIC_SetPendingIRQ(irqn);
}

void sl_interrupt_manager_clear_irq_pending(int32_t irqn)
{
NVIC_ClearPendingIRQ(irqn);
}

uint32_t sl_interrupt_manager_get_irq_priority(int32_t irqn)
{
return NVIC_GetPriority(irqn);
}

void sl_interrupt_manager_set_irq_priority(int32_t irqn, uint32_t priority)
{
NVIC_SetPriority(irqn, priority);
}

uint32_t sl_interrupt_manager_get_active_irq(int32_t irqn)
{
return NVIC_GetActive(irqn);
}
2 changes: 1 addition & 1 deletion west.yml
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ manifest:
groups:
- hal
- name: hal_silabs
revision: 6371fa823663b11090b0b30561a8b9196d4ef981
revision: 220aac68ab8abaf5b0cf157ddb590a326f656e50
path: modules/hal/silabs
groups:
- hal
Expand Down

0 comments on commit 8d6fe1e

Please sign in to comment.