Skip to content

Commit

Permalink
* Moving CHIPProjectConfig.h to a /platform
Browse files Browse the repository at this point in the history
* Adding qpg6100 streamer implementation
** Updating qpg_sdk submodule
* Adding qpg6100 shell build files
* Adding qpg6100 shell build to github workflow
* fix flasher script - coping calling from different path
  • Loading branch information
tima-q committed Nov 3, 2020
1 parent d06daa2 commit 91be646
Show file tree
Hide file tree
Showing 14 changed files with 316 additions and 6 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/examples-qpg6100.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ jobs:
- name: Build example QPG6100 Lock App
run: scripts/examples/gn_build_example.sh
examples/lock-app/qpg6100 out/lock_app_debug
- name: Build QPG6100 shell App
run: scripts/examples/gn_build_example.sh
examples/shell/qpg6100 out/shell_app
- name: Binary artifact suffix
id: outsuffix
uses: haya14busa/[email protected]
Expand All @@ -61,6 +64,11 @@ jobs:
steps.outsuffix.outputs.value }}
path: |
out/lock_app_debug/chip-qpg6100-lock-example.out
out/shell_app/shell-qpg6100.out
- 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: Perform CodeQL Analysis
if: ${{ github.event_name == 'push' }}
uses: github/codeql-action/analyze@v1
7 changes: 3 additions & 4 deletions examples/lock-app/qpg6100/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,10 @@ 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/",
"${examples_plat_dir}/project_include",
]

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

defines = []
if (is_debug) {
Expand Down Expand Up @@ -59,7 +58,7 @@ qpg6100_executable("lock_app") {
]

include_dirs += [
"${qpg6100_project_dir}/include/",
"${qpg6100_project_dir}/src/",
"${chip_root}/src/app/util",
"${examples_plat_dir}/",
]
Expand Down
63 changes: 63 additions & 0 deletions examples/platform/qpg6100/util/streamer/streamer_qpg6100.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
* Source implementation of an input / output stream for QPG6100 targets.
*/

#include <lib/shell/shell.h>

#ifdef QPG6100_SHELL_STREAMER

#include "qvCHIP.h"

namespace chip {
namespace Shell {

int streamer_qpg6100_init(streamer_t * streamer)
{
qvCHIP_UartInit();
return 0;
}

int streamer_qpg6100_read(streamer_t * streamer, char * buf, size_t len)
{
return qvCHIP_UartReadRxData(len, buf);
}

int streamer_qpg6100_write(streamer_t * streamer, const char * buf, size_t len)
{
qvCHIP_UartTxData(len, buf);
return len;
}

static streamer_t streamer_qpg6100 = {
.init_cb = streamer_qpg6100_init,
.read_cb = streamer_qpg6100_read,
.write_cb = streamer_qpg6100_write,
};

streamer_t * streamer_get(void)
{
return &streamer_qpg6100;
}

} // namespace Shell
} // namespace chip

#endif //#ifdef QPG6100_SHELL_STREAMER
26 changes: 26 additions & 0 deletions examples/shell/qpg6100/.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")
}
85 changes: 85 additions & 0 deletions examples/shell/qpg6100/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# 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")

examples_plat_dir = "${chip_root}/examples/platform/qpg6100"
project_dir = "${chip_root}/examples/shell"

qpg6100_sdk("sdk") {
include_dirs = [
"${chip_root}/src/platform/qpg6100",
"${examples_plat_dir}/project_include",
"${chip_root}/src/app/util",
]

sources = [ "${examples_plat_dir}/project_include/CHIPProjectConfig.h" ]

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

qpg6100_executable("shell_qpg6100") {
include_dirs = []
defines = []
output_name = "shell-qpg6100.out"

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

# OpenThread to be enabled
# https://github.com/project-chip/connectedhomeip/issues/293
]

include_dirs += [ "${chip_root}/src/app/util" ]

sources = [
"${examples_plat_dir}/project_include/CHIPProjectConfig.h",
"${examples_plat_dir}/util/streamer/streamer_qpg6100.cpp",
"${project_dir}/test_identity.cpp",
"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) ]
defines = [
"QPG6100_SHELL_STREAMER",
"SHELL_STREAMER_APP_SPECIFIC",
]
}

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

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

A [chip-shell](../README.md) project for the Qorvo QPG6100 development kit.

## Building

The Shell Application builds and flashes like any other QPG6100 example application.
Further information can be found in [this](../../lock-app/qpg6100/README.md) README.
18 changes: 18 additions & 0 deletions examples/shell/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/shell/qpg6100/build
1 change: 1 addition & 0 deletions examples/shell/qpg6100/build_overrides
100 changes: 100 additions & 0 deletions examples/shell/qpg6100/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
/*
*
* 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.
*/

#include "FreeRTOS.h"
#include "task.h"

#include <lib/shell/shell.h>

#include <lib/core/CHIPCore.h>
#include <lib/support/Base64.h>
#include <lib/support/CHIPArgParser.hpp>
#include <lib/support/CodeUtils.h>
#include <lib/support/RandUtils.h>
#include <support/logging/CHIPLogging.h>

#include <ChipShellCollection.h>

#include "qvCHIP.h"

#if CHIP_ENABLE_OPENTHREAD
extern "C" {
#include <openthread/platform/platform-softdevice.h>
}
#endif // CHIP_ENABLE_OPENTHREAD

using namespace chip;
using namespace chip::Shell;

namespace {

const size_t kShellTaskStackSize = 2048;
const int kShellTaskPriority = 1;
TaskHandle_t sShellTaskHandle;

void ShellCLIMain(void * pvParameter)
{
// Initialize the default streamer that was linked.
const int rc = streamer_init(streamer_get());

if (rc != 0)
{
ChipLogError(Shell, "Streamer initialization failed: %d", rc);
return;
}

ChipLogDetail(Shell, "Initializing CHIP shell commands", rc);

cmd_device_init();
cmd_base64_init();
cmd_misc_init();
cmd_btp_init();
cmd_otcli_init();

ChipLogDetail(Shell, "Run CHIP shell Task", rc);

shell_task(nullptr);
}

} // namespace

int StartShellTask(void)
{
int ret = 0;

// Start Shell task.
if (xTaskCreate(ShellCLIMain, "SHELL", kShellTaskStackSize / sizeof(StackType_t), NULL, kShellTaskPriority,
&sShellTaskHandle) != pdPASS)
{
ret = -1;
}

return ret;
}

int main(void)
{
/* Initialize platform */
qvCHIP_init();

/* Launch shell task */
StartShellTask();

/* Start FreeRTOS */
vTaskStartScheduler();
return 0;
}
1 change: 1 addition & 0 deletions examples/shell/qpg6100/third_party/connectedhomeip
2 changes: 1 addition & 1 deletion scripts/flashing/qpg6100_firmware_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def flash(self, image):
self.err = 3
return self

shutil.copyfile(image, os.path.join(self.option.drive, image))
shutil.copyfile(image, os.path.join(self.option.drive, os.path.basename(image)))
return self

def reset(self):
Expand Down
2 changes: 1 addition & 1 deletion third_party/qpg_sdk/repo
Submodule repo updated from 675a0b to 819615

0 comments on commit 91be646

Please sign in to comment.