Skip to content

Commit

Permalink
Revert "Remove support for nRF5 SDK for Thread & Zigbee (project-chip…
Browse files Browse the repository at this point in the history
…#3605)"

This reverts commit e931c96.
  • Loading branch information
soburi committed Sep 18, 2021
1 parent 06e8213 commit c2c8c72
Show file tree
Hide file tree
Showing 134 changed files with 13,471 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .github/boring-cyborg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ labelPRBasedOnFilePath:
linux:
- src/platform/Linux/*

nrf5:
- src/platform/nRF5/*

nrf connect:
- src/platform/nrfconnect/*

Expand Down
3 changes: 3 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,9 @@ k32w:
linux:
- src/platform/Linux/*

nrf5:
- src/platform/nRF5/*

nrf connect:
- src/platform/nrfconnect/*

Expand Down
94 changes: 94 additions & 0 deletions .github/workflows/examples-nrf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# 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.

name: Build example - nRF

on:
push:
pull_request:

jobs:
nrf:
name: nRF
env:
BUILD_TYPE: gn_nrf
BUILD_VERSION: 0.2.14
BUILD_IMAGE: chip-build-nrf-platform
BUILD_ORG: connectedhomeip

runs-on: ubuntu-latest

container:
image: connectedhomeip/chip-build-nrf-platform:0.4.12
volumes:
- "/tmp/bloat_reports:/tmp/bloat_reports"
- "/tmp/output_binaries:/tmp/output_binaries"

steps:
- name: Checkout
uses: actions/checkout@v2
# Fetch depth 0 to get all history and be able to check mergepoint for bloat report
with:
fetch-depth: 0
submodules: true
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: "cpp, python"
queries: +security-and-quality
- name: Bootstrap
run: scripts/build/gn_bootstrap.sh
- name: Build example nRF5 Lock App
run:
scripts/examples/gn_nrf_example.sh examples/lock-app/nrf5
out/lock_app_debug
- name: Build example nRF5 Lighting App
run:
scripts/examples/gn_nrf_example.sh examples/lighting-app/nrf5
out/lighting_app_debug
- name: Build example nRF5 Shell App
run:
scripts/examples/gn_nrf_example.sh examples/shell/nrf52
out/shell_app_debug
- name: Binary artifact suffix
id: outsuffix
uses: haya14busa/action-cond@v1.0.0
with:
cond: ${{ github.event.pull_request.number == '' }}
if_true: "${{ github.sha }}"
if_false: "pull-${{ github.event.pull_request.number }}"
- name: Uploading Binaries
uses: actions/upload-artifact@v2
with:
name:
${{ env.BUILD_TYPE }}-example-build-${{
steps.outsuffix.outputs.value }}
path: |
out/lock_app_debug/chip-nrf52840-lock-example
out/lighting_app_debug/chip-nrf52840-lighting-example
out/shell_app_debug/shell-nrf52840
# TODO: NRF Connect https://github.com/project-chip/connectedhomeip/issues/2225
- name: Show tree
run: find .
- name: Remove third_party binaries for CodeQL Analysis
run: find out -type d -name "third_party" -exec rm -rf {} +
- name: Remove nrfxlib binaries for CodeQL Analysis
run: find out -type d -name "nrfxlib" -exec rm -rf {} +
- name: Remove NordicSemiconductor binaries for CodeQL Analysis
run:
find out -type d -name "NordicSemiconductor" -exec rm -rf {} +

- name: Perform CodeQL Analysis
if: ${{ github.event_name == 'push' }}
uses: github/codeql-action/analyze@v1
12 changes: 12 additions & 0 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,18 @@
"limitSymbolsToIncludedHeaders": true
}
},
{
"name": "nRF5 examples debug (GN)",
"cStandard": "c11",
"cppStandard": "c++11",
"intelliSenseMode": "gcc-x64",
"compileCommands": "${workspaceFolder}/out/debug/compile_commands.nrf5.json",
"compilerPath": "/opt/ARM-software/gcc-arm-none-eabi-9-2019-q4-major/bin/arm-none-eabi-gcc",
"browse": {
"path": ["${workspaceFolder}/out/debug/"],
"limitSymbolsToIncludedHeaders": true
}
},
{
"name": "EFR32 examples debug (GN)",
"cStandard": "c11",
Expand Down
18 changes: 18 additions & 0 deletions build_overrides/nrf5_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 nRF5 SDK build files.
nrf5_sdk_build_root = "//third_party/nrf5_sdk"
}
38 changes: 38 additions & 0 deletions config/nrf5/toolchain/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# 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("nrf5_lock_app") {
toolchain_args = {
current_os = "freertos"
import("${chip_root}/examples/lock-app/nrf5/args.gni")
}
}

arm_toolchain("nrf5_lighting_app") {
toolchain_args = {
current_os = "freertos"
import("${chip_root}/examples/lighting-app/nrf5/args.gni")
}
}

arm_toolchain("nrf5_pigweed_app") {
toolchain_args = {
current_os = "freertos"
import("${chip_root}/examples/pigweed-app/nrf5/args.gni")
}
}
2 changes: 1 addition & 1 deletion docs/VSCODE_DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ same base configuration and build.
- Main Build - Build the default configuration (i.e., Linux OpenSSL)
- Run Unit and Functional Tests - Test the default configuration
- Build & Test (all) - Build & Test various configurations (Linux variants,
Android, EFR32)
Android, nRF5, EFR32)
- Update compilation database - Update the database used by IntelliSense
(needed for cross references, completion)
- Bootstrap - On a clean tree, pull in the third party dependencies required
Expand Down
18 changes: 18 additions & 0 deletions examples/build_overrides/nrf5_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 nRF5 SDK.
nrf5_sdk_build_root = "//third_party/connectedhomeip/third_party/nrf5_sdk"
}
16 changes: 16 additions & 0 deletions examples/common/nrf5/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# CHIP nRF52840 Common Code

This directory contains common code for several example apps.

- `common`

This directory contains common code for bringing up a nRF52840 example app.

- `util`

This directory contains some usful classes for example apps.

- `gdb`

This directory contains some shell scripts for setting up debugging
environment.
38 changes: 38 additions & 0 deletions examples/common/nrf5/gdb/gdb-startup-cmds.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Set convenience vars for the start and end of the .text section
set $FLASH_START=&__isr_vector
set $FLASH_END=&__etext

# Search for the signature string indicating that the app was built with support
# for J-Link monitor mode debugging.
set logging file /dev/null
set logging redirect on
set logging on
find /b1 $FLASH_START, $FLASH_END, 'J', 'L', 'I', 'N', 'K', 'M', 'O', 'N', 'H', 'A', 'N', 'D', 'L', 'E', 'R'
set logging off
set logging redirect off

# Tell the user which type of debugging will being used.
if $numfound != 0
echo J-LINK monitor handler detected: Enabling monitor mode debugging\n
else
echo J-LINK monitor handler NOT detected: Using standard 'HALT' mode debugging\n
end

# Connect to the GDB server
echo Connecting to local GDB server\n
target remote localhost:2331

# Enable monitor mode debugging if available.
set logging file /dev/null
set logging redirect on
set logging on
if $numfound != 0
mon exec SetMonModeDebug=1
eval "mon exec SetMonModeVTableAddr=%p", $FLASH_START
else
mon exec SetMonModeDebug=0
end
set logging off
set logging redirect off


38 changes: 38 additions & 0 deletions examples/common/nrf5/gdb/start-gdb.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env bash

#
# 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.
#

SCRIPT_ROOT=$(dirname "$0")
GNU_INSTALL_ROOT=${GNU_INSTALL_ROOT:-${HOME}/tools/arm/gcc-arm-none-eabi-7-2018-q2-update/bin}
GDB=$GNU_INSTALL_ROOT/arm-none-eabi-gdb
DEFAULT_APP=./build/chip-nrf52840-lock-example.out
STARTUP_CMDS=$SCRIPT_ROOT/gdb-startup-cmds.txt

if [[ $# -eq 0 ]]; then
APP=$DEFAULT_APP
else
APP=$1
fi

EXTRA_STARTUP_CMDS=()
if [[ -n $OPENTHREAD_ROOT ]]; then
EXTRA_STARTUP_CMDS+=(
"set substitute-path /build/KNGP-TOLL1-JOB1/openthread/examples/.. $OPENTHREAD_ROOT"
)
fi

exec "$GDB" -q -x "$STARTUP_CMDS" "${EXTRA_STARTUP_CMDS[@]/#/-ex=}" "$APP"
57 changes: 57 additions & 0 deletions examples/common/nrf5/gdb/start-jlink-gdb-server.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/usr/bin/env bash

#
# 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.
#

JLINK_GDB_SERVER=JLinkGDBServer
DEVICE_TYPE=NRF52840_XXAA
RTT_PORT=19021

command -v "$JLINK_GDB_SERVER" || {
echo "ERROR: $JLINK_GDB_SERVER not found"
echo "Please install SEGGER J-Link software package"
exit 1
}

command -v nc || {
echo "ERROR: nc command not found"
exit 1
}

# Launch JLink GDB Server in background; redirect output thru sed to add prefix.
"$JLINK_GDB_SERVER" -device "$DEVICE_TYPE" -if SWD -speed 4000 -rtos GDBServer/RTOSPlugin_FreeRTOS "$@" > >(exec sed -e 's/^/JLinkGDBServer: /') 2>&1 &
GDB_SERVER_PID=$!

# Repeatedly open a connection to the GDB server's RTT port until
# the user kills the GDB server with an interrupt character.
while true; do
# Wait for GDB server to begin listening on RTT port
while ! lsof -nP -i4TCP:"$RTT_PORT" -sTCP:LISTEN >/dev/null; do
# Quit if the GDB server exits.
if ! kill -0 "$GDB_SERVER_PID" >/dev/null 2>&1; then
echo ""
exit
fi

# Wait a bit.
sleep 0.1

done

# Connect to RTT port.
nc localhost "$RTT_PORT"

done
26 changes: 26 additions & 0 deletions examples/lighting-app/nrf5/.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# 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

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

import("//args.gni")
}
Loading

0 comments on commit c2c8c72

Please sign in to comment.