Skip to content

Commit

Permalink
Add TI CC32XX to Github CI (#24806)
Browse files Browse the repository at this point in the history
* add TI CC32xx CI

* Update README.md

* Update README.md

* Update README.md

* update lock-app readme sysconfig version

* fixed lock app example path in cc32xx.py

* wrap dmm source set with cc13xx family check

* added cc32xx as a platform for freertos submodule, added path to dnssd.h

* trying again to add dnssd.h path

* adding path to public deps

* adding src to include path and taking out public dependency

* trying to add dnssd lib as a dependency

* saved from August

* moved DNSSD Start Server call and CommonDeviceCallbacks into examples/lock-app/cc32xx, string library error appears during build

* removed dnssd.h file include from connectivitymanagerimpl.cpp

* moved commondevicecallbacks and chipdevicemanager into example src files in build.gn

* added implementation for deviceeventcallback

* removed DeviceCallbacks.cpp and .h and renamed CommonDeviceCallbacks.cpp and .h as DeviceCallbacks.cpp and .h

* merge conflict resolution on targets.py

* fixed build command for lock-app

* added missing header in CC32XXConfig.cpp and corrected header in AppTask.cpp

* updated cc32xx yaml file to have the correct docker img version

* removed StartEventLoop Task so that CHIPDeviceManager can start it

* added CC32xx DAC certs and code cleanup

* removed CHIP-tool modification section in lock-app readme, not needed anymore

* more code cleanup

* forgot to add platform BUILD.gn to prev commit

* added DAC instructions in lock-app readme

* Restyled by whitespace

* Restyled by clang-format

* Restyled by gn

* Restyled by prettier-markdown

* Restyled by autopep8

* misspell correction

* correcting merge conflict resolution mistake and adding Accessors.h back as an include file to AppTask

* corrected contents of testdata folder

* code cleanup from PR feedback

* removed brackets from lock in all_targets_linux_x64.txt

* empty commit

* increased job timeout limit

---------

Co-authored-by: Restyled.io <[email protected]>
  • Loading branch information
2 people authored and pull[bot] committed Jan 4, 2024
1 parent e935b54 commit 1982128
Show file tree
Hide file tree
Showing 20 changed files with 976 additions and 81 deletions.
89 changes: 89 additions & 0 deletions .github/workflows/examples-cc32xx.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# Copyright (c) 2021 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: Build example - TI CC32XX

on:
push:
pull_request:

concurrency:
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:
cc32xx:
name: cc32xx
timeout-minutes: 100

env:
BUILD_TYPE: gn_cc32xx

runs-on: ubuntu-latest
if: github.actor != 'restyled-io[bot]'

container:
image: connectedhomeip/chip-build-ti:0.6.34
volumes:
- "/tmp/bloat_reports:/tmp/bloat_reports"
steps:
- uses: Wandalen/[email protected]
name: Checkout
with:
action: actions/checkout@v3
with: |
token: ${{ github.token }}
attempt_limit: 3
attempt_delay: 2000
- name: Checkout submodules
run: scripts/checkout_submodules.py --shallow --platform cc32xx
- name: Set up environment for size reports
if: ${{ !env.ACT }}
env:
GH_CONTEXT: ${{ toJson(github) }}
run: scripts/tools/memory/gh_sizes_environment.py "${GH_CONTEXT}"
- name: Bootstrap
timeout-minutes: 25
run: scripts/build/gn_bootstrap.sh
- name: Uploading bootstrap logs
uses: actions/upload-artifact@v2
if: ${{ always() && !env.ACT }}
with:
name: bootstrap-logs
path: |
.environment/gn_out/.ninja_log
.environment/pigweed-venv/*.log
- name: Build examples
timeout-minutes: 60
run: |
scripts/run_in_build_env.sh "\
./scripts/build/build_examples.py \
--target cc32xx-lock build \
--copy-artifacts-to out/artifacts \
"
- name: Get lock app size stats
timeout-minutes: 5
run: |
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
cc32xx CC3235SF_LAUNCHXL lock \
out/artifacts/cc32xx-lock/chip-CC3235SF_LAUNCHXL-lock-example.out \
/tmp/bloat_reports/
- name: Uploading Size Reports
uses: actions/upload-artifact@v2
if: ${{ !env.ACT }}
with:
name: Size,cc32xx-Examples,${{ env.GH_EVENT_PR }},${{ env.GH_EVENT_HASH }},${{ env.GH_EVENT_PARENT }},${{ github.event_name }}
path: |
/tmp/bloat_reports/
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
path = third_party/freertos/repo
url = https://github.com/FreeRTOS/FreeRTOS-Kernel.git
branch = V10.3.1-kernel-only
platforms = ameba,cc13x2_26x2,bouffalolab,efr32,esp32,k32w0,infineon,qpg
platforms = ameba,cc13x2_26x2,bouffalolab,efr32,esp32,k32w0,infineon,qpg,cc32xx
[submodule "simw-top-mini"]
path = third_party/simw-top-mini/repo
url = https://github.com/NXP/plug-and-trust.git
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
[![Examples - nRF Connect SDK](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20nRF%20Connect%20SDK/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-nrfconnect.yaml)
[![Examples - QPG](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20QPG/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-qpg.yaml)
[![Examples - TI CC26X2X7](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20TI%20CC26X2X7/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-cc13x2x7_26x2x7.yaml)
[![Examples - TI CC32XX](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20TI%20CC32XX/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-cc32xx.yaml)
[![Build example - Infineon](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-infineon.yaml/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-infineon.yaml)
[![Build example - BouffaloLab](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20BouffaloLab/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-bouffalolab.yaml)

Expand Down
4 changes: 4 additions & 0 deletions examples/lock-app/cc32xx/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ source_set("lock_app_sdk") {
"${project_dir}/main",
"${project_dir}/main/ifmod/",
"${chip_root}/src/platform/cc32xx",
"${chip_root}/examples/platform/cc32xx",
]

deps = [
Expand All @@ -83,7 +84,9 @@ ti_simplelink_executable("lock_app") {
sources = [
"${project_dir}/main/AppTask.cpp",
"${project_dir}/main/BoltLockManager.cpp",
"${project_dir}/main/CHIPDeviceManager.cpp",
"${project_dir}/main/CXXExceptionStubs.cpp",
"${project_dir}/main/DeviceCallbacks.cpp",
"${project_dir}/main/ZclCallbacks.cpp",
]

Expand All @@ -92,6 +95,7 @@ ti_simplelink_executable("lock_app") {
":sdk",
":sysconfig",
"${chip_root}/examples/lock-app/lock-common",
"${chip_root}/examples/platform/cc32xx:cc32xx-attestation-credentials",
"${chip_root}/src/lib",
"${chip_root}/src/setup_payload",
]
Expand Down
22 changes: 11 additions & 11 deletions examples/lock-app/cc32xx/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ guide assumes that the environment is linux based, and recommends Ubuntu 20.04.

```
$ cd ~
$ wget https://software-dl.ti.com/ccs/esd/sysconfig/sysconfig-1.12.1_2446-setup.run
$ chmod +x sysconfig-1.12.1_2446-setup.run
$ ./sysconfig-1.12.1_2446-setup.run
$ wget https://software-dl.ti.com/ccs/esd/sysconfig/sysconfig-1.13.0_2553-setup.run
$ chmod +x sysconfig-1.13.0_2553-setup.run
$ ./sysconfig-1.13.0_2553-setup.run
```
- Run the bootstrap script to setup the build environment.
Expand All @@ -85,17 +85,23 @@ Ninja to build the executable.
- Run the build to produce a default executable. By default on Linux the
Sysconfig is located in a `ti` folder in the user's home directory, and you
must provide the absolute path for it. For example
`/home/username/ti/sysconfig_1.12.1`. On Windows the default directory is
`/home/username/ti/sysconfig_1.13.0`. On Windows the default directory is
`C:\ti`. Take note of this install path, as it will be used in the next
step.
```
$ cd ~/connectedhomeip/examples/lock-app/cc32xx
$ gn gen out/debug --args="ti_sysconfig_root=\"$HOME/ti/sysconfig_1.12.1\""
$ gn gen out/debug --args="ti_sysconfig_root=\"$HOME/ti/sysconfig_1.13.0\""
$ ninja -C out/debug
```
## Adding DAC Certificates
To add custom DAC Certificates, the `CC32XXDeviceAttestationCreds.cpp` file in
`examples/platform/cc32xx` can be modified. The private key, public key, DAC
cert and PAI cert arrays all need to be replaced.
## Programming
Loading the built image onto a LaunchPad is supported through Code Composer
Expand Down Expand Up @@ -160,12 +166,6 @@ the device is connected to the local AP, commissioning can be triggered using
BLE provisioning is not supported currently.
### CHIP tool changes needed for Wi-Fi example
The timeout for the CHIP tool needs to be increased from 10 to 15 seconds. This
can be done in `chip::System::Clock::Timeout GetWaitDuration` in
`connectedhomeip/examples/chip-tool/commands/clusters/ModelCommand.h`
## TI Support
For technical support, please consider creating a post on TI's [E2E forum][e2e].
Expand Down
32 changes: 23 additions & 9 deletions examples/lock-app/cc32xx/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,20 @@
#include "AppTask.h"
#include "AppConfig.h"
#include "AppEvent.h"

#include <app-common/zap-generated/attributes/Accessors.h>
#include <app-common/zap-generated/ids/ClusterIds.h>
#include <app-common/zap-generated/ids/Clusters.h>
#include <app/server/Server.h>
#include <app/util/attribute-storage.h>

#include "FreeRTOS.h"

#include <credentials/DeviceAttestationCredsProvider.h>
#include <credentials/examples/DeviceAttestationCredsExample.h>
#include <examples/platform/cc32xx/CC32XXDeviceAttestationCreds.h>

#include <CHIPDeviceManager.h>
#include <DeviceCallbacks.h>
#include <lib/support/CHIPMem.h>
#include <lib/support/CHIPPlatformMemory.h>
#include <platform/CHIPDeviceLayer.h>
Expand Down Expand Up @@ -59,6 +63,7 @@ using namespace ::chip::System;

using namespace ::chip::Credentials;
using namespace ::chip::DeviceLayer;
using namespace ::chip::DeviceManager;

static TaskHandle_t sAppTaskHandle;
static QueueHandle_t sAppEventQueue;
Expand All @@ -68,6 +73,8 @@ static Button_Handle gButtonRightHandle;

AppTask AppTask::sAppTask;

static DeviceCallbacks EchoCallbacks;

int AppTask::StartAppTask()
{
int ret = 0;
Expand Down Expand Up @@ -139,14 +146,6 @@ int AppTask::Init()
while (true)
;
}
PLAT_LOG("Start Event Loop Task");
ret = PlatformMgr().StartEventLoopTask();
if (ret != CHIP_NO_ERROR)
{
PLAT_LOG("PlatformMgr().StartEventLoopTask() failed");
while (true)
;
}

// Init ZCL Data Model and start server
PLAT_LOG("Initialize Server");
Expand All @@ -156,7 +155,12 @@ int AppTask::Init()

// Initialize device attestation config
PLAT_LOG("Initialize device attestation config");
#ifdef CC32XX_ATTESTATION_CREDENTIALS
SetDeviceAttestationCredentialsProvider(CC32XX::GetCC32XXDacProvider());
#else

SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider());
#endif

// Initialize BoltLock module
PLAT_LOG("Initialize BoltLock");
Expand All @@ -170,6 +174,16 @@ int AppTask::Init()
PLAT_LOG("Print Onboarding Codes");
PrintOnboardingCodes(chip::RendezvousInformationFlags(chip::RendezvousInformationFlag::kOnNetwork));

PLAT_LOG("Start CHIPDeviceManager and Start Event Loop Task");
CHIPDeviceManager & deviceMgr = CHIPDeviceManager::GetInstance();
ret = deviceMgr.Init(&EchoCallbacks);
if (ret != CHIP_NO_ERROR)
{
PLAT_LOG("CHIPDeviceManager::Init() failed: %s", ErrorStr(ret));
while (1)
;
}

return 0;
}

Expand Down
63 changes: 63 additions & 0 deletions examples/lock-app/cc32xx/main/CHIPDeviceManager.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*
*
* Copyright (c) 2020 Project CHIP Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/**
* @file
* This file implements the CHIP Device Interface that is used by
* applications to interact with the CHIP stack
*
*/

#include <stdlib.h>

#include "CHIPDeviceManager.h"

using namespace ::chip;

namespace chip {

namespace DeviceManager {

using namespace ::chip::DeviceLayer;

void CHIPDeviceManager::DeviceEventHandler(const ChipDeviceEvent * event, intptr_t arg)
{
CHIPDeviceManagerCallbacks * cb = reinterpret_cast<CHIPDeviceManagerCallbacks *>(arg);
if (cb != nullptr)
{
cb->DeviceEventCallback(event, reinterpret_cast<intptr_t>(cb));
}
}

CHIP_ERROR CHIPDeviceManager::Init(CHIPDeviceManagerCallbacks * cb)
{
mCB = cb;

// Register a function to receive events from the CHIP device layer. Note that calls to
// this function will happen on the CHIP event loop thread, not the app_main thread.
PlatformMgr().AddEventHandler(CHIPDeviceManager::DeviceEventHandler, reinterpret_cast<intptr_t>(cb));

// Start a task to run the CHIP Device event loop.
return PlatformMgr().StartEventLoopTask();
}

void CHIPDeviceManagerCallbacks::DeviceEventCallback(const chip::DeviceLayer::ChipDeviceEvent * event, intptr_t arg) {}

CHIPDeviceManagerCallbacks::~CHIPDeviceManagerCallbacks() {}

} // namespace DeviceManager
} // namespace chip
45 changes: 45 additions & 0 deletions examples/lock-app/cc32xx/main/DeviceCallbacks.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
*
* Copyright (c) 2022 Project CHIP Authors
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#include "DeviceCallbacks.h"
#include <app/server/Dnssd.h>

using namespace chip;
using namespace chip::DeviceLayer;
using namespace chip::System;

DeviceCallbacksDelegate * appDelegate = nullptr;
extern "C" void cc32xxLog(const char * aFormat, ...);

void DeviceCallbacks::DeviceEventCallback(const ChipDeviceEvent * event, intptr_t arg)
{
switch (event->Type)
{
case DeviceEventType::kInterfaceIpAddressChanged:
if ((event->InterfaceIpAddressChanged.Type == InterfaceIpChangeType::kIpV4_Assigned) ||
(event->InterfaceIpAddressChanged.Type == InterfaceIpChangeType::kIpV6_Assigned))
{
// MDNS server restart on any ip assignment: if link local ipv6 is configured, that
// will not trigger a 'internet connectivity change' as there is no internet
// connectivity. MDNS still wants to refresh its listening interfaces to include the
// newly selected address.
cc32xxLog("DeviceEventCallback:Start DNS Server");
chip::app::DnssdServer::Instance().StartServer();
}
}
}
Loading

0 comments on commit 1982128

Please sign in to comment.