Skip to content

Commit

Permalink
Merge branch 'master' into esp32/enable_extended_ble_adv
Browse files Browse the repository at this point in the history
  • Loading branch information
sayondeep authored Mar 26, 2024
2 parents 79f4e0a + d26d2e5 commit 21f72d5
Show file tree
Hide file tree
Showing 93 changed files with 6,609 additions and 9,876 deletions.
2 changes: 1 addition & 1 deletion .github/actions/bootstrap-cache/action.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Bootstrap cache
description: Bootstrap cache
description: Bootstrap cache (deprecated)
runs:
using: "composite"
steps:
Expand Down
51 changes: 49 additions & 2 deletions .github/actions/bootstrap/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,56 @@ inputs:
description: "Platform name"
required: false
default: none
bootstrap-log-name:
description: "Bootstrap log name"
required: false
default: bootstrap-logs-${{ github.job }}
outputs:
cache-hit:
description: "Bootstrap environment was restored from cache"
value: ${{ fromJSON(steps.bootstrap-cache.outputs.outputs).cache-hit }} # retry returns all outputs in `outputs`

runs:
using: "composite"
steps:
- name: Bootstrap
- name: Calculate bootstrap cache key
id: bootstrap-cache-key
shell: bash
run: |
# Calculate bootstrap cache key
# In addition to the various setup files, the work directory matters as well,
# because the bootstrapped Pigweed environment contains absolute paths.
FILES_HASH="${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }}"
FINAL_HASH="$(echo "$PWD:$FILES_HASH" | shasum -a 256 | cut -d' ' -f1)"
echo "Calculated bootstrap cache key for '$PWD': $FINAL_HASH"
echo "hash=$FINAL_HASH" >> "$GITHUB_OUTPUT"
- uses: Wandalen/[email protected]
name: Bootstrap from cache
id: bootstrap-cache
continue-on-error: true
with:
action: buildjet/cache@v4
attempt_limit: 3
attempt_delay: 2000
with: |
key: ${{ runner.os }}-${{ runner.arch }}-${{ inputs.platform }}-${{ steps.bootstrap-cache-key.outputs.hash}}
path: |
.environment
build_overrides/pigweed_environment.gni
- name: Run bootstrap
if: fromJSON(steps.bootstrap-cache.outputs.outputs).cache-hit != 'true'
env:
PW_NO_CIPD_CACHE_DIR: Y
shell: bash
run: bash scripts/bootstrap.sh -p all,${{ inputs.platform }}
run: source scripts/bootstrap.sh -p all,${{ inputs.platform }}

- name: Uploading bootstrap logs
uses: actions/upload-artifact@v4
if: always() && !env.ACT && fromJSON(steps.bootstrap-cache.outputs.outputs).cache-hit != 'true'
with:
name: ${{ inputs.bootstrap-log-name }}
path: |
.environment/gn_out/.ninja_log
.environment/pigweed-venv/*.log
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,14 @@ runs:
with:
platform: ${{ inputs.platform }}
extra-parameters: ${{ inputs.extra-submodule-parameters }}
- name: Bootstrap Cache
uses: ./.github/actions/bootstrap-cache
- name: Bootstrap
uses: ./.github/actions/bootstrap
env:
PW_NO_CIPD_CACHE_DIR: Y
with:
platform: ${{ inputs.platform }}
bootstrap-log-name: ${{ inputs.bootstrap-log-name }}
- name: Dump disk info after checkout submodule & Bootstrap
shell: bash
run: scripts/dump_diskspace_info.sh
- name: Upload Bootstrap Logs
uses: ./.github/actions/upload-bootstrap-logs
with:
bootstrap-log-name: ${{ inputs.bootstrap-log-name }}
- name: Work around TSAN ASLR issues
if: runner.os == 'Linux' && !env.ACT
shell: bash
Expand Down
18 changes: 0 additions & 18 deletions .github/actions/upload-bootstrap-logs/action.yaml

This file was deleted.

1 change: 1 addition & 0 deletions .github/workflows/cirque.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ jobs:
with:
platform: linux

# TODO: Is what's being cached here actually compatible with a regular bootstrap?
- name: Bootstrap Cache
uses: ./.github/actions/bootstrap-cache
- name: Bootstrap Cirque
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/examples-efr32.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ jobs:
timeout-minutes: 30
run: |
scripts/examples/gn_silabs_example.sh examples/lighting-app/silabs ./out/light-app BRD4187C --slc_generate --docker
scripts/examples/gn_silabs_example.sh examples/lighting-app/silabs ./out/light-app BRD4164A --slc_generate --docker
rm -rf ./out/
- name: Build some BRD4187C variants (1)
run: |
Expand Down Expand Up @@ -115,6 +114,7 @@ jobs:
"./scripts/build/build_examples.py \
--enable-flashbundle \
--target efr32-brd4338a-light-wifi-917_soc-skip_rps_generation \
--target efr32-brd4338a-lock-wifi-917_soc-skip_rps_generation \
build \
--copy-artifacts-to out/artifacts \
"
Expand Down
8 changes: 0 additions & 8 deletions .github/workflows/fuzzing-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,8 @@ jobs:
run: |
mkdir objdir-clone || true
- name: Bootstrap Cache
uses: ./.github/actions/bootstrap-cache
- name: Bootstrap
uses: ./.github/actions/bootstrap
- name: Upload Bootstrap Logs
uses: ./.github/actions/upload-bootstrap-logs

- name: Build all-clusters-app
run: |
Expand Down Expand Up @@ -84,12 +80,8 @@ jobs:
run: |
mkdir objdir-clone || true
- name: Bootstrap Cache
uses: ./.github/actions/bootstrap-cache
- name: Bootstrap
uses: ./.github/actions/bootstrap
- name: Upload Bootstrap Logs
uses: ./.github/actions/upload-bootstrap-logs

- name: Build all-clusters-app
run: |
Expand Down
8 changes: 0 additions & 8 deletions .github/workflows/release_artifacts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,8 @@ jobs:
uses: actions/checkout@v4
with:
ref: "${{ github.event.inputs.releaseTag }}"
- name: Bootstrap Cache
uses: ./.github/actions/bootstrap-cache
- name: Bootstrap
uses: ./.github/actions/bootstrap
- name: Upload Bootstrap Logs
uses: ./.github/actions/upload-bootstrap-logs

- name: Build
run: scripts/examples/esp_example.sh all-clusters-app
Expand Down Expand Up @@ -74,12 +70,8 @@ jobs:
uses: actions/checkout@v4
with:
ref: "${{ github.event.inputs.releaseTag }}"
- name: Bootstrap Cache
uses: ./.github/actions/bootstrap-cache
- name: Bootstrap
uses: ./.github/actions/bootstrap
- name: Upload Bootstrap Logs
uses: ./.github/actions/upload-bootstrap-logs

- name: Build example EFR32 Lock App
run: scripts/examples/gn_silabs_example.sh examples/lock-app/efr32/
Expand Down
1 change: 1 addition & 0 deletions .restyled.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ exclude:
- "examples/chef/sample_app_util/test_files/*.yaml"
- "examples/chef/zzz_generated/**/*"
- "examples/platform/nxp/k32w/k32w0/scripts/demo_generated_certs/**/*"
- "examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/zap-generated/*" # zap-generated files
- "integrations/cloudbuild/*.yaml" # uglier long command line content
- "scripts/run_codegen_targets.sh" # shellharden breaks for loops over command outputs
- "scripts/tagging/tag_new_release.sh" # shellharden breaks parameter passing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ std::string getMacAddress()
}

char macStr[chip::DeviceLayer::ConfigurationManager::kPrimaryMACAddressLength * 2 + 1] = { 0 }; // added null char
if (BytesToHex(&macBuffer[0], sizeof(macBuffer), &macStr[0], sizeof(macBuffer) * 2u, chip::Encoding::HexFlags::kUppercase) !=
if (BytesToHex(mac.data(), mac.size(), &macStr[0], sizeof(macBuffer) * 2u, chip::Encoding::HexFlags::kUppercase) !=
CHIP_NO_ERROR)
{
ChipLogProgress(Zcl, "WakeOnLanManager::getMacAddress hex conversion failed");
Expand Down
72 changes: 68 additions & 4 deletions examples/platform/silabs/MatterConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@
#include "wfx_rsi.h"
#endif /* SLI_SI91X_MCU_INTERFACE */

using namespace ::chip;
using namespace ::chip::Inet;
using namespace ::chip::DeviceLayer;

#include <crypto/CHIPCryptoPAL.h>
// If building with the EFR32-provided crypto backend, we can use the
// opaque keystore
Expand All @@ -75,6 +71,36 @@ static chip::DeviceLayer::Internal::Efr32PsaOperationalKeystore gOperationalKeys
#include <performance_test_commands.h>
#endif

#include <AppTask.h>

#include <DeviceInfoProviderImpl.h>
#include <app/server/Server.h>
#include <credentials/DeviceAttestationCredsProvider.h>
#include <examples/platform/silabs/SilabsDeviceAttestationCreds.h>

#include <platform/silabs/platformAbstraction/SilabsPlatform.h>

#include "FreeRTOSConfig.h"
#include "event_groups.h"
#include "task.h"

/**********************************************************
* Defines
*********************************************************/

#define MAIN_TASK_STACK_SIZE (1024 * 5)
#define MAIN_TASK_PRIORITY (configMAX_PRIORITIES - 1)

using namespace ::chip;
using namespace ::chip::Inet;
using namespace ::chip::DeviceLayer;
using namespace ::chip::Credentials::Silabs;
using namespace chip::DeviceLayer::Silabs;

TaskHandle_t main_Task;
volatile int apperror_cnt;
static chip::DeviceLayer::DeviceInfoProviderImpl gExampleDeviceInfoProvider;

#if CHIP_ENABLE_OPENTHREAD
#include <inet/EndPointStateOpenThread.h>
#include <openthread/cli.h>
Expand Down Expand Up @@ -129,6 +155,44 @@ CHIP_ERROR SilabsMatterConfig::InitOpenThread(void)
}
#endif // CHIP_ENABLE_OPENTHREAD

namespace {
void application_start(void * unused)
{
CHIP_ERROR err = SilabsMatterConfig::InitMatter(BLE_DEV_NAME);
if (err != CHIP_NO_ERROR)
appError(err);

gExampleDeviceInfoProvider.SetStorageDelegate(&chip::Server::GetInstance().GetPersistentStorage());
chip::DeviceLayer::SetDeviceInfoProvider(&gExampleDeviceInfoProvider);

chip::DeviceLayer::PlatformMgr().LockChipStack();
// Initialize device attestation config
SetDeviceAttestationCredentialsProvider(Credentials::Silabs::GetSilabsDacProvider());
chip::DeviceLayer::PlatformMgr().UnlockChipStack();

SILABS_LOG("Starting App Task");
err = AppTask::GetAppTask().StartAppTask();
if (err != CHIP_NO_ERROR)
appError(err);

vTaskDelete(main_Task);
}
} // namespace

void SilabsMatterConfig::AppInit()
{
GetPlatform().Init();

xTaskCreate(application_start, "main_task", MAIN_TASK_STACK_SIZE, NULL, MAIN_TASK_PRIORITY, &main_Task);
SILABS_LOG("Starting scheduler");
GetPlatform().StartScheduler();

// Should never get here.
chip::Platform::MemoryShutdown();
SILABS_LOG("Start Scheduler Failed");
appError(CHIP_ERROR_INTERNAL);
}

#if SILABS_OTA_ENABLED
void SilabsMatterConfig::InitOTARequestorHandler(System::Layer * systemLayer, void * appState)
{
Expand Down
1 change: 1 addition & 0 deletions examples/platform/silabs/MatterConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class SilabsMatterConfig
{
public:
static CHIP_ERROR InitMatter(const char * appName);
static void AppInit();

private:
static CHIP_ERROR InitOpenThread(void);
Expand Down
4 changes: 4 additions & 0 deletions examples/platform/silabs/SiWx917/SiWx917/sl_wifi_if.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@
#include "FreeRTOS.h"
#include "event_groups.h"
#include "sl_board_configuration.h"
extern "C" {
#include "sl_si91x_types.h"
#include "sl_wifi_constants.h"
#include "sl_wifi_types.h"
#include "sl_wlan_config.h"
}
#include "task.h"

#if (EXP_BOARD)
Expand All @@ -40,8 +42,10 @@
#if SL_ICD_ENABLED && SLI_SI91X_MCU_INTERFACE
#include "rsi_rom_power_save.h"
#include "sl_si91x_button_pin_config.h"
extern "C" {
#include "sl_si91x_driver.h"
#include "sl_si91x_m4_ps.h"
}

// TODO: should be removed once we are getting the press interrupt for button 0 with sleep
#define BUTTON_PRESSED 1
Expand Down
Loading

0 comments on commit 21f72d5

Please sign in to comment.