Amazon Sidewalk - SoC Empty Sample Application#
Create and Compile the Application#
You can create and compile the Amazon Sidewalk Empty sample application just like any other Amazon Sidewalk application. This bare application only initializes the Amazon Sidewalk Stack.
Provision your Device using Scripts#
To automate device creation for prototyping, scripts are available to create the necessary objects in the cloud and generate the manufacturing page. These scripts are provided in the Silicon Labs extension for Amazon Sidewalk Github repository. To set up a prototype device and register it to the network, the following steps are necessary:
Deploy your application in AWS.
Compile and flash an application for your embedded device.
Create a device profile in AWS.
Create a wireless device in AWS.
Generate a manufacturing page.
Flash the manufacturing page to your embedded device.
You can deploy your AWS application automatically using dedicated tools like Amazon CloudFormation. You can compile and flash your application using Simplicity Studio 5. To create the device profile, wireless device, and manufacturing page you can use Silicon Labs' prototyping script.
Remember to install the requirements listed in the requirements.txt
file under amazon_dependencies
with pip3 install -r requirements.txt
.
The script configuration is handled by a JSON file like the following:
{
"awsAccount": {
"awsRegion": "us-east-1",
"awsProfile": "default"
},
"commanderPath": "C:\\SiliconLabs\\SimplicityStudio\\v5_4\\developer\\adapter_packs\\commander\\commander.exe",
"generationRequests": [
{
"deviceProfileId": null,
"deviceName": null,
"destinationName": "CFSDestination",
"targetPart": null,
"quantity": 1
}
]
}
An example configuration file is provided at the root of the repository.
The first block awsAccount
is used to configure the connection to AWS cloud:
awsRegion
: The AWS region you would like to add your devices to (Note that only theus-east-1
region is supported at the moment).awsProfile
: Used to choose the AWS CLI profile linking to the correct credentials. If you do not use profiles, you can leave the default.
The second block defines the toolchain used to create the manufacturing page:
commanderPath
: Should link to the the Simplicity Commander executable file.
The third block generationRequests
controls the target device details:
deviceProfileId
: If this is your first time running the script, it should be empty. If not, it contains your Device Profile ID (this field is filled automatically).deviceName
: This is optional, you can choose to give a custom name to your device.destinationName
: Should be the name of the destination used by your AWS cloud application.targetPart
: The OPN of the target part. If empty, manufacturing pages for all supported radio boards will be generated.quantity
: The quantity of devices you want to create (default value is 1).
On the first run, the script creates a prototyping device profile and fills the deviceProfileId
with the resulting device ID. All subsequent wireless devices will be created using this device profile. Note that during prototyping, a device profile can be linked to a maximum of 1000 wireless devices.
To start the script, execute the following:
python3 generate_prototype.py --input <.> --output <output_folder> --config example_config.json
The script creates a directory structure as follows in the chosen output folder under mfg_output
:
DeviceProfile_7c51bc6b-0556-2083-6f0d-aeb750c94508
├── DeviceProfile.json
└── WirelessDevice_db57b1c9-22ad-c052-07ae-1e1cae9bb384
├── SiLabs_MFG.nvm3
├── Silabs_xG21.s37
├── Silabs_xG23.s37
├── Silabs_xG24.s37
├── Silabs_xG28.s37
└── WirelessDevice.json
The first directory is named with the device id of your device profile and contains DeviceProfile.json
, which contains your device profile information. Then a directory is created for every wireless device you created. One wireless device contains manufacturing pages for all supported platforms and a WirelessDevice.json
file containing your device information (including private keys).
To use the script with command-line arguments instead of a configuration file, simply drop the --config
parameter.
usage: generate_prototype.py [-h] -in INPUT -out OUTPUT [-p AWS_PROFILE] [-n NAME] [-d DST_NAME] [-t TARGET] [-c COMMANDER] [-cfg CONFIG]
optional arguments:
-h, --help show this help message and exit
-in INPUT, --input INPUT
Path of the input directory
-out OUTPUT, --output OUTPUT
Path of the output directory
-p AWS_PROFILE, --aws-profile AWS_PROFILE
Name of your AWS profile from .aws/credentials (default: default)
-n NAME, --name NAME Specified name for the newly created device (default: sidewalk_[user]_device)
-d DST_NAME, --dst-name DST_NAME
Destination name used for uplink traffic routing (default: CFSDestination)
-t TARGET, --target TARGET
Target part number for which the MFG page generation has to be done (default: all)
-c COMMANDER, --commander COMMANDER
Path to commander executable, not needed if already in system PATH
-cfg CONFIG, --config CONFIG
Configuration file, if provided other arguments are ignored
You can directly flash the generated .s37 file using Simplicity Commander.
Provision your Device with Secure Vault#
Ⓘ INFO Ⓘ: This is an optional step, you can decide to try this feature or not.
On Silicon Labs EFR32 Series 2 platforms, you can leverage Secure Vault to store sensitive data (private keys) in a secure place. Amazon Sidewalk can leverage the Secure Vault to store the device private keys. Silicon Labs provides scripts to provision a device directly using Secure Vault for the manufacturing and during prototyping phase: Provision your prototyping device with Secure Vault.