Skip to content

Commit

Permalink
[Silabs] Add support for new gsdk 4.4.0 (project-chip#31264)
Browse files Browse the repository at this point in the history
* BLE changes in upcomming new gsdk version 23q4

* Update gsdk submodule and .gitmodules. add new libs and needed files in efr32_sdk.gni. add a define for mbedtls in cryptopal

* MG12 BRD4304A leds and button pin conflicts. only use buttons remove leds

* Updated linker scripts for mg12 and mgm24. add/remove needed files for MG12

* Update the docker image version used for ci

* update matter_support submodule

* add missing mbedtls define for thread COAPI support/ JPAKE
  • Loading branch information
jmartinez-silabs authored Jan 5, 2024
1 parent 3a8b789 commit 19e2b36
Show file tree
Hide file tree
Showing 13 changed files with 120 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/examples-efr32.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
if: github.actor != 'restyled-io[bot]'

container:
image: ghcr.io/project-chip/chip-build-efr32:26
image: ghcr.io/project-chip/chip-build-efr32:31
volumes:
- "/tmp/bloat_reports:/tmp/bloat_reports"
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release_artifacts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ jobs:
runs-on: ubuntu-latest

container:
image: ghcr.io/project-chip/chip-build-efr32:26
image: ghcr.io/project-chip/chip-build-efr32:31
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@
[submodule "third_party/silabs/gecko_sdk"]
path = third_party/silabs/gecko_sdk
url = https://github.com/SiliconLabs/gecko_sdk.git
branch = v4.3.2
branch = v4.4.0
platforms = silabs
[submodule "third_party/silabs/wiseconnect-wifi-bt-sdk"]
path = third_party/silabs/wiseconnect-wifi-bt-sdk
Expand Down
27 changes: 26 additions & 1 deletion examples/platform/silabs/ldscripts/efr32mg12.ld
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,12 @@ SECTIONS
*(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
*(SORT(.dtors.*))
*(.dtors)


__code_classification_validator_start__ = .;
. = . + 0x20;
*(code_classification_validator)
. = ALIGN(32);
__code_classification_validator_end__ = .;
*(.rodata*)

KEEP(*(.eh_frame*))
Expand Down Expand Up @@ -194,6 +199,26 @@ SECTIONS
. = ALIGN(4);
__bss_end__ = .;
} > RAM
__ramfuncs_start__ = .;

__vma_ramfuncs_start__ = .;
__lma_ramfuncs_start__ = __etext + SIZEOF(.data);

__text_application_ram_offset__ = . - __vma_ramfuncs_start__;
text_application_ram . : AT(__lma_ramfuncs_start__ + __text_application_ram_offset__)
{
. = ALIGN(4);
__text_application_ram_start__ = .;
*(text_application_ram)
. = ALIGN(4);
__text_application_ram_end__ = .;
} > RAM

. = ALIGN(4);
__vma_ramfuncs_end__ = .;
__lma_ramfuncs_end__ = __lma_ramfuncs_start__ + __text_application_ram_offset__ + SIZEOF(text_application_ram);

__ramfuncs_end__ = .;

.heap (COPY) :
{
Expand Down
30 changes: 28 additions & 2 deletions examples/platform/silabs/ldscripts/efr32mg24.ld
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,14 @@ SECTIONS
*(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
*(SORT(.dtors.*))
*(.dtors)


__code_classification_validator_start__ = .;
. = . + 0x20;
*(code_classification_validator)
. = ALIGN(32);
__code_classification_validator_end__ = .;
*(.rodata*)

KEEP(*(.eh_frame*))
} > FLASH
.ARM.extab :
Expand Down Expand Up @@ -196,6 +201,27 @@ SECTIONS
__bss_end__ = .;
} > RAM AT > RAM

__ramfuncs_start__ = .;

__vma_ramfuncs_start__ = .;
__lma_ramfuncs_start__ = __etext + SIZEOF(.data);

__text_application_ram_offset__ = . - __vma_ramfuncs_start__;
text_application_ram . : AT(__lma_ramfuncs_start__ + __text_application_ram_offset__)
{
. = ALIGN(4);
__text_application_ram_start__ = .;
*(text_application_ram)
. = ALIGN(4);
__text_application_ram_end__ = .;
} > RAM

. = ALIGN(4);
__vma_ramfuncs_end__ = .;
__lma_ramfuncs_end__ = __lma_ramfuncs_start__ + __text_application_ram_offset__ + SIZEOF(text_application_ram);

__ramfuncs_end__ = .;

.heap (COPY):
{
__HeapBase = .;
Expand Down
28 changes: 27 additions & 1 deletion examples/platform/silabs/ldscripts/mgm24.ld
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,12 @@ SECTIONS
*(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
*(SORT(.dtors.*))
*(.dtors)


__code_classification_validator_start__ = .;
. = . + 0x20;
*(code_classification_validator)
. = ALIGN(32);
__code_classification_validator_end__ = .;
*(.rodata*)

KEEP(*(.eh_frame*))
Expand Down Expand Up @@ -196,6 +201,27 @@ SECTIONS
__bss_end__ = .;
} > RAM AT > RAM

__ramfuncs_start__ = .;

__vma_ramfuncs_start__ = .;
__lma_ramfuncs_start__ = __etext + SIZEOF(.data);

__text_application_ram_offset__ = . - __vma_ramfuncs_start__;
text_application_ram . : AT(__lma_ramfuncs_start__ + __text_application_ram_offset__)
{
. = ALIGN(4);
__text_application_ram_start__ = .;
*(text_application_ram)
. = ALIGN(4);
__text_application_ram_end__ = .;
} > RAM

. = ALIGN(4);
__vma_ramfuncs_end__ = .;
__lma_ramfuncs_end__ = __lma_ramfuncs_start__ + __text_application_ram_offset__ + SIZEOF(text_application_ram);

__ramfuncs_end__ = .;

.heap (COPY):
{
__HeapBase = .;
Expand Down
2 changes: 1 addition & 1 deletion src/platform/silabs/efr32/BLEManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1053,7 +1053,7 @@ extern "C" void sl_bt_on_event(sl_bt_msg_t * evt)
evt->data.evt_gatt_server_characteristic_status.connection);
}
else if ((evt->data.evt_gatt_server_characteristic_status.characteristic == gattdb_CHIPoBLEChar_Tx) &&
(evt->data.evt_gatt_server_characteristic_status.status_flags == gatt_server_client_config))
(evt->data.evt_gatt_server_characteristic_status.status_flags == sl_bt_gatt_server_client_config))
{
chip::DeviceLayer::Internal::BLEMgrImpl().HandleTXCharCCCDWrite(evt);
}
Expand Down
4 changes: 4 additions & 0 deletions src/platform/silabs/efr32/CHIPCryptoPALPsaEfr32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
* PSA Crypto API based implementation of CHIP crypto primitives
* with Silicon Labs SDK modifications
*/
// The psa_driver_wrappers.h file that we're including here assumes that it has
// access to private struct members. Define this here in order to avoid
// compilation errors.
#define MBEDTLS_ALLOW_PRIVATE_ACCESS

#include <crypto/CHIPCryptoPAL.h>

Expand Down
6 changes: 6 additions & 0 deletions src/platform/silabs/efr32/efr32-chip-mbedtls-config.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@
#define MBEDTLS_CCM_C
#define MBEDTLS_ECJPAKE_C
#define MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED
#define MBEDTLS_PK_HAVE_CURVE_SECP256R1
#define MBEDTLS_PK_HAVE_JPAKE
#define PSA_WANT_ALG_SOME_PAKE
#define MBEDTLS_SSL_MAX_CONTENT_LEN 768

/**
Expand All @@ -79,6 +82,9 @@
#define MBEDTLS_CCM_C
#define MBEDTLS_ECJPAKE_C
#define MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED
#define MBEDTLS_PK_HAVE_CURVE_SECP256R1
#define MBEDTLS_PK_HAVE_JPAKE
#define PSA_WANT_ALG_SOME_PAKE
#endif // SL_USE_COAP_CONFIG

#define MBEDTLS_PLATFORM_SNPRINTF_MACRO snprintf
Expand Down
27 changes: 20 additions & 7 deletions third_party/silabs/efr32_sdk.gni
Original file line number Diff line number Diff line change
Expand Up @@ -465,10 +465,11 @@ template("efr32_sdk") {
_include_dirs += [
"${efr32_sdk_root}/platform/Device/SiliconLabs/EFR32MG12P/Include",
"${efr32_sdk_root}/platform/radio/rail_lib/chip/efr32/efr32xg1x",
"${efr32_sdk_root}/util/third_party/freertos/kernel/portable/GCC/ARM_CM4F",
"${efr32_sdk_root}/platform/radio/rail_lib/plugin/pa-conversions/efr32xg1x/config",
"${efr32_sdk_root}/platform/service/device_init/config/s1/",
"${efr32_sdk_root}/platform/emdrv/spidrv/inc",
"${efr32_sdk_root}/protocol/bluetooth/bgcommon/inc",
"${efr32_sdk_root}/util/third_party/freertos/kernel/portable/GCC/ARM_CM4F",
]

if (silabs_board == "BRD4304A") {
Expand All @@ -483,7 +484,11 @@ template("efr32_sdk") {
]

if (!chip_enable_ble_rs911x) {
libs += [ "${sdk_support_root}/protocol/bluetooth/lib/EFR32XG12/GCC/libbluetooth.a" ]
libs += [
"${sdk_support_root}/protocol/bluetooth/bgcommon/lib/libbgcommon_efr32xg12_gcc_release.a",
"${sdk_support_root}/protocol/bluetooth/bgstack/ll/lib/libbluetooth_controller_efr32xg12_gcc_release.a",
"${sdk_support_root}/protocol/bluetooth/lib/libbluetooth_host_efr32xg12_gcc_release.a",
]
}

defines += [ "EFR32MG12" ]
Expand All @@ -505,7 +510,11 @@ template("efr32_sdk") {
]

if (!chip_enable_ble_rs911x) {
libs += [ "${sdk_support_root}/protocol/bluetooth/lib/EFR32XG24/GCC/libbluetooth.a" ]
libs += [
"${sdk_support_root}/protocol/bluetooth/bgcommon/lib/libbgcommon_efr32xg24_gcc_release.a",
"${sdk_support_root}/protocol/bluetooth/bgstack/ll/lib/libbluetooth_controller_efr32xg24_gcc_release.a",
"${sdk_support_root}/protocol/bluetooth/lib/libbluetooth_host_efr32xg24_gcc_release.a",
]
}

defines += [
Expand All @@ -526,7 +535,9 @@ template("efr32_sdk") {
]

libs += [
"${sdk_support_root}/protocol/bluetooth/lib/EFR32XG24/GCC/libbluetooth.a",
"${sdk_support_root}/protocol/bluetooth/bgcommon/lib/libbgcommon_efr32xg24_gcc_release.a",
"${sdk_support_root}/protocol/bluetooth/bgstack/ll/lib/libbluetooth_controller_efr32xg24_gcc_release.a",
"${sdk_support_root}/protocol/bluetooth/lib/libbluetooth_host_efr32xg24_gcc_release.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",
"${sdk_support_root}/protocol/openthread/libs/libsl_openthread_efr32mg2x_gcc.a",
Expand Down Expand Up @@ -650,7 +661,6 @@ template("efr32_sdk") {
"${efr32_sdk_root}/platform/service/power_manager/src/sl_power_manager_hal_s2.c",
"${efr32_sdk_root}/platform/service/sleeptimer/src/sl_sleeptimer.c",
"${efr32_sdk_root}/platform/service/sleeptimer/src/sl_sleeptimer_hal_rtcc.c",
"${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/udelay/src/sl_udelay.c",
Expand All @@ -672,6 +682,7 @@ template("efr32_sdk") {
"${efr32_sdk_root}/util/third_party/mbedtls/library/asn1write.c",
"${efr32_sdk_root}/util/third_party/mbedtls/library/base64.c",
"${efr32_sdk_root}/util/third_party/mbedtls/library/bignum.c",
"${efr32_sdk_root}/util/third_party/mbedtls/library/bignum_core.c",
"${efr32_sdk_root}/util/third_party/mbedtls/library/ccm.c",
"${efr32_sdk_root}/util/third_party/mbedtls/library/cipher.c",
"${efr32_sdk_root}/util/third_party/mbedtls/library/cipher_wrap.c",
Expand All @@ -697,14 +708,15 @@ template("efr32_sdk") {
"${efr32_sdk_root}/util/third_party/mbedtls/library/psa_crypto_aead.c",
"${efr32_sdk_root}/util/third_party/mbedtls/library/psa_crypto_cipher.c",
"${efr32_sdk_root}/util/third_party/mbedtls/library/psa_crypto_client.c",
"${efr32_sdk_root}/util/third_party/mbedtls/library/psa_crypto_driver_wrappers.c",
"${efr32_sdk_root}/util/third_party/mbedtls/library/psa_crypto_driver_wrappers_no_static.c",
"${efr32_sdk_root}/util/third_party/mbedtls/library/psa_crypto_ecp.c",
"${efr32_sdk_root}/util/third_party/mbedtls/library/psa_crypto_hash.c",
"${efr32_sdk_root}/util/third_party/mbedtls/library/psa_crypto_mac.c",
"${efr32_sdk_root}/util/third_party/mbedtls/library/psa_crypto_rsa.c",
"${efr32_sdk_root}/util/third_party/mbedtls/library/psa_crypto_se.c",
"${efr32_sdk_root}/util/third_party/mbedtls/library/psa_crypto_slot_management.c",
"${efr32_sdk_root}/util/third_party/mbedtls/library/psa_crypto_storage.c",
"${efr32_sdk_root}/util/third_party/mbedtls/library/psa_util.c",
"${efr32_sdk_root}/util/third_party/mbedtls/library/sha256.c",
"${efr32_sdk_root}/util/third_party/mbedtls/library/ssl_cache.c",
"${efr32_sdk_root}/util/third_party/mbedtls/library/ssl_ciphersuites.c",
Expand Down Expand Up @@ -775,7 +787,6 @@ template("efr32_sdk") {
}
} else {
sources += [
"${efr32_sdk_root}/protocol/bluetooth/src/sl_bt_mbedtls_context.c",
"${efr32_sdk_root}/protocol/bluetooth/src/sl_bt_rtos_adaptation.c",
"${efr32_sdk_root}/protocol/bluetooth/src/sl_bt_stack_init.c",
"${efr32_sdk_root}/protocol/bluetooth/src/sli_bt_advertiser_config.c",
Expand Down Expand Up @@ -886,6 +897,7 @@ template("efr32_sdk") {
"${efr32_sdk_root}/platform/service/device_init/src/sl_device_init_emu_s1.c",
"${efr32_sdk_root}/platform/service/device_init/src/sl_device_init_hfxo_s1.c",
"${efr32_sdk_root}/platform/service/device_init/src/sl_device_init_lfxo_s1.c",
"${efr32_sdk_root}/protocol/bluetooth/bgcommon/src/sl_bt_mbedtls_context.c",
"${efr32_sdk_root}/util/third_party/freertos/kernel/portable/GCC/ARM_CM4F/port.c",
"${efr32_sdk_root}/util/third_party/mbedtls/library/ctr_drbg.c",
"${efr32_sdk_root}/util/third_party/mbedtls/library/entropy.c",
Expand Down Expand Up @@ -948,6 +960,7 @@ template("efr32_sdk") {
"${efr32_sdk_root}/platform/service/device_init/src/sl_device_init_emu_s2.c",
"${efr32_sdk_root}/platform/service/device_init/src/sl_device_init_lfxo_s2.c",
"${efr32_sdk_root}/platform/service/hfxo_manager/src/sl_hfxo_manager_hal_s2.c",
"${efr32_sdk_root}/platform/service/sleeptimer/src/sl_sleeptimer_hal_sysrtc.c",
"${efr32_sdk_root}/util/third_party/freertos/kernel/portable/GCC/ARM_CM33_NTZ/non_secure/port.c",
"${efr32_sdk_root}/util/third_party/freertos/kernel/portable/GCC/ARM_CM33_NTZ/non_secure/portasm.c",
]
Expand Down
2 changes: 1 addition & 1 deletion third_party/silabs/gecko_sdk
Submodule gecko_sdk updated 15097 files
2 changes: 1 addition & 1 deletion third_party/silabs/matter_support
Submodule matter_support updated 317 files
3 changes: 3 additions & 0 deletions third_party/silabs/silabs_board.gni
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ if (silabs_board == "BRD4304A") {
silabs_family = "efr32mg12"
silabs_mcu = "EFR32MG12P432F1024GM48"
enable_fem = true

# Board does not support LEDs and Buttons at the same time
use_wstk_leds = false
board_defines += [ "PAL_RTCC_CLOCK_LFRCO" ]
} else if (silabs_board == "BRD4161A") {
silabs_family = "efr32mg12"
Expand Down

0 comments on commit 19e2b36

Please sign in to comment.