Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Silabs] SLC Lighting-app integration #25717

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/workflows/examples-efr32.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,11 @@ jobs:
path: |
.environment/gn_out/.ninja_log
.environment/pigweed-venv/*.log

- name: Test SLC gen
timeout-minutes: 30
run: |
scripts/examples/gn_efr32_example.sh examples/lighting-app/silabs/efr32 ./out/light-app BRD4187C --slc_generate --docker
rm -rf ./out/
- name: Build some BRD4187C variants
timeout-minutes: 90
run: |
Expand Down
14 changes: 14 additions & 0 deletions examples/lighting-app/silabs/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,20 @@ declare_args() {
chip_print_memory_usage = false
}

if (slc_generate) {
# Generate Project Specific config (Board, hardware used etc..)
print(exec_script("${chip_root}/third_party/silabs/slc_gen/run_slc.py",
[
rebase_path(chip_root),
"${silabs_board}",
"${disable_lcd}",
"${use_wstk_buttons}",
"${use_wstk_leds}",
"${use_external_flash}",
],
"list lines"))
}

efr32_sdk("sdk") {
sources = [
"${efr32_project_dir}/include/CHIPProjectConfig.h",
Expand Down
99 changes: 99 additions & 0 deletions examples/platform/silabs/gatt_configuration.btconf
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!--Custom BLE GATT-->
<gatt gatt_caching="true" generic_attribute_service="true" header="gatt_db.h" name="Custom BLE GATT" out="gatt_db.c" prefix="gattdb_">

<!--Generic Access-->
<service advertise="false" name="Generic Access" requirement="mandatory" sourceId="org.bluetooth.service.generic_access" type="primary" uuid="1800">
<informativeText>Abstract: The generic_access service contains generic information about the device. All available Characteristics are readonly. </informativeText>

<!--Device Name-->
<characteristic const="false" id="device_name" name="Device Name" sourceId="org.bluetooth.characteristic.gap.device_name" uuid="2A00">
<informativeText/>
<value length="13" type="utf-8" variable_length="false">Empty Example</value>
<properties>
<read authenticated="false" bonded="false" encrypted="false"/>
<write authenticated="false" bonded="false" encrypted="false"/>
</properties>
</characteristic>

<!--Appearance-->
<characteristic const="true" name="Appearance" sourceId="org.bluetooth.characteristic.gap.appearance" uuid="2A01">
<informativeText>Abstract: The external appearance of this device. The values are composed of a category (10-bits) and sub-categories (6-bits). </informativeText>
<value length="2" type="hex" variable_length="false">0000</value>
<properties>
<read authenticated="false" bonded="false" encrypted="false"/>
</properties>
</characteristic>
</service>

<!--Device Information-->
<service advertise="false" name="Device Information" requirement="mandatory" sourceId="org.bluetooth.service.device_information" type="primary" uuid="180A">
<informativeText>Abstract: The Device Information Service exposes manufacturer and/or vendor information about a device. Summary: This service exposes manufacturer information about a device. The Device Information Service is instantiated as a Primary Service. Only one instance of the Device Information Service is exposed on a device. </informativeText>

<!--Manufacturer Name String-->
<characteristic const="true" name="Manufacturer Name String" sourceId="org.bluetooth.characteristic.manufacturer_name_string" uuid="2A29">
<informativeText>Abstract: The value of this characteristic is a UTF-8 string representing the name of the manufacturer of the device. </informativeText>
<value length="12" type="utf-8" variable_length="false">Silicon Labs</value>
<properties>
<read authenticated="false" bonded="false" encrypted="false"/>
</properties>
</characteristic>

<!--Model Number String-->
<characteristic const="true" name="Model Number String" sourceId="org.bluetooth.characteristic.model_number_string" uuid="2A24">
<informativeText>Abstract: The value of this characteristic is a UTF-8 string representing the model number assigned by the device vendor. </informativeText>
<value length="10" type="utf-8" variable_length="false">Blue Gecko</value>
<properties>
<read authenticated="false" bonded="false" encrypted="false"/>
</properties>
</characteristic>

<!--System ID-->
<characteristic const="true" name="System ID" sourceId="org.bluetooth.characteristic.system_id" uuid="2A23">
<informativeText>Abstract: The SYSTEM ID characteristic consists of a structure with two fields. The first field are the LSOs and the second field contains the MSOs. This is a 64-bit structure which consists of a 40-bit manufacturer-defined identifier concatenated with a 24 bit unique Organizationally Unique Identifier (OUI). The OUI is issued by the IEEE Registration Authority (http://standards.ieee.org/regauth/index.html) and is required to be used in accordance with IEEE Standard 802-2001.6 while the least significant 40 bits are manufacturer defined. If System ID generated based on a Bluetooth Device Address, it is required to be done as follows. System ID and the Bluetooth Device Address have a very similar structure: a Bluetooth Device Address is 48 bits in length and consists of a 24 bit Company Assigned Identifier (manufacturer defined identifier) concatenated with a 24 bit Company Identifier (OUI). In order to encapsulate a Bluetooth Device Address as System ID, the Company Identifier is concatenated with 0xFFFE followed by the Company Assigned Identifier of the Bluetooth Address. For more guidelines related to EUI-64, refer to http://standards.ieee.org/develop/regauth/tut/eui64.pdf. Examples: If the system ID is based of a Bluetooth Device Address with a Company Identifier (OUI) is 0x123456 and the Company Assigned Identifier is 0x9ABCDE, then the System Identifier is required to be 0x123456FFFE9ABCDE. </informativeText>
<value length="6" type="hex" variable_length="false">000102030405</value>
<properties>
<read authenticated="false" bonded="false" encrypted="false"/>
</properties>
</characteristic>
</service>

<!--CHIPoBLE-->
<service advertise="false" name="CHIPoBLE" requirement="mandatory" sourceId="custom.type" type="primary" uuid="fff6">
<informativeText>Custom service</informativeText>

<!--CHIPoBLEChar_Rx-->
<characteristic const="false" id="CHIPoBLEChar_Rx" name="CHIPoBLEChar_Rx" sourceId="custom.type" uuid="18EE2EF5-263D-4559-959F-4F9C429F9D11">
<informativeText>Custom characteristic</informativeText>
<value length="247" type="hex" variable_length="true">00</value>
<properties>
<read authenticated="false" bonded="false" encrypted="false"/>
<write authenticated="false" bonded="false" encrypted="false"/>
</properties>
</characteristic>

<!--CHIPoBLEChar_Tx-->
<characteristic const="false" id="CHIPoBLEChar_Tx" name="CHIPoBLEChar_Tx" sourceId="custom.type" uuid="18EE2EF5-263D-4559-959F-4F9C429F9D12">
<informativeText>Custom characteristic</informativeText>
<value length="247" type="hex" variable_length="true">00</value>
<properties>
<read authenticated="false" bonded="false" encrypted="false"/>
<write authenticated="false" bonded="false" encrypted="false"/>
<write_no_response authenticated="false" bonded="false" encrypted="false"/>
<indicate authenticated="false" bonded="false" encrypted="false"/>
</properties>
</characteristic>

<characteristic const="false" id="CHIPoBLEChar_C3" name="CHIPoBLEChar_C3" sourceId="custom.type" uuid="64630238-8772-45F2-B87D-748A83218F04">
<informativeText>Custom characteristic</informativeText>
<value length="512" type="hex" variable_length="true">00</value>
<properties>
<read authenticated="false" bonded="false" encrypted="false"/>
<write authenticated="false" bonded="false" encrypted="false"/>
<write_no_response authenticated="false" bonded="false" encrypted="false"/>
<indicate authenticated="false" bonded="false" encrypted="false"/>
</properties>
</characteristic>

</service>
</gatt>
90 changes: 90 additions & 0 deletions examples/platform/silabs/matter-platform.slcp
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# Silicon Labs Project Configuration Tools: slcp, v0, Component selection file.
project_name: matter-platform
label: matter-platform
description: |
This project contains the minimal requirements to generate the dependencies needed by all Matter examples
category: Matter Examples
filter:
- name: Capability
value: [Multiprotocol]
- name: Device Type
value: [SoC]
- name: Project Difficulty
value: [Advanced]
- name: Wireless Technology
value: [Bluetooth, Thread]
package: OpenThread
quality: production
readme:
- {path: README.md}
source:
- {path: main.c}
- {path: app.c}
- {path: bluetooth_event_callback.c}
tag: [prebuilt_demo]
include:
- path: ''
file_list:
- {path: app.h}
- {path: reset_util.h}
sdk: {id: gecko_sdk, version: 4.2.0}
toolchain_settings: []

component:
- {id: bluetooth_feature_nvm}
- {id: bluetooth_feature_gatt_server}
- {id: nvm3_lib}
- {id: bluetooth_feature_sm}
- {id: bluetooth_feature_gap}
- {id: bluetooth_feature_legacy_advertiser}
- {id: gatt_configuration}
- {id: freertos}
- {id: bluetooth_stack}
- {id: brd4002a}
- {id: rail_util_pti}
- {id: bluetooth_feature_gatt}
- {id: bluetooth_feature_connection}
- {id: psa_crypto}
- {id: rail_lib_multiprotocol}
- {id: bluetooth_feature_system}
- {id: bluetooth_feature_scanner}
- instance: [vcom]
id: uartdrv_usart
- instance: [vcom]
id: uartdrv_eusart


config_file:
- override:
component: gatt_configuration
file_id: gatt_configuration_file_id
path: gatt_configuration.btconf
directory: btconf

configuration:
- {name: SL_BOARD_ENABLE_VCOM, value: '1'}
- {name: SL_MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED, value: '1'}
- {name: SL_MBEDTLS_KEY_EXCHANGE_PSK_ENABLED, value: '1'}
- condition: [uartdrv_usart]
name: UARTDRV_RESTRICT_ENERGY_MODE_TO_ALLOW_RECEPTION
value: '0'
- condition: [iostream_usart]
name: SL_IOSTREAM_USART_VCOM_RESTRICT_ENERGY_MODE_TO_ALLOW_RECEPTION
value: '0'
- condition: [iostream_usart]
name: SL_IOSTREAM_USART_VCOM_RX_BUFFER_SIZE
value: '128'
- {name: SL_HEAP_SIZE, value: '16384'}
- {name: SL_STACK_SIZE, value: '4608'}

requires:
- condition: [device_series_1]
name: uartdrv_usart
- condition: [device_series_2]
name: uartdrv_eusart
- condition: [device_series_2]
name: device_init_dpll

ui_hints:
highlight:
- {path: ./README.md, focus: true}
46 changes: 40 additions & 6 deletions scripts/examples/gn_efr32_example.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,14 @@ else
CHIP_ROOT="$MATTER_ROOT"
fi

source "$CHIP_ROOT/scripts/activate.sh"

set -x
env
USE_WIFI=false
USE_DOCKER=false
USE_GIT_SHA_FOR_VERSION=true
USE_SLC=false
GN_PATH=gn
GN_PATH_PROVIDED=false

SILABS_THREAD_TARGET=\""../silabs:ot-efr32-cert"\"
USAGE="./scripts/examples/gn_efr32_example.sh <AppRootFolder> <outputFolder> <silabs_board_name> [<Build options>]"
Expand Down Expand Up @@ -125,6 +126,10 @@ if [ "$#" == "0" ]; then
Change GSDK root for docker builds
--uart_log
Forward Logs to Uart instead of RTT
--slc_generate
Generate files with SLC for current board and options Requires an SLC-CLI installation or running in Docker.
--slc_reuse_files
Use generated files without running slc again.

"
elif [ "$#" -lt "2" ]; then
Expand Down Expand Up @@ -214,12 +219,32 @@ else
shift
;;

--slc_generate)
optArgs+="slc_generate=true "
USE_SLC=true
shift
;;
--slc_reuse_files)
optArgs+="slc_reuse_files=true "
USE_SLC=true
shift
;;
--gn_path)
if [ -z "$2" ]; then
echo "--gn_path requires a path to GN"
exit 1
else
GN_PATH="$2"
fi
GN_PATH_PROVIDED=true
shift
shift
;;
*"sl_matter_version_str="*)
optArgs+="$1 "
USE_GIT_SHA_FOR_VERSION=false
shift
;;

*)
if [ "$1" =~ *"use_rs9116=true"* ] || [ "$1" =~ *"use_SiWx917=true"* ] || [ "$1" =~ *"use_wf200=true"* ]; then
USE_WIFI=true
Expand All @@ -243,6 +268,10 @@ else
} &>/dev/null
fi

if [ "$USE_SLC" == true ] && [ "$GN_PATH_PROVIDED" == false ]; then
GN_PATH=./.environment/cipd/packages/pigweed/gn
fi

BUILD_DIR=$OUTDIR/$SILABS_BOARD
echo BUILD_DIR="$BUILD_DIR"

Expand All @@ -254,7 +283,7 @@ else
# wifi build
# NCP mode EFR32 + wifi module
optArgs+="$ipArgs"
gn gen --check --fail-on-unused-args --export-compile-commands --root="$ROOT" --dotfile="$ROOT"/build_for_wifi_gnfile.gn --args="silabs_board=\"$SILABS_BOARD\" $optArgs" "$BUILD_DIR"
"$GN_PATH" gen --check --fail-on-unused-args --export-compile-commands --root="$ROOT" --dotfile="$ROOT"/build_for_wifi_gnfile.gn --args="silabs_board=\"$SILABS_BOARD\" $optArgs" "$BUILD_DIR"
else
# OpenThread/SoC build
#
Expand All @@ -263,11 +292,16 @@ else
fi

if [ -z "$optArgs" ]; then
gn gen --check --fail-on-unused-args --export-compile-commands --root="$ROOT" --args="silabs_board=\"$SILABS_BOARD\"" "$BUILD_DIR"
"$GN_PATH" gen --check --script-executable="/usr/bin/python3" --root="$ROOT" --args="silabs_board=\"$SILABS_BOARD\"" "$BUILD_DIR"
jepenven-silabs marked this conversation as resolved.
Show resolved Hide resolved
else
gn gen --check --fail-on-unused-args --export-compile-commands --root="$ROOT" --args="silabs_board=\"$SILABS_BOARD\" $optArgs" "$BUILD_DIR"
"$GN_PATH" gen --check --script-executable="/usr/bin/python3" --root="$ROOT" --args="silabs_board=\"$SILABS_BOARD\" $optArgs" "$BUILD_DIR"
fi
fi

# Activation needs to be after SLC generation which is done in gn gen.
# Zap generation requires activation and is done in the build phase
source "$CHIP_ROOT/scripts/activate.sh"

ninja -v -C "$BUILD_DIR"/
#print stats
arm-none-eabi-size -A "$BUILD_DIR"/*.out
Expand Down
Loading