Skip to content

Commit

Permalink
Merge branch 'master' of github.com:selissia/connectedhomeip into sil…
Browse files Browse the repository at this point in the history
…abs-ota-header
  • Loading branch information
selissia committed Mar 11, 2022
2 parents 5f27da6 + c219807 commit 5bf8bf4
Show file tree
Hide file tree
Showing 231 changed files with 13,792 additions and 4,475 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,24 @@
# See the License for the specific language governing permissions and
# limitations under the License.

name: Full builds - Mbed OS
name: Build example - Mbed OS

on:
push:
pull_request:
workflow_dispatch:

concurrency:
group: full-${{ github.ref }}-${{ github.workflow }}-${{ (github.event_name == 'pull_request' && github.event.number) || (github.event_name == 'workflow_dispatch' && github.run_number) || github.sha }}
group: ${{ github.ref }}-${{ github.workflow }}-${{ (github.event_name == 'pull_request' && github.event.number) || (github.event_name == 'workflow_dispatch' && github.run_number) || github.sha }}
cancel-in-progress: true

jobs:
mbedos:
name: Run
name: Mbed OS examples building
timeout-minutes: 200

env:
BUILD_TYPE: mbedos
APP_PROFILE: release
APP_TARGET: CY8CPROTO_062_4343W

Expand All @@ -50,6 +52,16 @@ jobs:
attempt_limit: 3
attempt_delay: 2000

- name: Detect changed paths
uses: dorny/paths-filter@v2
id: changed_paths
with:
filters: |
mbed:
- '**/mbed/**'
pigweedapp:
- 'examples/pigweed-app/mbed/**'
- name: Set up environment for size reports
if: ${{ !env.ACT }}
env:
Expand Down Expand Up @@ -79,6 +91,7 @@ jobs:
/tmp/bloat_reports/
- name: Build lighting-app example
if: github.event_name == 'push' || steps.changed_paths.outputs.mbed == 'true'
timeout-minutes: 20
run: |
scripts/examples/mbed_example.sh -a=lighting-app -b=$APP_TARGET -p=$APP_PROFILE
Expand All @@ -88,6 +101,7 @@ jobs:
/tmp/bloat_reports/
- name: Build pigweed-app example
if: github.event_name == 'push' || steps.changed_paths.outputs.pigweedapp == 'true'
timeout-minutes: 20
run: |
scripts/examples/mbed_example.sh -a=pigweed-app -b=$APP_TARGET -p=$APP_PROFILE
Expand All @@ -97,6 +111,7 @@ jobs:
/tmp/bloat_reports/
- name: Build all-clusters-app example
if: github.event_name == 'push' || steps.changed_paths.outputs.mbed == 'true'
timeout-minutes: 20
run: |
scripts/examples/mbed_example.sh -a=all-clusters-app -b=$APP_TARGET -p=$APP_PROFILE
Expand All @@ -106,6 +121,7 @@ jobs:
/tmp/bloat_reports/
- name: Build shell example
if: github.event_name == 'push' || steps.changed_paths.outputs.mbed == 'true'
timeout-minutes: 20
run: |
scripts/examples/mbed_example.sh -a=shell -b=$APP_TARGET -p=$APP_PROFILE
Expand All @@ -115,14 +131,15 @@ jobs:
/tmp/bloat_reports/
- name: Build ota-requestor-app example
if: github.event_name == 'push' || steps.changed_paths.outputs.mbed == 'true'
timeout-minutes: 20
run: |
scripts/examples/mbed_example.sh -a=ota-requestor-app -b=$APP_TARGET -p=$APP_PROFILE
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
mbed $APP_TARGET+$APP_PROFILE shell \
examples/ota-requestor-app/mbed/build-CY8CPROTO_062_4343W/release/chip-mbed-ota-requestor-app-example.elf \
/tmp/bloat_reports/
- name: Build unit tests
# Temporarily disable build due to running out of flash space
if: false
Expand Down
82 changes: 0 additions & 82 deletions .github/workflows/smoketest-mbed.yaml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ server cluster AdministratorCommissioning = 60 {
INT16U discriminator = 2;
INT32U iterations = 3;
OCTET_STRING salt = 4;
INT16U passcodeID = 5;
}

timed command OpenBasicCommissioningWindow(OpenBasicCommissioningWindowRequest): DefaultSuccess = 1;
Expand Down Expand Up @@ -2816,6 +2815,34 @@ server cluster TestCluster = 1295 {
kValueC = 3;
}

bitmap Bitmap16MaskMap : BITMAP16 {
kMaskVal1 = 0x1;
kMaskVal2 = 0x2;
kMaskVal3 = 0x4;
kMaskVal4 = 0x4000;
}

bitmap Bitmap32MaskMap : BITMAP32 {
kMaskVal1 = 0x1;
kMaskVal2 = 0x2;
kMaskVal3 = 0x4;
kMaskVal4 = 0x40000000;
}

bitmap Bitmap64MaskMap : BITMAP64 {
kMaskVal1 = 0x1;
kMaskVal2 = 0x2;
kMaskVal3 = 0x4;
kMaskVal4 = 0x4000000000000000;
}

bitmap Bitmap8MaskMap : BITMAP8 {
kMaskVal1 = 0x1;
kMaskVal2 = 0x2;
kMaskVal3 = 0x4;
kMaskVal4 = 0x40;
}

bitmap SimpleBitmap : BITMAP8 {
kValueA = 0x1;
kValueB = 0x2;
Expand Down Expand Up @@ -2894,10 +2921,10 @@ server cluster TestCluster = 1295 {
}

attribute boolean boolean = 0;
attribute bitmap8 bitmap8 = 1;
attribute bitmap16 bitmap16 = 2;
attribute bitmap32 bitmap32 = 3;
attribute bitmap64 bitmap64 = 4;
attribute Bitmap8MaskMap bitmap8 = 1;
attribute Bitmap16MaskMap bitmap16 = 2;
attribute Bitmap32MaskMap bitmap32 = 3;
attribute Bitmap64MaskMap bitmap64 = 4;
attribute int8u int8u = 5;
attribute int16u int16u = 6;
attribute int24u int24u = 7;
Expand Down Expand Up @@ -2941,10 +2968,10 @@ server cluster TestCluster = 1295 {
attribute boolean generalErrorBoolean = 49;
attribute boolean clusterErrorBoolean = 50;
attribute nullable boolean nullableBoolean = 32768;
attribute nullable bitmap8 nullableBitmap8 = 32769;
attribute nullable bitmap16 nullableBitmap16 = 32770;
attribute nullable bitmap32 nullableBitmap32 = 32771;
attribute nullable bitmap64 nullableBitmap64 = 32772;
attribute nullable Bitmap8MaskMap nullableBitmap8 = 32769;
attribute nullable Bitmap16MaskMap nullableBitmap16 = 32770;
attribute nullable Bitmap32MaskMap nullableBitmap32 = 32771;
attribute nullable Bitmap64MaskMap nullableBitmap64 = 32772;
attribute nullable int8u nullableInt8u = 32773;
attribute nullable int16u nullableInt16u = 32774;
attribute nullable int24u nullableInt24u = 32775;
Expand Down
6 changes: 0 additions & 6 deletions examples/all-clusters-app/ameba/main/chipinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,6 @@ static void InitOTARequestor(void)
// Set server instance used for session establishment
gRequestorCore.Init(chip::Server::GetInstance(), gRequestorStorage, gRequestorUser, gDownloader);

// WARNING: this is probably not realistic to know such details of the image or to even have an OTADownloader instantiated at
// the beginning of program execution. We're using hardcoded values here for now since this is a reference application.
// TODO: instatiate and initialize these values when QueryImageResponse tells us an image is available
// TODO: add API for OTARequestor to pass QueryImageResponse info to the application to use for OTADownloader init
OTAImageProcessorParams ipParams;
gImageProcessor.SetOTAImageProcessorParams(ipParams);
gImageProcessor.SetOTADownloader(&gDownloader);

// Connect the Downloader and Image Processor objects
Expand Down
2 changes: 1 addition & 1 deletion examples/all-clusters-app/esp32/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ include(${CMAKE_CURRENT_LIST_DIR}/../../common/cmake/idf_flashing.cmake)
set(EXTRA_COMPONENT_DIRS
"${CMAKE_CURRENT_LIST_DIR}/third_party/connectedhomeip/config/esp32/components"
"${CMAKE_CURRENT_LIST_DIR}/../../common/QRCode"
"${IDF_PATH}/examples/common_components"
"${IDF_PATH}/examples/common_components/led_strip"
)
if(${IDF_TARGET} STREQUAL "esp32")
list(APPEND EXTRA_COMPONENT_DIRS "${CMAKE_CURRENT_LIST_DIR}/../../common/m5stack-tft/repo/components/tft"
Expand Down
2 changes: 0 additions & 2 deletions examples/all-clusters-app/esp32/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,8 @@ BDXDownloader gDownloader;
OTAImageProcessorImpl gImageProcessor;
#endif

namespace {
app::Clusters::NetworkCommissioning::Instance
sWiFiNetworkCommissioningInstance(0 /* Endpoint Id */, &(NetworkCommissioning::ESPWiFiDriver::GetInstance()));
} // namespace

class AppCallbacks : public AppDelegate
{
Expand Down
1 change: 0 additions & 1 deletion examples/bridge-app/bridge-common/bridge-app.matter
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ server cluster AdministratorCommissioning = 60 {
INT16U discriminator = 2;
INT32U iterations = 3;
OCTET_STRING salt = 4;
INT16U passcodeID = 5;
}

timed command OpenBasicCommissioningWindow(OpenBasicCommissioningWindowRequest): DefaultSuccess = 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
}

[mController setListenPort:kListenPort];
[mController setKeyValueStoreManagerPath:"/tmp/chip_kvs_darwin"];

[nocSigner createOrLoadKeys:storage];

Expand Down
42 changes: 14 additions & 28 deletions examples/chip-tool-darwin/commands/common/CHIPToolKeypair.mm
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <credentials/CHIPCert.h>
#include <crypto/CHIPCryptoPAL.h>
#include <lib/asn1/ASN1.h>
#include <lib/core/CHIPSafeCasts.h>
#include <lib/support/Base64.h>
#include <stddef.h>
#include <string>
Expand Down Expand Up @@ -108,11 +109,8 @@ - (CHIP_ERROR)createOrLoadKeys:(CHIPToolPersistentStorageDelegate *)storage
effectiveTime.Day = 1;
ReturnErrorOnFailure(chip::Credentials::ASN1ToChipEpochTime(effectiveTime, _mNow));

uint16_t keySize = static_cast<uint16_t>(serializedKey.Capacity());

value = [storage CHIPGetKeyValue:kOperationalCredentialsIssuerKeypairStorage];
err = [self decodeNSStringWithValue:value serializedKey:serializedKey];
serializedKey.SetLength(keySize);

if (err != CHIP_NO_ERROR) {
// Storage doesn't have an existing keypair. Let's create one and add it to the storage.
Expand All @@ -121,9 +119,8 @@ - (CHIP_ERROR)createOrLoadKeys:(CHIPToolPersistentStorageDelegate *)storage
}
ReturnErrorOnFailure([self Serialize:serializedKey]);

keySize = static_cast<uint16_t>(serializedKey.Capacity());
std::string serializeString(serializedKey.Bytes(), serializedKey.Bytes() + serializedKey.Capacity());
std::string base64Value = StringToBase64(serializeString);
std::string serializedString(chip::Uint8::to_const_char(serializedKey.Bytes()), serializedKey.Length());
std::string base64Value = StringToBase64(serializedString);
NSString * valueString = [NSString stringWithUTF8String:base64Value.c_str()];
[storage CHIPSetKeyValue:kOperationalCredentialsIssuerKeypairStorage value:valueString];
} else {
Expand All @@ -134,30 +131,19 @@ - (CHIP_ERROR)createOrLoadKeys:(CHIPToolPersistentStorageDelegate *)storage

- (CHIP_ERROR)decodeNSStringWithValue:(NSString *)value serializedKey:(chip::Crypto::P256SerializedKeypair &)serializedKey
{
CHIP_ERROR err = CHIP_NO_ERROR;
uint16_t keySize = static_cast<uint16_t>(serializedKey.Capacity());
if (value != nil) {
std::string decoded = Base64ToString([value UTF8String]);

if (decoded.length() > UINT16_MAX) {
err = CHIP_ERROR_BUFFER_TOO_SMALL;
} else {
if (serializedKey != nullptr) {
memcpy(serializedKey, decoded.data(), std::min<size_t>(decoded.length(), keySize));
if (keySize < decoded.length()) {
err = CHIP_ERROR_BUFFER_TOO_SMALL;
}
} else {
err = CHIP_ERROR_NO_MEMORY;
}
keySize = static_cast<uint16_t>(decoded.length());
}
} else {
err = CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND;
if (value == nil) {
return CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND;
}

serializedKey.SetLength(keySize);
return err;
std::string decoded = Base64ToString([value UTF8String]);

if (serializedKey.Capacity() < decoded.length()) {
return CHIP_ERROR_BUFFER_TOO_SMALL;
}

memcpy(serializedKey.Bytes(), decoded.data(), decoded.length());
serializedKey.SetLength(decoded.length());
return CHIP_NO_ERROR;
}

@end
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#import <Foundation/Foundation.h>
#import <CHIP/CHIPError_Internal.h>

#import "CHIP/zap-generated/CHIPCallbackBridge_internal.h"
#import "CHIPCallbackBridge_internal.h"
#import "CHIPCluster_internal.h"
#import "CHIPDevice.h"
#import "CHIPDevice_Internal.h"
Expand Down
Loading

0 comments on commit 5bf8bf4

Please sign in to comment.