Skip to content

Commit

Permalink
[QPG6100] Addition of Qorvo QPG6100 platform - initial lock-app versi…
Browse files Browse the repository at this point in the history
…on (#2669)

* Addition of Qorvo QPG6100 platform - initial lock-app version

* Restyled by whitespace

* Restyled by clang-format

* Restyled by prettier-markdown

* Restyled by clang-format

* Restyled by prettier-markdown

* Restyled by prettier-markdown

* Markdown update

* Addition of Qorvo QPG6100 platform - initial lock-app version

* Restyled by whitespace

* Restyled by clang-format

* Restyled by prettier-markdown

* Restyled by clang-format

* Restyled by prettier-markdown

* Restyled by prettier-markdown

* Markdown update

* * Enabling GN/Ninja build system for Lock-app
* Moving Qorvo SDK code to third_party/qpg_sdk (awaiting availibility of external location)

* Restyled by whitespace

* Restyled by gn

* Restyled by prettier-markdown

* Update merge - missing }

* Update merge 2 - missing }

* Restyled by gn

* - Removal Qorvo specific SDK files. SDK available on Qorvo repository
- Updated README.md to reflect changes
- Fix conversion errors in ConfigurationManager

* Restyled by clang-format

* Restyled by gn

* Restyled by prettier-markdown

* * Updating review comments andy31415
* Created #2939 to follow up on OpenThread creation
* lwip assert enabled
* Commented out code removed where needed

* Restyled by gn

* * Use QPG qpg-connectedhomeip repository as submodule
* make QPG6100_SDK_ROOT point to repo by default

* Restyled by prettier-markdown

* * Removal automake support for QPG6100

* * Fix flash utils due to API update

* Restyled by prettier-markdown

* mspang comments
* Updating submodule reference to qpg_sdk
* Removing efr32 reference

* * Integration diff kpschoedel - aligning with updates in firmware_utils.py
* Addition checks for mBed copy

Co-authored-by: Restyled.io <commits@restyled.io>
  • Loading branch information
tima-q and restyled-commits authored Oct 5, 2020
1 parent 842ca36 commit b5b3d38
Show file tree
Hide file tree
Showing 54 changed files with 4,740 additions and 3 deletions.
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,9 @@
branch = master
ignore = dirty
commit = 7e4472420897c96b41a4928b4a1b2271d8af23e8
[submodule "qpg_sdk"]
path = third_party/qpg_sdk/repo
url = https://github.com/Qorvo/qpg-connectedhomeip
branch = master
ignore = dirty
commit = e1214fffae4a0d22e331326b19458061a97a9bb2
12 changes: 12 additions & 0 deletions BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ if (current_toolchain != "${dir_pw_toolchain}/dummy:dummy") {

# Set this to true to enable efr32 builds by default.
enable_efr32_builds = false

# Set this to true to enable qpg6100 builds by default.
enable_qpg6100_builds = false
}

declare_args() {
Expand Down Expand Up @@ -134,6 +137,9 @@ if (current_toolchain != "${dir_pw_toolchain}/dummy:dummy") {
# Build the efr32 lock app example.
enable_efr32_lock_app_build = enable_efr32_builds

# Build the qpg6100 lock app example.
enable_qpg6100_lock_app_build = enable_qpg6100_builds

# Build the efr32 lighting app example.
enable_efr32_lighting_app_build = enable_efr32_builds
}
Expand Down Expand Up @@ -202,6 +208,12 @@ if (current_toolchain != "${dir_pw_toolchain}/dummy:dummy") {
}
}

if (enable_qpg6100_lock_app_build) {
group("qpg6100_lock_app") {
deps = [ "${chip_root}/examples/lock-app/qpg6100(${chip_root}/config/qpg6100/toolchain:qpg6100_lock_app)" ]
}
}

if (enable_efr32_lighting_app_build) {
group("efr32_lighting_app") {
deps = [ "${chip_root}/examples/lighting-app/efr32(${chip_root}/config/efr32/toolchain:efr32_lighting_app)" ]
Expand Down
24 changes: 24 additions & 0 deletions config/qpg6100/toolchain/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# 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.

import("//build_overrides/chip.gni")

import("//build/toolchain/arm_gcc/arm_toolchain.gni")

arm_toolchain("qpg6100_lock_app") {
toolchain_args = {
current_os = "freertos"
import("${chip_root}/examples/lock-app/qpg6100/args.gni")
}
}
18 changes: 18 additions & 0 deletions examples/build_overrides/qpg6100_sdk.gni
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# 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.

declare_args() {
# Root directory for QPG6100 SDK.
qpg6100_sdk_build_root = "//third_party/connectedhomeip/third_party/qpg_sdk"
}
29 changes: 29 additions & 0 deletions examples/lock-app/qpg6100/.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# 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.

# The location of the build configuration file.
buildconfig = "//build/config/BUILDCONFIG.gn"

# CHIP uses angle bracket includes.
check_system_includes = true

# Allow loading paths relative to //gn.
secondary_source = "//third_party/connectedhomeip/gn/"

default_args = {
target_cpu = "arm"
target_os = "freertos"

import("//args.gni")
}
82 changes: 82 additions & 0 deletions examples/lock-app/qpg6100/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# 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.

import("//build/config/defaults.gni")
import("//build_overrides/chip.gni")
import("//build_overrides/qpg6100_sdk.gni")
import("${qpg6100_sdk_build_root}/qpg6100_executable.gni")
import("${qpg6100_sdk_build_root}/qpg6100_sdk.gni")

assert(current_os == "freertos")

qpg6100_project_dir = "${chip_root}/examples/lock-app/qpg6100"
examples_plat_dir = "${chip_root}/examples/platform/qpg6100"

qpg6100_sdk("sdk") {
include_dirs = [
"${chip_root}/src/platform/qpg6100",
"${qpg6100_project_dir}/include/",
"${qpg6100_project_dir}/src/",
]

sources = [ "${qpg6100_project_dir}/include/CHIPProjectConfig.h" ]

defines = []
if (is_debug) {
defines += [ "BUILD_RELEASE=0" ]
} else {
defines += [ "BUILD_RELEASE=1" ]
}
}

qpg6100_executable("lock_app") {
include_dirs = []
defines = []
output_name = "chip-qpg6100-lock-example.out"

public_deps = [
":sdk",
"${chip_root}/src/lib",
"${chip_root}/src/setup_payload",

# OpenThread to be enabled
# https://github.com/project-chip/connectedhomeip/issues/293
# "${chip_root}/third_party/openthread/platforms:libopenthread-platform",
# "${chip_root}/third_party/openthread/platforms:libopenthread-platform-utils",
# "${chip_root}/third_party/openthread/repo:libopenthread-cli-ftd",
# "${chip_root}/third_party/openthread/repo:libopenthread-ftd",
]

include_dirs += [
"${qpg6100_project_dir}/include/",
"${chip_root}/src/app/util",
"${examples_plat_dir}/",
]

sources = [ "src/main.cpp" ]

output_dir = root_out_dir

ldscript = "${qpg6100_sdk_root}/qpg6100/ldscripts/chip-qpg6100-example.ld"

ldflags = [ "-T" + rebase_path(ldscript, root_build_dir) ]
}

group("qpg6100") {
deps = [ ":lock_app" ]
}

group("default") {
deps = [ ":qpg6100" ]
}
133 changes: 133 additions & 0 deletions examples/lock-app/qpg6100/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
# CHIP QPG6100 Lock Example Application

An example application showing the use
[CHIP](https://github.com/project-chip/connectedhomeip) on the Qorvo QPG6100.

---

- [CHIP QPG6100 Lock Example Application](#chip-qpg6100-lock-example-application)
- [Introduction](#introduction)
- [Building](#building)
- [Flashing the application](#flashing-the-application)
- [Viewing Logging Output](#viewing-logging-output)

---

## Introduction

![QPG6100 DK board](../../platform/qpg6100/doc/images/QPG6100_DK_Board.jpg)

The QPG6100 Lock shows an implementation of a Door Lock device, based on CHIP
and the Qorvo QPG6100 SDK. Intention of this example is to demonstrate a CHIP
device, with Thread connectivity, using BLE to perform CHIP provisioning.

The example will be implemented in a phased approach, enabling more features
with separate updates.

Current status of implementation:

- Initialization of the CHIP stack.
- CHIP Logging, PlatformManager and ConfigurationManager enabled.

Pending:

- Button and LED control
- BLE: Addition of CHIPoBLE to enable provisioning
- Thread: Linking QPG6100 OpenThread implementation to CHIP build
- Intake CHIP ZCL cluster control for the Lock mechanism through CHIP tool.

For more information on Qorvo and the platforms, please visit
[the Qorvo website](www.qorvo.com) or contact us on LPW.support@qorvo.com.

## Building

### Preparation

- Download and install a suitable ARM gcc tool chain:
[GNU Arm Embedded Toolchain 9-2019-q4-update](https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloads)
(Direct download link:
[Linux](https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu-rm/9-2019q4/gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.bz2)
[Mac OS X](https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu-rm/9-2019q4/gcc-arm-none-eabi-9-2019-q4-major-mac.tar.bz2))

- Install additional tools used by the CHIP build:

```
# Linux
sudo apt-get install git make libtool ccache ninja-build
```

```
# Mac OS X
brew install libtool ccache ninja
```

- Clone the [CHIP](https://github.com/project-chip/connectedhomeip) repo into
a local directory

```
cd ~
git clone https://github.com/project-chip/connectedhomeip.git
```

- The Qorvo CHIP SDK is added as a submodule in /third_party/qpg_sdk/repo. To
manually clone this repo you can clone it from
[CHIP SDK](https://github.com/Qorvo/qpg-connectedhomeip)

```
cd ~
git clone https://github.com/Qorvo/qpg-connectedhomeip
```

### Compilation

- Set the following environment variables before compilation:

```
export ARM_GCC_INSTALL_ROOT=${HOME}/tools/gcc-arm-none-eabi-9-2019-q4-major/bin
export PATH=$PATH:$ARM_GCC_INSTALL_ROOT
export QPG6100_SDK_ROOT=${HOME}/qpg-connectedhomeip
```

- All builds are GN/ninja based

```
cd ~/connectedhomeip/examples/lock-app/qpg6100
gn gen out/debug
ninja -C out/debug
```

## Flashing the application

The QPG6100 DK boards can be programmed using:

### CMSIS-DAP Drag and Drop

Drag/copy the hex-file generated to the mBED drive that appears when plugging in
the DK board.

### Segger JLink debugger

Connect the Segger J-Link to the programming header and use the Segger SW to
flash the .hex.

More detailed information to be included in SDK Documentation.

## Viewing Logging Output

- Launch a serial terminal with baudrate 115200.
- At startup you will see:

```
qvCHIP v0.0.0.0 (CL:155586) running
[P][-] Init CHIP Stack
[P][DL] BLEManagerImpl::Init() complete
[P][-] Starting Platform Manager Event Loop
[P][-] ============================
[P][-] Qorvo Lock-app Launching
[P][-] ============================
[D][DL] CHIP task running
```

- Note! Logging is currently encapsulated by the Qorvo logging module. Output
will have additional header and footer bytes. This will be updated later
into a raw stream for any serial terminal to parse.
18 changes: 18 additions & 0 deletions examples/lock-app/qpg6100/args.gni
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# 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.

import("//build_overrides/chip.gni")
import("${chip_root}/examples/platform/qpg6100/args.gni")

qpg6100_sdk_target = get_label_info(":sdk", "label_no_toolchain")
1 change: 1 addition & 0 deletions examples/lock-app/qpg6100/build_overrides
Loading

0 comments on commit b5b3d38

Please sign in to comment.