diff --git a/examples/lighting-app/silabs/efr32/BUILD.gn b/examples/lighting-app/silabs/efr32/BUILD.gn index fdcadf1feb5732..dcda82dc8d9dea 100644 --- a/examples/lighting-app/silabs/efr32/BUILD.gn +++ b/examples/lighting-app/silabs/efr32/BUILD.gn @@ -91,7 +91,8 @@ if (chip_enable_wifi) { # ThunderBoards, Explorer Kit and MGM240L do not support LCD (No LCD) if (silabs_board == "BRD4166A" || silabs_board == "BRD2601B" || - silabs_board == "BRD2703A" || silabs_board == "BRD4319A") { + silabs_board == "BRD2703A" || silabs_board == "BRD4319A" || + silabs_board == "BRD2704A") { show_qr_code = false disable_lcd = true } @@ -208,6 +209,10 @@ efr32_executable("lighting_app") { include_dirs = [ "include" ] defines = [] + if (silabs_board == "BRD2704A") { + defines += [ "SL_STATUS_LED=0" ] + } + sources = [ "${examples_common_plat_dir}/heap_4_silabs.c", "${examples_plat_dir}/BaseApplication.cpp", diff --git a/examples/lighting-app/silabs/efr32/include/AppTask.h b/examples/lighting-app/silabs/efr32/include/AppTask.h index df80995592fd95..cc76b02e8b293d 100644 --- a/examples/lighting-app/silabs/efr32/include/AppTask.h +++ b/examples/lighting-app/silabs/efr32/include/AppTask.h @@ -30,7 +30,9 @@ #include "BaseApplication.h" #include "FreeRTOS.h" #include "LightingManager.h" +#ifdef SL_CATALOG_SIMPLE_BUTTON_PRESENT #include "sl_simple_button_instances.h" +#endif #include "timers.h" // provides FreeRTOS timer support #include #include @@ -69,7 +71,7 @@ class AppTask : public BaseApplication static void AppTaskMain(void * pvParameter); CHIP_ERROR StartAppTask(); - +#ifdef SL_CATALOG_SIMPLE_BUTTON_PRESENT /** * @brief Event handler when a button is pressed * Function posts an event for button processing @@ -79,7 +81,7 @@ class AppTask : public BaseApplication * SL_SIMPLE_BUTTON_RELEASED or SL_SIMPLE_BUTTON_DISABLED */ void ButtonEventHandler(const sl_button_t * buttonHandle, uint8_t btnAction) override; - +#endif /** * @brief Callback called by the identify-server when an identify command is received * diff --git a/examples/lighting-app/silabs/efr32/src/AppTask.cpp b/examples/lighting-app/silabs/efr32/src/AppTask.cpp index ccd77060e755d1..e061e40099cb38 100644 --- a/examples/lighting-app/silabs/efr32/src/AppTask.cpp +++ b/examples/lighting-app/silabs/efr32/src/AppTask.cpp @@ -44,12 +44,18 @@ #include #ifdef ENABLE_WSTK_LEDS -#define SYSTEM_STATE_LED &sl_led_led0 +#if SL_STATUS_LED #define LIGHT_LED &sl_led_led1 +#else +#define LIGHT_LED &sl_led_led0 +#endif #endif // ENABLE_WSTK_LEDS +#ifdef SL_CATALOG_SIMPLE_BUTTON_PRESENT + #define APP_FUNCTION_BUTTON &sl_button_btn0 #define APP_LIGHT_SWITCH &sl_button_btn1 +#endif using namespace chip; using namespace ::chip::DeviceLayer; @@ -225,11 +231,13 @@ void AppTask::LightActionEventHandler(AppEvent * aEvent) action = static_cast(aEvent->LightEvent.Action); actor = aEvent->LightEvent.Actor; } +#ifdef SL_CATALOG_SIMPLE_BUTTON_PRESENT else if (aEvent->Type == AppEvent::kEventType_Button) { action = (LightMgr().IsLightOn()) ? LightingManager::OFF_ACTION : LightingManager::ON_ACTION; actor = AppEvent::kEventType_Button; } +#endif else { err = APP_ERROR_UNHANDLED_EVENT; @@ -245,7 +253,7 @@ void AppTask::LightActionEventHandler(AppEvent * aEvent) } } } - +#ifdef SL_CATALOG_SIMPLE_BUTTON_PRESENT void AppTask::ButtonEventHandler(const sl_button_t * buttonHandle, uint8_t btnAction) { if (buttonHandle == NULL) @@ -269,6 +277,8 @@ void AppTask::ButtonEventHandler(const sl_button_t * buttonHandle, uint8_t btnAc } } +#endif + void AppTask::ActionInitiated(LightingManager::Action_t aAction, int32_t aActor) { // Action initiated, update the light led @@ -282,11 +292,12 @@ void AppTask::ActionInitiated(LightingManager::Action_t aAction, int32_t aActor) #ifdef DISPLAY_ENABLED sAppTask.GetLCD().WriteDemoUI(lightOn); #endif - +#ifdef SL_CATALOG_SIMPLE_BUTTON_PRESENT if (aActor == AppEvent::kEventType_Button) { sAppTask.mSyncClusterToButtonAction = true; } +#endif } void AppTask::ActionCompleted(LightingManager::Action_t aAction) @@ -300,12 +311,13 @@ void AppTask::ActionCompleted(LightingManager::Action_t aAction) { SILABS_LOG("Light OFF") } - +#ifdef SL_CATALOG_SIMPLE_BUTTON_PRESENT if (sAppTask.mSyncClusterToButtonAction) { chip::DeviceLayer::PlatformMgr().ScheduleWork(UpdateClusterState, reinterpret_cast(nullptr)); sAppTask.mSyncClusterToButtonAction = false; } +#endif } void AppTask::PostLightActionRequest(int32_t aActor, LightingManager::Action_t aAction) diff --git a/examples/lighting-app/silabs/efr32/src/main.cpp b/examples/lighting-app/silabs/efr32/src/main.cpp index 2594f6f9216e78..9f447b972678b6 100644 --- a/examples/lighting-app/silabs/efr32/src/main.cpp +++ b/examples/lighting-app/silabs/efr32/src/main.cpp @@ -21,7 +21,9 @@ #include "AppConfig.h" #include "init_efrPlatform.h" +#ifdef SL_CATALOG_SIMPLE_BUTTON_PRESENT #include "sl_simple_button_instances.h" +#endif #include "sl_system_kernel.h" #include #include @@ -78,7 +80,9 @@ int main(void) appError(CHIP_ERROR_INTERNAL); } +#ifdef SL_CATALOG_SIMPLE_BUTTON_PRESENT void sl_button_on_change(const sl_button_t * handle) { AppTask::GetAppTask().ButtonEventHandler(handle, sl_button_get_state(handle)); } +#endif diff --git a/examples/platform/silabs/efr32/BaseApplication.cpp b/examples/platform/silabs/efr32/BaseApplication.cpp index a9ecfc63bb0c60..6dc133e3330b3f 100644 --- a/examples/platform/silabs/efr32/BaseApplication.cpp +++ b/examples/platform/silabs/efr32/BaseApplication.cpp @@ -25,7 +25,7 @@ #include "AppEvent.h" #include "AppTask.h" -#ifdef ENABLE_WSTK_LEDS +#if defined(ENABLE_WSTK_LEDS) && SL_STATUS_LED #include "LEDWidget.h" #include "sl_simple_led_instances.h" #endif // ENABLE_WSTK_LEDS @@ -74,11 +74,12 @@ #define APP_EVENT_QUEUE_SIZE 10 #define EXAMPLE_VENDOR_ID 0xcafe -#ifdef ENABLE_WSTK_LEDS +#if defined(ENABLE_WSTK_LEDS) && SL_STATUS_LED #define SYSTEM_STATE_LED &sl_led_led0 #endif // ENABLE_WSTK_LEDS - +#ifdef SL_CATALOG_SIMPLE_BUTTON_PRESENT #define APP_FUNCTION_BUTTON &sl_button_btn0 +#endif using namespace chip; using namespace ::chip::DeviceLayer; @@ -95,7 +96,7 @@ TimerHandle_t sLightTimer; TaskHandle_t sAppTaskHandle; QueueHandle_t sAppEventQueue; -#ifdef ENABLE_WSTK_LEDS +#if defined(ENABLE_WSTK_LEDS) && SL_STATUS_LED LEDWidget sStatusLED; #endif // ENABLE_WSTK_LEDS @@ -211,7 +212,7 @@ CHIP_ERROR BaseApplication::Init(Identify * identifyObj) SILABS_LOG("Current Software Version: %s", CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING); -#ifdef ENABLE_WSTK_LEDS +#if defined(ENABLE_WSTK_LEDS) && SL_STATUS_LED LEDWidget::InitGpio(); sStatusLED.Init(SYSTEM_STATE_LED); #endif // ENABLE_WSTK_LEDS @@ -272,7 +273,7 @@ void BaseApplication::FunctionEventHandler(AppEvent * aEvent) mFunction = kFunction_FactoryReset; -#ifdef ENABLE_WSTK_LEDS +#if defined(ENABLE_WSTK_LEDS) && SL_STATUS_LED // Turn off all LEDs before starting blink to make sure blink is // co-ordinated. sStatusLED.Set(false); @@ -333,7 +334,7 @@ void BaseApplication::LightEventHandler() { if ((gIdentifyptr != nullptr) && (gIdentifyptr->mActive)) { -#ifdef ENABLE_WSTK_LEDS +#if defined(ENABLE_WSTK_LEDS) && SL_STATUS_LED sStatusLED.Blink(250, 250); #endif // ENABLE_WSTK_LEDS } @@ -341,19 +342,19 @@ void BaseApplication::LightEventHandler() { if (sIdentifyEffect == EMBER_ZCL_IDENTIFY_EFFECT_IDENTIFIER_BLINK) { -#ifdef ENABLE_WSTK_LEDS +#if defined(ENABLE_WSTK_LEDS) && SL_STATUS_LED sStatusLED.Blink(50, 50); #endif // ENABLE_WSTK_LEDS } if (sIdentifyEffect == EMBER_ZCL_IDENTIFY_EFFECT_IDENTIFIER_BREATHE) { -#ifdef ENABLE_WSTK_LEDS +#if defined(ENABLE_WSTK_LEDS) && SL_STATUS_LED sStatusLED.Blink(1000, 1000); #endif // ENABLE_WSTK_LEDS } if (sIdentifyEffect == EMBER_ZCL_IDENTIFY_EFFECT_IDENTIFIER_OKAY) { -#ifdef ENABLE_WSTK_LEDS +#if defined(ENABLE_WSTK_LEDS) && SL_STATUS_LED sStatusLED.Blink(300, 700); #endif // ENABLE_WSTK_LEDS } @@ -363,37 +364,37 @@ void BaseApplication::LightEventHandler() { if (sIsAttached) { -#ifdef ENABLE_WSTK_LEDS +#if defined(ENABLE_WSTK_LEDS) && SL_STATUS_LED sStatusLED.Set(true); #endif // ENABLE_WSTK_LEDS } else { -#ifdef ENABLE_WSTK_LEDS +#if defined(ENABLE_WSTK_LEDS) && SL_STATUS_LED sStatusLED.Blink(950, 50); #endif } } else if (sHaveBLEConnections) { -#ifdef ENABLE_WSTK_LEDS +#if defined(ENABLE_WSTK_LEDS) && SL_STATUS_LED sStatusLED.Blink(100, 100); #endif // ENABLE_WSTK_LEDS } else { -#ifdef ENABLE_WSTK_LEDS +#if defined(ENABLE_WSTK_LEDS) && SL_STATUS_LED sStatusLED.Blink(50, 950); #endif // ENABLE_WSTK_LEDS } #endif // CHIP_DEVICE_CONFIG_ENABLE_SED } -#ifdef ENABLE_WSTK_LEDS +#if defined(ENABLE_WSTK_LEDS) && SL_STATUS_LED sStatusLED.Animate(); #endif // ENABLE_WSTK_LEDS } - +#ifdef SL_CATALOG_SIMPLE_BUTTON_PRESENT void BaseApplication::ButtonHandler(AppEvent * aEvent) { // To trigger software update: press the APP_FUNCTION_BUTTON button briefly (< @@ -440,7 +441,10 @@ void BaseApplication::ButtonHandler(AppEvent * aEvent) SILABS_LOG("Failed to open the Basic Commissioning Window"); } } - else { SILABS_LOG("Network is already provisioned, Ble advertissement not enabled"); } + else + { + SILABS_LOG("Network is already provisioned, Ble advertissement not enabled"); + } } else if (mFunctionTimerActive && mFunction == kFunction_FactoryReset) { @@ -457,7 +461,7 @@ void BaseApplication::ButtonHandler(AppEvent * aEvent) } } } - +#endif void BaseApplication::CancelFunctionTimer() { if (xTimerStop(sFunctionTimer, 0) == pdFAIL) @@ -500,7 +504,7 @@ void BaseApplication::StartStatusLEDTimer() void BaseApplication::StopStatusLEDTimer() { -#ifdef ENABLE_WSTK_LEDS +#if defined(ENABLE_WSTK_LEDS) && SL_STATUS_LED sStatusLED.Set(false); #endif // ENABLE_WSTK_LEDS diff --git a/examples/platform/silabs/efr32/BaseApplication.h b/examples/platform/silabs/efr32/BaseApplication.h index febd7aa68591b2..f8372661bf4b14 100644 --- a/examples/platform/silabs/efr32/BaseApplication.h +++ b/examples/platform/silabs/efr32/BaseApplication.h @@ -28,7 +28,9 @@ #include "AppEvent.h" #include "FreeRTOS.h" +#ifdef SL_CATALOG_SIMPLE_BUTTON_PRESENT #include "sl_simple_button_instances.h" +#endif #include "timers.h" // provides FreeRTOS timer support #include #include @@ -43,6 +45,10 @@ #endif // QR_CODE_ENABLED #endif // DISPLAY_ENABLED +#ifndef SL_STATUS_LED +#define SL_STATUS_LED 1 +#endif + /********************************************************** * Defines *********************************************************/ @@ -87,7 +93,7 @@ class BaseApplication */ static SilabsLCD & GetLCD(void); #endif - +#ifdef SL_CATALOG_SIMPLE_BUTTON_PRESENT /** * @brief Event handler when a button is pressed * Function posts an event for button processing @@ -98,6 +104,8 @@ class BaseApplication */ virtual void ButtonEventHandler(const sl_button_t * buttonHandle, uint8_t btnAction) = 0; +#endif + /** * @brief Function called to start the LED light timer */ @@ -156,7 +164,7 @@ class BaseApplication * @param aEvent post event being processed */ static void FunctionEventHandler(AppEvent * aEvent); - +#ifdef SL_CATALOG_SIMPLE_BUTTON_PRESENT /** * @brief PB0 Button event processing function * Press and hold will trigger a factory reset timer start @@ -165,7 +173,7 @@ class BaseApplication * @param aEvent button event being processed */ static void ButtonHandler(AppEvent * aEvent); - +#endif /** * @brief Light Timer finished callback function * Calls LED processing function diff --git a/examples/platform/silabs/efr32/init_efrPlatform.cpp b/examples/platform/silabs/efr32/init_efrPlatform.cpp index 993b4fefe069f8..fcb7be1b1bc76e 100644 --- a/examples/platform/silabs/efr32/init_efrPlatform.cpp +++ b/examples/platform/silabs/efr32/init_efrPlatform.cpp @@ -45,6 +45,7 @@ extern "C" { #include #include "platform-efr32.h" +#include "sl_openthread.h" #if OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE #include "openthread/heap.h" @@ -65,7 +66,16 @@ void initAntenna(void); void init_efrPlatform(void) { sl_system_init(); - sl_mbedtls_init(); + +#if CHIP_ENABLE_OPENTHREAD +#ifdef MGM24 + sl_openthread_init(); +#endif + efr32RadioInit(); + efr32AlarmInit(); + efr32MiscInit(); +#endif // CHIP_ENABLE_OPENTHREAD + #if SL_SYSTEM_VIEW SEGGER_SYSVIEW_Conf(); SEGGER_SYSVIEW_Start(); @@ -74,11 +84,6 @@ void init_efrPlatform(void) #if SILABS_LOG_ENABLED silabsInitLog(); #endif - -#if CHIP_ENABLE_OPENTHREAD - efr32RadioInit(); - efr32AlarmInit(); -#endif // CHIP_ENABLE_OPENTHREAD } #ifdef __cplusplus diff --git a/examples/platform/silabs/efr32/uart.cpp b/examples/platform/silabs/efr32/uart.cpp index 8a99a7a457ce31..5481eab4c3e061 100644 --- a/examples/platform/silabs/efr32/uart.cpp +++ b/examples/platform/silabs/efr32/uart.cpp @@ -26,9 +26,10 @@ extern "C" { #include "em_usart.h" #include "sl_board_control.h" #include "sl_uartdrv_instances.h" -#if (defined(EFR32MG24) || defined(MGM24)) +#ifdef SL_CATALOG_UARTDRV_EUSART_PRESENT #include "sl_uartdrv_eusart_vcom_config.h" -#else +#endif +#ifdef SL_CATALOG_UARTDRV_USART_PRESENT #include "sl_uartdrv_usart_vcom_config.h" #endif // EFR32MG24 #include "uart.h" @@ -44,7 +45,7 @@ extern "C" { #define MIN(A, B) ((A) < (B) ? (A) : (B)) #endif -#if (defined(EFR32MG24) || defined(MGM24)) +#ifdef SL_CATALOG_UARTDRV_EUSART_PRESENT #define HELPER1(x) EUSART##x##_RX_IRQn #else #define HELPER1(x) USART##x##_RX_IRQn @@ -52,7 +53,7 @@ extern "C" { #define HELPER2(x) HELPER1(x) -#if (defined(EFR32MG24) || defined(MGM24)) +#ifdef SL_CATALOG_UARTDRV_EUSART_PRESENT #define HELPER3(x) EUSART##x##_RX_IRQHandler #else #define HELPER3(x) USART##x##_RX_IRQHandler @@ -61,7 +62,7 @@ extern "C" { #define HELPER4(x) HELPER3(x) // On MG24 boards VCOM runs on the EUSART device, MG12 uses the UART device -#if (defined(EFR32MG24) || defined(MGM24)) +#ifdef SL_CATALOG_UARTDRV_EUSART_PRESENT #define USART_IRQ HELPER2(SL_UARTDRV_EUSART_VCOM_PERIPHERAL_NO) #define USART_IRQHandler HELPER4(SL_UARTDRV_EUSART_VCOM_PERIPHERAL_NO) #define vcom_handle sl_uartdrv_eusart_vcom_handle @@ -221,7 +222,7 @@ void uartConsoleInit(void) NVIC_ClearPendingIRQ(USART_IRQ); NVIC_EnableIRQ(USART_IRQ); -#if (defined(EFR32MG24) || defined(MGM24)) +#ifdef SL_CATALOG_UARTDRV_EUSART_PRESENT // Clear previous RX interrupts EUSART_IntClear(SL_UARTDRV_EUSART_VCOM_PERIPHERAL, EUSART_IF_RXFL); @@ -246,7 +247,7 @@ void USART_IRQHandler(void) otSysEventSignalPending(); #endif -#if (defined(EFR32MG24) || defined(MGM24)) +#ifdef SL_CATALOG_UARTDRV_EUSART_PRESENT EUSART_IntClear(SL_UARTDRV_EUSART_VCOM_PERIPHERAL, EUSART_IF_RXFL); #endif } diff --git a/src/platform/silabs/EFR32/ThreadStackManagerImpl.cpp b/src/platform/silabs/EFR32/ThreadStackManagerImpl.cpp index 16d792276644e4..1e757361962911 100644 --- a/src/platform/silabs/EFR32/ThreadStackManagerImpl.cpp +++ b/src/platform/silabs/EFR32/ThreadStackManagerImpl.cpp @@ -99,11 +99,13 @@ extern "C" void otPlatFree(void * aPtr) { CHIPPlatformMemoryFree(aPtr); } - +#ifndef SL_COMPONENT_CATALOG_PRESENT extern "C" __WEAK void sl_openthread_init(void) { +#error "This shouldn't compile" // Place holder for enabling Silabs specific features available only through Simplicity Studio } +#endif /** * @brief Openthread UART implementation for the CLI is conflicting diff --git a/src/platform/silabs/Logging.cpp b/src/platform/silabs/Logging.cpp index fbc9f2a25762c7..c6b0013f566a73 100644 --- a/src/platform/silabs/Logging.cpp +++ b/src/platform/silabs/Logging.cpp @@ -19,6 +19,12 @@ #include #include +#include "rail_types.h" + +#ifdef RAIL_ASSERT_DEBUG_STRING +#include "rail_assert_error_codes.h" +#endif + #ifdef BRD4325A // For SiWx917 Platform only #include "core_cm4.h" #endif @@ -507,4 +513,25 @@ extern "C" void vApplicationGetTimerTaskMemory(StaticTask_t ** ppxTimerTaskTCBBu configMINIMAL_STACK_SIZE is specified in words, not bytes. */ *pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH; } + +extern "C" void RAILCb_AssertFailed(RAIL_Handle_t railHandle, uint32_t errorCode) +{ +#ifdef RAIL_ASSERT_DEBUG_STRING + static const char * railErrorMessages[] = RAIL_ASSERT_ERROR_MESSAGES; + const char * errorMessage = "Unknown"; + + If this error code is within the range of known error messages then use the appropriate error + message.if (errorCode < (sizeof(railErrorMessages) / sizeof(char *))) + { + errorMessage = railErrorMessages[errorCode]; + } + SILABS_LOG("RAIL Assert : %s", errorMessage); +#else + SILABS_LOG("RAIL Assert : %ld", errorCode); +#endif + + while (1) + ; +} + #endif // HARD_FAULT_LOG_ENABLE && SILABS_LOG_ENABLED diff --git a/third_party/silabs/efr32_sdk.gni b/third_party/silabs/efr32_sdk.gni index 1583b7eee1e248..76a2377835e66d 100644 --- a/third_party/silabs/efr32_sdk.gni +++ b/third_party/silabs/efr32_sdk.gni @@ -39,23 +39,33 @@ declare_args() { # Enable Segger System View use_system_view = false + # Enable Buttons by default + use_wstk_buttons = true + + # Enable LEDs by default + use_wstk_leds = true + sleep_time_ms = 3300000 # 55 mins sleep } # Explorer Kit and MGM240L do not have external flash -if (silabs_board == "BRD2703A" || silabs_board == "BRD4319A") { +if (silabs_board == "BRD2703A" || silabs_board == "BRD4318A" || + silabs_board == "BRD4319A") { use_external_flash = false } -# Enable LEDs by default -use_wstk_leds = true - # Board does not support LEDs and Buttons at the same time if (silabs_board == "BRD4317A" || silabs_board == "BRD4316A" || - silabs_board == "BRD4319A") { + silabs_board == "BRD4319A" || silabs_board == "BRD4318A") { use_wstk_leds = false } +# Board does not support buttons +if (silabs_board == "BRD2704A") { + use_wstk_buttons = false + use_external_flash = false +} + assert(efr32_sdk_root != "", "efr32_sdk_root must be specified") # Defines an efr32 SDK build target. @@ -195,7 +205,7 @@ template("efr32_sdk") { "MBEDTLS_THREADING_C=1", "MBEDTLS_THREADING_ALT=1", "SL_THREADING_ALT=1", - "SL_COMPONENT_CATALOG_PRESENT", + "SL_COMPONENT_CATALOG_PRESENT=1", "PLATFORM_HEADER=\"platform-header.h\"", "USE_NVM3=1", @@ -213,6 +223,15 @@ template("efr32_sdk") { defines += [ "SL_SYSTEM_VIEW=1" ] } + if (silabs_board == "BRD2704A" || silabs_board == "BRD4318A") { + _include_dirs += [ + "${efr32_sdk_root}/platform/radio/rail_lib/plugin/fem_util/", + "${efr32_sdk_root}/platform/radio/rail_lib/plugin/rail_util_rssi/", + "${efr32_sdk_root}/platform/driver/debug/inc/", + "${efr32_sdk_root}/hardware/driver/configuration_over_swo/inc/", + ] + } + defines += board_defines if (use_wstk_leds) { @@ -221,6 +240,10 @@ template("efr32_sdk") { defines += [ "ENABLE_WSTK_LEDS" ] } + if (use_wstk_buttons) { + _include_dirs += [ "${efr32_sdk_root}/platform/driver/button/inc" ] + } + if (defined(invoker.enable_sleepy_device)) { if (invoker.enable_sleepy_device) { defines += [ @@ -344,14 +367,27 @@ template("efr32_sdk") { "${sdk_support_root}/protocol/bluetooth/lib/EFR32MG24/GCC/libbluetooth.a", "${sdk_support_root}/platform/radio/rail_lib/autogen/librail_release/librail_multiprotocol_module_efr32xg24_gcc_release.a", "${sdk_support_root}/platform/emdrv/nvm3/lib/libnvm3_CM33_gcc.a", + "${efr32_sdk_root}/protocol/openthread/libs/libsl_openthread_efr32mg2x_gcc.a", ] if (silabs_mcu == "MGM240PB32VNA") { libs += [ "${sdk_support_root}/platform/radio/rail_lib/autogen/librail_release/librail_config_mgm240pb32vna_gcc.a" ] + defines += [ + "SL_RAIL_LIB_MULTIPROTOCOL_SUPPORT=1", + "RADIO_CONFIG_DMP_SUPPORT=1", + ] } else if (silabs_mcu == "MGM240PB22VNA") { libs += [ "${sdk_support_root}/platform/radio/rail_lib/autogen/librail_release/librail_config_mgm240pb22vna_gcc.a" ] } else if (silabs_mcu == "MGM240L022RNF") { libs += [ "${sdk_support_root}/platform/radio/rail_lib/autogen/librail_release/librail_config_mgm240l022rnf_gcc.a" ] + } else if (silabs_mcu == "MGM240SD22VNA") { + libs += [ "${sdk_support_root}/platform/radio/rail_lib/autogen/librail_release/librail_config_mgm240sd22vna_gcc.a" ] + defines += [ + "SL_RAIL_LIB_MULTIPROTOCOL_SUPPORT=1", + "RADIO_CONFIG_DMP_SUPPORT=1", + "SLI_RADIOAES_REQUIRES_MASKING=1", + "SL_RAIL_UTIL_PA_CONFIG_HEADER=", + ] } defines += [ @@ -420,8 +456,6 @@ template("efr32_sdk") { "${efr32_sdk_root}/platform/bootloader/api/btl_interface_storage.c", "${efr32_sdk_root}/platform/bootloader/security/sha/crypto_sha.c", "${efr32_sdk_root}/platform/common/src/sl_slist.c", - "${efr32_sdk_root}/platform/driver/button/src/sl_button.c", - "${efr32_sdk_root}/platform/driver/button/src/sl_simple_button.c", "${efr32_sdk_root}/platform/emdrv/dmadrv/src/dmadrv.c", "${efr32_sdk_root}/platform/emdrv/gpiointerrupt/src/gpiointerrupt.c", "${efr32_sdk_root}/platform/emdrv/nvm3/src/nvm3_default.c", @@ -485,7 +519,6 @@ template("efr32_sdk") { "${efr32_sdk_root}/platform/service/sleeptimer/src/sl_sleeptimer_hal_sysrtc.c", "${efr32_sdk_root}/platform/service/system/src/sl_system_init.c", "${efr32_sdk_root}/platform/service/system/src/sl_system_kernel.c", - "${efr32_sdk_root}/platform/service/system/src/sl_system_process_action.c", "${efr32_sdk_root}/platform/service/token_manager/src/sl_token_def.c", "${efr32_sdk_root}/platform/service/token_manager/src/sl_token_manager.c", "${efr32_sdk_root}/platform/service/token_manager/src/sl_token_manufacturing.c", @@ -590,9 +623,16 @@ template("efr32_sdk") { "${sdk_support_root}/matter/efr32/${silabs_family}/${silabs_board}/autogen/sl_board_default_init.c", "${sdk_support_root}/matter/efr32/${silabs_family}/${silabs_board}/autogen/sl_device_init_clocks.c", "${sdk_support_root}/matter/efr32/${silabs_family}/${silabs_board}/autogen/sl_event_handler.c", - "${sdk_support_root}/matter/efr32/${silabs_family}/${silabs_board}/autogen/sl_simple_button_instances.c", ] + if (use_wstk_buttons) { + sources += [ + "${efr32_sdk_root}/platform/driver/button/src/sl_button.c", + "${efr32_sdk_root}/platform/driver/button/src/sl_simple_button.c", + "${sdk_support_root}/matter/efr32/${silabs_family}/${silabs_board}/autogen/sl_simple_button_instances.c", + ] + } + if (use_system_view) { sources += [ "${efr32_sdk_root}/util/third_party/segger/systemview/SEGGER/SEGGER_SYSVIEW.c", @@ -814,10 +854,20 @@ template("efr32_sdk") { } if (silabs_board == "BRD4186A" || silabs_board == "BRD4186C" || - silabs_board == "BRD4187A" || silabs_board == "BRD4187C") { + silabs_board == "BRD4187A" || silabs_board == "BRD4187C" || + silabs_board == "BRD2704A") { sources += [ "${efr32_sdk_root}/platform/service/device_init/src/sl_device_init_dpll_s2.c" ] } + if (silabs_board == "BRD2704A" || silabs_board == "BRD4318A") { + sources += [ + "${efr32_sdk_root}/hardware/driver/configuration_over_swo/src/sl_cos.c", + "${efr32_sdk_root}/platform/driver/debug/src/sl_debug_swo.c", + "${efr32_sdk_root}/platform/radio/rail_lib/plugin/fem_util/sl_fem_util.c", + "${efr32_sdk_root}/platform/radio/rail_lib/plugin/rail_util_rssi/sl_rail_util_rssi.c", + ] + } + public_deps = [ ":efr32_mbedtls_config", "${segger_rtt_root}:segger_rtt", diff --git a/third_party/silabs/silabs_board.gni b/third_party/silabs/silabs_board.gni index 1e638c9351a2b6..dd944c47f51039 100644 --- a/third_party/silabs/silabs_board.gni +++ b/third_party/silabs/silabs_board.gni @@ -93,8 +93,14 @@ if (silabs_board == "BRD4304A") { } else if (silabs_board == "BRD4319A") { silabs_family = "mgm24" silabs_mcu = "MGM240L022RNF" +} else if (silabs_board == "BRD2704A") { + silabs_family = "mgm24" + silabs_mcu = "MGM240PB32VNA" +} else if (silabs_board == "BRD4318A") { + silabs_family = "mgm24" + silabs_mcu = "MGM240SD22VNA" } else { print( - "Please provide a valid value for SILABS_BOARD env variable (currently supported BRD4304A, BRD4161A, BRD4163A, BRD4164A BRD4166A, BRD4170A, BRD4186C, BRD4187C, BRD2601B, BRD2703A, BRD4317A)") + "Please provide a valid value for SILABS_BOARD env variable (currently supported BRD4304A, BRD4161A, BRD4163A, BRD4164A BRD4166A, BRD4170A, BRD4186C, BRD4187C, BRD2601B, BRD2703A, BRD4317A, BRD2704A)") assert(false, "The board ${silabs_board} is unsupported") }