Skip to content

Commit

Permalink
[sdk] update to Simplicity SDK v2024.6.0 (#918)
Browse files Browse the repository at this point in the history
* [sdk] add Simplicity SDK for Series 2+ parts

Update PAL

* [slc] remove usage of daemon mode

Using daemon mode causes issues when developing SLC components

* [slc] add `ot_efr32` version of `ot_headers`

As part of SBOM work, openthread headers were pulled out of SLC components
which referenced mostly Silabs code and consolidated into the `ot_headers`
component. A requirement for `ot_headers` was then added to affected
components.

This requirement causes ALL OpenThread headers to be added to any component
which previously only required a subset of the headers.

In the context of ot-efr32 builds, this causes SLC generation failures as the
CMake platform library definitions will now reference all openthread headers in
`ot_headers`, which may or may not match up (ex. deleted) with the version of
OpenThread checked out in the `openthread` submodule in ot-efr32.

This commit adds an ot-efr32 version of `ot_headers` which fixes the issue by
pulling in only required headers instead of all headers in the `simplicity_sdk`
version of `ot_headers`.

* [script] misc. script improvements
  • Loading branch information
lmnotran authored Jul 29, 2024
1 parent 089440d commit 8d27720
Show file tree
Hide file tree
Showing 60 changed files with 2,438 additions and 3,480 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,23 +106,23 @@ jobs:
-v $PWD:/ot-efr32 -w /ot-efr32\
${{ env.DOCKER_IMAGE_SHA_TAG }}
- name: Append LFS include config to GSDK .lfsconfig
- name: Append LFS include config to simplicity_sdk .lfsconfig
run: |
git -C third_party/silabs/gecko_sdk checkout -- .lfsconfig
echo 'fetchinclude = "platform/emdrv/nvm3/lib/libnvm3_*_gcc.a,platform/radio/rail_lib/autogen/librail_release/librail_config_mgm*_gcc.a,platform/radio/rail_lib/autogen/librail_release/*efr32xg*_gcc_release.a"' >> third_party/silabs/gecko_sdk/.lfsconfig
git -C third_party/silabs/simplicity_sdk checkout -- .lfsconfig
echo 'fetchinclude = "platform/emdrv/nvm3/lib/libnvm3_*_gcc.a,platform/radio/rail_lib/autogen/librail_release/librail_config_mgm*_gcc.a,platform/radio/rail_lib/autogen/librail_release/*efr32xg*_gcc_release.a"' >> third_party/silabs/simplicity_sdk/.lfsconfig
- name: Create LFS file hash list
run: git -C third_party/silabs/gecko_sdk lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id
run: git -C third_party/silabs/simplicity_sdk lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id

- name: Restore gecko_sdk LFS cache
- name: Restore simplicity_sdk LFS cache
uses: actions/cache@v4
id: lfs-cache-gecko_gsdk
id: lfs-cache-simplicity_sdk
with:
path: .git/modules/third_party/silabs/gecko_sdk/lfs
path: .git/modules/third_party/silabs/simplicity_sdk/lfs
key: lfs-${{ hashFiles('.lfs-assets-id') }}

- name: Git LFS Pull
run: git -C third_party/silabs/gecko_sdk lfs pull
run: git -C third_party/silabs/simplicity_sdk lfs pull

- name: Build
run: docker exec ot-efr32-dev bash -c 'PATH=${{ env.TOOLCHAIN_DIR }}/${{ matrix.gcc_extract_dir }}/bin:$PATH script/test'
Expand Down
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[submodule "openthread"]
path = openthread
url = https://github.com/openthread/openthread.git
[submodule "third_party/silabs/gecko_sdk"]
path = third_party/silabs/gecko_sdk
url = https://github.com/SiliconLabs/gecko_sdk.git
[submodule "third_party/silabs/simplicity_sdk"]
path = third_party/silabs/simplicity_sdk
url = https://github.com/SiliconLabs/simplicity_sdk.git
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ The example platform drivers are intended to present the minimal code necessary

When using this repo to generate a solution that requires two different projects, such as an RCP & OTBR, make sure they are relying on the same OpenThread version to ensure maximum compatibility. You can check which commit this repo relies upon in the "openthread" submodule.

If your OTBR project was generated using the Silabs GSDK / Simplicity Studio, we recommend to also use it to generate the RCP project and not this repo. This will mitigate potential incompatibility issues due to mismatched OpenThread versions.
If your OTBR project was generated using the Silabs SiSDK / Simplicity Studio, we recommend to also use it to generate the RCP project and not this repo. This will mitigate potential incompatibility issues due to mismatched OpenThread versions.

To learn more about building and running the examples please check:

Expand Down
6 changes: 3 additions & 3 deletions examples/example_vendor_slc_extension/example_vendor.slce
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@

id: example_vendor
version: 0.0.1
description: "example_vendor extension for Gecko SDK Suite"
description: "example_vendor extension for Simplicity SDK Suite"
label: "Example Vendor extension"
sdk:
id: gecko_sdk
version: 4.2.1
id: simplicity_sdk
version: 2024.6.0
component_path:
- path: component
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ quality: production

component:
- id: ot_platform_abstraction_core
- id: ot_headers
from: ot-efr32
- id: ot_mbedtls
- id: ot_stack_features_config
from: ot-efr32
Expand Down
6 changes: 3 additions & 3 deletions ot-efr32.slce
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
id: ot-efr32
version: 0.0.1
description: "ot-efr32 extension for Gecko SDK Suite"
description: "ot-efr32 extension for Simplicity SDK Suite"
label: "Silicon Labs OpenThread"
sdk:
id: gecko_sdk
version: 4.4.0
id: simplicity_sdk
version: 2024.6.0
component_path:
- path: third_party/silabs/slc/component
2 changes: 1 addition & 1 deletion ot-efr32.slsdk
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ id=com.silabs.sdk.ot-efr32
version=0.0.1

label=Silicon Labs ot-efr32
description=ot-efr32 extension for Gecko SDK Suite
description=ot-efr32 extension for Simplicity SDK Suite

prop.subLabel=Silicon Labs ot-efr32\\ 0.0.1-1.0
137 changes: 85 additions & 52 deletions script/build
Original file line number Diff line number Diff line change
Expand Up @@ -29,60 +29,19 @@

# ==============================================================================
# Bash definitions

# ==============================================================================
if [[ -n ${BASH_SOURCE[0]} ]]; then
script_path="${BASH_SOURCE[0]}"
else
script_path="$0"
fi
script_dir="$(realpath "$(dirname "${script_path}")")"
repo_dir="$(dirname "${script_dir}")"
gsdk_dir="${repo_dir}/third_party/silabs/gecko_sdk"

# shellcheck source=script/efr32-definitions
source "${repo_dir}/script/efr32-definitions"

# shellcheck source=script/util
source "${repo_dir}/script/util"

set -euxo pipefail

# ==============================================================================
# Pre-build checks

set +x
echo "========================================================================================================="
echo "Check if the Git LFS package is installed"
echo "========================================================================================================="
set -x
if ! git lfs >/dev/null; then
set +x
echo "ERROR: Git LFS is not installed"
echo
echo "Please run './script/bootstrap packages'" to install it
exit 3
fi

set +x
echo "========================================================================================================="
echo "Ensure Git LFS has been initialized for the GSDK"
echo "========================================================================================================="
set -x
if [ ! -f "$(git -C "${gsdk_dir}" rev-parse --git-dir)/hooks/pre-push" ]; then
git -C "${gsdk_dir}" lfs install
fi

set +x
echo "========================================================================================================="
echo "Ensure GSDK submodule has been initialized and LFS objects have been pulled"
echo "========================================================================================================="
set -x
git submodule update --init "${gsdk_dir}"
git -C "${gsdk_dir}" lfs pull

# ==============================================================================
# CMake Build targets
OT_CMAKE_NINJA_TARGET=${OT_CMAKE_NINJA_TARGET-}

# CMake Build options
OT_OPTIONS=(
"-DCMAKE_BUILD_TYPE=Release"
"-DOT_DIAGNOSTIC=ON"
Expand All @@ -97,6 +56,72 @@ if command -v ccache >/dev/null; then
fi
readonly OT_OPTIONS

# ==============================================================================
# shellcheck source=script/efr32-definitions
source "${repo_dir}/script/efr32-definitions"

# shellcheck source=script/slc_cli
source "${repo_dir}/script/slc_cli"

# shellcheck source=script/util
source "${repo_dir}/script/util"

set -euxo pipefail

# ==============================================================================
# Pre-build checks
# ==============================================================================
# Initialize the Silicon Labs SDK
# This function initializes the Silicon Labs SDK submodule and checks if the platform is supported
# Arguments:
# $1: The board name
# Returns:
# None
init_silabs_sdk()
{
set +x
echo "========================================================================================================="
echo "Ensure SDK submodule has been initialized"
echo "========================================================================================================="
set -x
# Skip LFS files for now. They will be pulled in init_silabs_sdk_lfs()
GIT_LFS_SKIP_SMUDGE=true git submodule update --init "${sdk_dir}"

set +x
echo "========================================================================================================="
echo "Check if the Git LFS package is installed"
echo "========================================================================================================="
set -x
if ! git lfs >/dev/null; then
set +x
echo "ERROR: Git LFS is not installed"
echo
echo "Please run './script/bootstrap packages'" to install it
exit 3
fi

set +x
echo "========================================================================================================="
echo "Ensure Git LFS has been initialized for the SDK"
echo "========================================================================================================="
set -x
if [ ! -f "$(git -C "${sdk_dir}" rev-parse --git-dir)/hooks/pre-push" ]; then
git -C "${sdk_dir}" lfs install
fi

set +x
echo "========================================================================================================="
echo "Ensure LFS objects have been pulled"
echo "========================================================================================================="
set -x

# TODO: Add .lfsconfig lines to only fetch the necessary files
git -C "${sdk_dir}" lfs pull
}

# ==============================================================================
# Build functions
# ==============================================================================
generate()
{
if [ "${skip_generation}" = true ]; then
Expand Down Expand Up @@ -234,6 +259,7 @@ build_soc()
cd "${repo_dir}"
}

# ==============================================================================
main()
{
local usage="usage: $0 [-h] [--skip-silabs-apps] <brdXXXXy> [-D<OT_XXXX=ON> -D<OT_YYYY=OFF>]"
Expand Down Expand Up @@ -281,20 +307,28 @@ main()
shift
fi

platform=$(efr32_get_platform "${board}")
# Check if a platform can be found for a given board in Simplicity SDK
platform=$(efr32_get_platform "${board}" "${sisdk_dir}")

# Check if the platform is supported
efr32_check_platform "${platform}" || die "Unsupported platform ${platform}"

set +x
echo "========================================================================================================="
echo "Using Simplicity SDK for board ${board} (${platform})"
echo "========================================================================================================="
set -x
# Initialize the SDK
init_silabs_sdk "${board}"

local options=("${OT_OPTIONS[@]}")

options+=("-DCMAKE_TOOLCHAIN_FILE=src/${platform}/arm-none-eabi.cmake")

# Set default OT_CMAKE_NINJA_TARGET based on platform
if [ -z "${OT_CMAKE_NINJA_TARGET}" ]; then
case "${platform}" in
efr32mg1)
OT_CMAKE_NINJA_TARGET=("ot-rcp-uart")
skip_silabs_apps=true
;;
efr32mg12 | efr32mg13 | efr32mg21 | efr32mg24)
efr32mg2*)
OT_CMAKE_NINJA_TARGET=("ot-rcp-uart" "ot-rcp-spi" "ot-cli-ftd" "ot-cli-mtd" "ot-ncp-ftd" "ot-ncp-mtd")
;;
esac
Expand Down Expand Up @@ -333,7 +367,7 @@ main()
fi

# Build silabs apps
if [ "${skip_silabs_apps}" = false ]; then
if [ -z ${OT_CMAKE_NINJA_TARGET+x} ] && [ "${skip_silabs_apps}" = false ]; then
local before_flags=()
local after_flags=()

Expand All @@ -342,7 +376,6 @@ main()
fi

"${repo_dir}"/script/build_example_apps "${before_flags[@]-}" "${board}" "${after_flags[@]-}" "$@"

fi

ls -alh "${OT_CMAKE_BUILD_DIR}"/openthread/*/bin/*
Expand Down
7 changes: 1 addition & 6 deletions script/build_example_apps
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,10 @@ fi
script_dir="$(realpath "$(dirname "${script_path}")")"
repo_dir="$(dirname "${script_dir}")"

# ==============================================================================
# shellcheck source=script/efr32-definitions
source "${repo_dir}/script/efr32-definitions"

# shellcheck source=script/slc_cli
source "${repo_dir}/script/slc_cli"

# shellcheck source=script/util
source "${repo_dir}/script/util"

Expand Down Expand Up @@ -245,9 +243,6 @@ main()

options+=("-DCMAKE_TOOLCHAIN_FILE=src/${platform}/arm-none-eabi.cmake")

# Find slc-cli installation
slc_init

options+=("$@")
export OT_CMAKE_BUILD_DIR="$repo_dir/build/${board}"
slc_generated_projects_dir="${OT_CMAKE_BUILD_DIR}"/slc
Expand Down
Loading

0 comments on commit 8d27720

Please sign in to comment.