Skip to content

Commit

Permalink
Merge branch 'master' into bugfix/config_modifications
Browse files Browse the repository at this point in the history
  • Loading branch information
chirag-silabs authored Mar 7, 2023
2 parents f3aa3be + fc0e4a2 commit f95d6b8
Show file tree
Hide file tree
Showing 54 changed files with 2,434 additions and 663 deletions.
1 change: 0 additions & 1 deletion .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ exclude = third_party
# temporarily scan only directories with fixed files
# TODO: Remove the paths below when all bugs are fixed
src/tools/chip-cert/*
src/test_driver/openiotsdk/*
src/test_driver/mbed/*
src/test_driver/linux-cirque/*
build/chip/java/tests/*
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/examples-cc32xx.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
volumes:
- "/tmp/bloat_reports:/tmp/bloat_reports"
steps:
- uses: Wandalen/[email protected].15
- uses: Wandalen/[email protected].36
name: Checkout
with:
action: actions/checkout@v3
Expand Down Expand Up @@ -67,7 +67,7 @@ jobs:
timeout-minutes: 25
run: scripts/build/gn_bootstrap.sh
- name: Uploading bootstrap logs
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
if: ${{ always() && !env.ACT }}
with:
name: bootstrap-logs
Expand All @@ -92,7 +92,7 @@ jobs:
/tmp/bloat_reports/
- name: Uploading Size Reports
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
if: ${{ !env.ACT }}
with:
name: Size,cc32xx-Examples,${{ env.GH_EVENT_PR }},${{ env.GH_EVENT_HASH }},${{ env.GH_EVENT_PARENT }},${{ github.event_name }}
Expand Down
38 changes: 37 additions & 1 deletion .github/workflows/examples-telink.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ jobs:
out/telink-tlsr9518adk80d-all-clusters/zephyr/zephyr.elf \
/tmp/bloat_reports/
- name: clean out build output
run: rm -rf ./out

- name: Build example Telink All Clusters Minimal App
run: |
./scripts/run_in_build_env.sh \
Expand All @@ -88,6 +91,9 @@ jobs:
out/telink-tlsr9518adk80d-all-clusters-minimal/zephyr/zephyr.elf \
/tmp/bloat_reports/
- name: clean out build output
run: rm -rf ./out

- name: Build example Telink Contact Sensor App
run: |
./scripts/run_in_build_env.sh \
Expand All @@ -97,6 +103,9 @@ jobs:
out/telink-tlsr9518adk80d-contact-sensor/zephyr/zephyr.elf \
/tmp/bloat_reports/
- name: clean out build output
run: rm -rf ./out

- name: Build example Telink Lighting App
run: |
./scripts/run_in_build_env.sh \
Expand All @@ -106,15 +115,21 @@ jobs:
out/telink-tlsr9518adk80d-light/zephyr/zephyr.elf \
/tmp/bloat_reports/
- name: clean out build output
run: rm -rf ./out

- name: Build example Telink Lighting App with RPC
run: |
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py --target 'telink-tlsr9518adk80d-light-rpc' build"
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
telink tlsr9518adk80d lighting-app-rpc \
out/telink-tlsr9518adk80d-light/zephyr/zephyr.elf \
out/telink-tlsr9518adk80d-light-rpc/zephyr/zephyr.elf \
/tmp/bloat_reports/
- name: clean out build output
run: rm -rf ./out

- name: Build example Telink Light Switch App
run: |
./scripts/run_in_build_env.sh \
Expand All @@ -124,6 +139,9 @@ jobs:
out/telink-tlsr9518adk80d-light-switch/zephyr/zephyr.elf \
/tmp/bloat_reports/
- name: clean out build output
run: rm -rf ./out

- name: Build example Telink Lock App
run: |
./scripts/run_in_build_env.sh \
Expand All @@ -133,6 +151,9 @@ jobs:
out/telink-tlsr9518adk80d-lock/zephyr/zephyr.elf \
/tmp/bloat_reports/
- name: clean out build output
run: rm -rf ./out

- name: Build example Telink OTA Requestor App
run: |
./scripts/run_in_build_env.sh \
Expand All @@ -142,6 +163,9 @@ jobs:
out/telink-tlsr9518adk80d-ota-requestor/zephyr/zephyr.elf \
/tmp/bloat_reports/
- name: clean out build output
run: rm -rf ./out

- name: Build example Telink Pump App
run: |
./scripts/run_in_build_env.sh \
Expand All @@ -151,6 +175,9 @@ jobs:
out/telink-tlsr9518adk80d-pump/zephyr/zephyr.elf \
/tmp/bloat_reports/
- name: clean out build output
run: rm -rf ./out

- name: Build example Telink Pump Controller App
run: |
./scripts/run_in_build_env.sh \
Expand All @@ -160,6 +187,9 @@ jobs:
out/telink-tlsr9518adk80d-pump-controller/zephyr/zephyr.elf \
/tmp/bloat_reports/
- name: clean out build output
run: rm -rf ./out

- name: Build example Telink Temperature Measurement App
run: |
./scripts/run_in_build_env.sh \
Expand All @@ -169,6 +199,9 @@ jobs:
out/telink-tlsr9518adk80d-temperature-measurement/zephyr/zephyr.elf \
/tmp/bloat_reports/
- name: clean out build output
run: rm -rf ./out

- name: Build example Telink Thermostat App
run: |
./scripts/run_in_build_env.sh \
Expand All @@ -178,6 +211,9 @@ jobs:
out/telink-tlsr9518adk80d-thermostat/zephyr/zephyr.elf \
/tmp/bloat_reports/
- name: clean out build output
run: rm -rf ./out

- name: Uploading Size Reports
uses: actions/upload-artifact@v3
if: ${{ !env.ACT }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unit_integration_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
.environment/pigweed-venv/*.log
- name: Artifact suffix
id: outsuffix
uses: haya14busa/action-cond@v1.0.0
uses: haya14busa/action-cond@v1
if: ${{ !env.ACT }}
with:
cond: ${{ github.event.pull_request.number == '' }}
Expand Down
13 changes: 10 additions & 3 deletions config/esp32/components/chip/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ include(${CMAKE_CURRENT_LIST_DIR}/ota-image.cmake)

set(CHIP_REQUIRE_COMPONENTS freertos lwip bt mbedtls fatfs app_update console openthread nvs_flash spi_flash)

if((NOT "${IDF_TARGET}" STREQUAL "esp32h2") AND (NOT "${IDF_TARGET}" STREQUAL "esp32c2"))
if(NOT "${IDF_TARGET}" STREQUAL "esp32h2")
list(APPEND CHIP_REQUIRE_COMPONENTS mdns)
endif()

Expand Down Expand Up @@ -314,8 +314,15 @@ if(CONFIG_OPENTHREAD_ENABLED)
list(APPEND chip_libraries $<TARGET_FILE:${openthread_lib}>)
endif()

if((NOT CONFIG_USE_MINIMAL_MDNS) AND (NOT CONFIG_IDF_TARGET_ESP32H2) AND (NOT CONFIG_IDF_TARGET_ESP32C2))
idf_component_get_property(mdns_lib mdns COMPONENT_LIB)
if((NOT CONFIG_USE_MINIMAL_MDNS) AND (NOT CONFIG_IDF_TARGET_ESP32H2))
idf_build_get_property(build_components BUILD_COMPONENTS)
# For IDF v5.x, the mdns component was moved to idf_managed_components.
# We should use 'espressif__mdns' for 'idf_component_get_property'.
if("espressif__mdns" IN_LIST build_components)
idf_component_get_property(mdns_lib espressif__mdns COMPONENT_LIB)
elseif("mdns" IN_LIST build_components)
idf_component_get_property(mdns_lib mdns COMPONENT_LIB)
endif()
list(APPEND chip_libraries $<TARGET_FILE:${mdns_lib}>)
endif()

Expand Down
8 changes: 4 additions & 4 deletions examples/lock-app/silabs/SiWx917/include/LockManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ static constexpr uint8_t kMaxCredentialsPerUser = 10;
static constexpr uint8_t kMaxWeekdaySchedulesPerUser = 10;
static constexpr uint8_t kMaxYeardaySchedulesPerUser = 10;
static constexpr uint8_t kMaxHolidaySchedules = 10;
static constexpr uint8_t kMaxCredentialSize = 8;
static constexpr uint8_t kMaxCredentialSize = 20;
static constexpr uint8_t kNumCredentialTypes = 6;

static constexpr uint8_t kMaxCredentials = kMaxUsers * kMaxCredentialsPerUser;
} // namespace ResourceRanges

namespace LockInitParams {
Expand Down Expand Up @@ -200,13 +200,13 @@ class LockManager
static void ActuatorMovementTimerEventHandler(AppEvent * aEvent);

EmberAfPluginDoorLockUserInfo mLockUsers[kMaxUsers];
EmberAfPluginDoorLockCredentialInfo mLockCredentials[kMaxCredentials];
EmberAfPluginDoorLockCredentialInfo mLockCredentials[kNumCredentialTypes][kMaxCredentialsPerUser];
WeekDaysScheduleInfo mWeekdaySchedule[kMaxUsers][kMaxWeekdaySchedulesPerUser];
YearDayScheduleInfo mYeardaySchedule[kMaxUsers][kMaxYeardaySchedulesPerUser];
HolidayScheduleInfo mHolidaySchedule[kMaxHolidaySchedules];

char mUserNames[ArraySize(mLockUsers)][DOOR_LOCK_MAX_USER_NAME_SIZE];
uint8_t mCredentialData[kMaxCredentials][kMaxCredentialSize];
uint8_t mCredentialData[kNumCredentialTypes][kMaxCredentialsPerUser][kMaxCredentialSize];
CredentialStruct mCredentials[kMaxUsers][kMaxCredentialsPerUser];

static LockManager sLock;
Expand Down
34 changes: 17 additions & 17 deletions examples/lock-app/silabs/SiWx917/src/LockManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,9 @@ bool LockManager::ReadConfigValues()
SilabsConfig::ReadConfigValueBin(SilabsConfig::kConfigKey_LockUser, reinterpret_cast<uint8_t *>(&mLockUsers),
sizeof(EmberAfPluginDoorLockUserInfo) * ArraySize(mLockUsers), outLen);

SilabsConfig::ReadConfigValueBin(SilabsConfig::kConfigKey_Credential, reinterpret_cast<uint8_t *>(&mLockCredentials),
sizeof(EmberAfPluginDoorLockCredentialInfo) * ArraySize(mLockCredentials), outLen);
SilabsConfig::ReadConfigValueBin(
SilabsConfig::kConfigKey_Credential, reinterpret_cast<uint8_t *>(&mLockCredentials),
sizeof(EmberAfPluginDoorLockCredentialInfo) * LockParams.numberOfCredentialsPerUser * kNumCredentialTypes, outLen);

SilabsConfig::ReadConfigValueBin(SilabsConfig::kConfigKey_LockUserName, reinterpret_cast<uint8_t *>(mUserNames),
sizeof(mUserNames), outLen);
Expand Down Expand Up @@ -378,12 +379,9 @@ bool LockManager::SetUser(chip::EndpointId endpointId, uint16_t userIndex, chip:

for (size_t i = 0; i < totalCredentials; ++i)
{
mCredentials[userIndex][i] = credentials[i];
// TODO: Why are we modifying the passed-in credentials?
// https://github.com/project-chip/connectedhomeip/issues/25082
// For now, preserve pre-existing behavior, which set credentialType to 1.
mCredentials[userIndex][i].credentialType = CredentialTypeEnum::kPin;
mCredentials[userIndex][i].credentialIndex = i + 1;
mCredentials[userIndex][i] = credentials[i];
mCredentials[userIndex][i].credentialType = credentials[i].credentialType;
mCredentials[userIndex][i].credentialIndex = credentials[i].credentialIndex;
}

userInStorage.credentials = chip::Span<const CredentialStruct>(mCredentials[userIndex], totalCredentials);
Expand Down Expand Up @@ -420,7 +418,7 @@ bool LockManager::GetCredential(chip::EndpointId endpointId, uint16_t credential
ChipLogProgress(Zcl, "Lock App: LockManager::GetCredential [credentialType=%u], credentialIndex=%d",
to_underlying(credentialType), credentialIndex);

const auto & credentialInStorage = mLockCredentials[credentialIndex];
const auto & credentialInStorage = mLockCredentials[to_underlying(credentialType)][credentialIndex];

credential.status = credentialInStorage.status;
ChipLogDetail(Zcl, "CredentialStatus: %d, CredentialIndex: %d ", (int) credential.status, credentialIndex);
Expand Down Expand Up @@ -465,19 +463,21 @@ bool LockManager::SetCredential(chip::EndpointId endpointId, uint16_t credential
"[credentialStatus=%u,credentialType=%u,credentialDataSize=%u,creator=%d,modifier=%d]",
to_underlying(credentialStatus), to_underlying(credentialType), credentialData.size(), creator, modifier);

auto & credentialInStorage = mLockCredentials[credentialIndex];
auto & credentialInStorage = mLockCredentials[to_underlying(credentialType)][credentialIndex];

credentialInStorage.status = credentialStatus;
credentialInStorage.credentialType = credentialType;
credentialInStorage.createdBy = creator;
credentialInStorage.lastModifiedBy = modifier;

memcpy(mCredentialData[credentialIndex], credentialData.data(), credentialData.size());
credentialInStorage.credentialData = chip::ByteSpan{ mCredentialData[credentialIndex], credentialData.size() };
memcpy(mCredentialData[to_underlying(credentialType)][credentialIndex], credentialData.data(), credentialData.size());
credentialInStorage.credentialData =
chip::ByteSpan{ mCredentialData[to_underlying(credentialType)][credentialIndex], credentialData.size() };

// Save credential information in NVM flash
SilabsConfig::WriteConfigValueBin(SilabsConfig::kConfigKey_Credential, reinterpret_cast<const uint8_t *>(&mLockCredentials),
sizeof(EmberAfPluginDoorLockCredentialInfo) * LockParams.numberOfCredentialsPerUser);
sizeof(EmberAfPluginDoorLockCredentialInfo) * LockParams.numberOfCredentialsPerUser *
kNumCredentialTypes);

SilabsConfig::WriteConfigValueBin(SilabsConfig::kConfigKey_CredentialData, reinterpret_cast<const uint8_t *>(&mCredentialData),
sizeof(mCredentialData));
Expand Down Expand Up @@ -682,15 +682,15 @@ bool LockManager::setLockState(chip::EndpointId endpointId, DlLockState lockStat
}

// Check the PIN code
for (uint8_t i = 0; i < kMaxCredentials; i++)
for (uint8_t i = 0; i < kMaxCredentialsPerUser; i++)
{
if (mLockCredentials[i].credentialType != CredentialTypeEnum::kPin ||
mLockCredentials[i].status == DlCredentialStatus::kAvailable)

if (mLockCredentials[to_underlying(CredentialTypeEnum::kPin)][i].status == DlCredentialStatus::kAvailable)
{
continue;
}

if (mLockCredentials[i].credentialData.data_equal(pin.Value()))
if (mLockCredentials[to_underlying(CredentialTypeEnum::kPin)][i].credentialData.data_equal(pin.Value()))
{
ChipLogDetail(Zcl,
"Lock App: specified PIN code was found in the database, setting lock state to \"%s\" [endpointId=%d]",
Expand Down
8 changes: 4 additions & 4 deletions examples/lock-app/silabs/efr32/include/LockManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ static constexpr uint8_t kMaxCredentialsPerUser = 10;
static constexpr uint8_t kMaxWeekdaySchedulesPerUser = 10;
static constexpr uint8_t kMaxYeardaySchedulesPerUser = 10;
static constexpr uint8_t kMaxHolidaySchedules = 10;
static constexpr uint8_t kMaxCredentialSize = 8;
static constexpr uint8_t kMaxCredentialSize = 20;
static constexpr uint8_t kNumCredentialTypes = 6;

static constexpr uint8_t kMaxCredentials = kMaxUsers * kMaxCredentialsPerUser;
} // namespace ResourceRanges

namespace LockInitParams {
Expand Down Expand Up @@ -200,13 +200,13 @@ class LockManager
static void ActuatorMovementTimerEventHandler(AppEvent * aEvent);

EmberAfPluginDoorLockUserInfo mLockUsers[kMaxUsers];
EmberAfPluginDoorLockCredentialInfo mLockCredentials[kMaxCredentials];
EmberAfPluginDoorLockCredentialInfo mLockCredentials[kNumCredentialTypes][kMaxCredentialsPerUser];
WeekDaysScheduleInfo mWeekdaySchedule[kMaxUsers][kMaxWeekdaySchedulesPerUser];
YearDayScheduleInfo mYeardaySchedule[kMaxUsers][kMaxYeardaySchedulesPerUser];
HolidayScheduleInfo mHolidaySchedule[kMaxHolidaySchedules];

char mUserNames[ArraySize(mLockUsers)][DOOR_LOCK_MAX_USER_NAME_SIZE];
uint8_t mCredentialData[kMaxCredentials][kMaxCredentialSize];
uint8_t mCredentialData[kNumCredentialTypes][kMaxCredentialsPerUser][kMaxCredentialSize];
CredentialStruct mCredentials[kMaxUsers][kMaxCredentialsPerUser];

static LockManager sLock;
Expand Down
Loading

0 comments on commit f95d6b8

Please sign in to comment.