-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Shell example: EFR32 platform added. (#7317)
- Loading branch information
1 parent
7135eb1
commit 92c6d29
Showing
12 changed files
with
910 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# 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/build.gni") | ||
|
||
# The location of the build configuration file. | ||
buildconfig = "${build_root}/config/BUILDCONFIG.gn" | ||
|
||
# CHIP uses angle bracket includes. | ||
check_system_includes = true | ||
|
||
default_args = { | ||
target_cpu = "arm" | ||
target_os = "freertos" | ||
|
||
import("//args.gni") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
# 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/build.gni") | ||
import("//build_overrides/chip.gni") | ||
import("//build_overrides/efr32_sdk.gni") | ||
|
||
import("${build_root}/config/defaults.gni") | ||
import("${efr32_sdk_build_root}/efr32_executable.gni") | ||
import("${efr32_sdk_build_root}/efr32_sdk.gni") | ||
|
||
assert(current_os == "freertos") | ||
|
||
efr32_project_dir = "${chip_root}/examples/shell/efr32" | ||
examples_plat_dir = "${chip_root}/examples/platform/efr32" | ||
|
||
declare_args() { | ||
# Dump memory usage at link time. | ||
chip_print_memory_usage = true | ||
|
||
# Monitor & log memory usage at runtime. | ||
enable_heap_monitoring = false | ||
} | ||
|
||
efr32_sdk("sdk") { | ||
sources = [ | ||
"${efr32_project_dir}/include/CHIPProjectConfig.h", | ||
"${efr32_project_dir}/include/FreeRTOSConfig.h", | ||
] | ||
|
||
include_dirs = [ | ||
"${chip_root}/src/platform/EFR32", | ||
"${efr32_project_dir}/include", | ||
"${examples_plat_dir}", | ||
"${examples_plat_dir}/${efr32_family}/${efr32_board}", | ||
] | ||
|
||
defines = [ | ||
"BOARD_ID=${efr32_board}", | ||
"SL_HEAP_SIZE=(12 * 1024)", | ||
"OPENTHREAD_CONFIG_CLI_TRANSPORT=OT_CLI_TRANSPORT_CONSOLE", | ||
"ENABLE_CHIP_SHELL", | ||
] | ||
} | ||
|
||
efr32_executable("shell_app") { | ||
output_name = "chip-efr32-shell-example.out" | ||
|
||
sources = [ | ||
"${examples_plat_dir}/Service.cpp", | ||
"${examples_plat_dir}/init_efrPlatform.cpp", | ||
"${examples_plat_dir}/uart.c", | ||
"src/main.cpp", | ||
] | ||
|
||
deps = [ | ||
":sdk", | ||
"${chip_root}/examples/shell/shell_common:shell_common", | ||
"${chip_root}/src/lib", | ||
"${chip_root}/src/setup_payload", | ||
"${chip_root}/third_party/openthread/platforms:libopenthread-platform", | ||
"${chip_root}/third_party/openthread/platforms:libopenthread-platform-utils", | ||
"${chip_root}/third_party/openthread/repo:libopenthread-ftd", | ||
] | ||
|
||
include_dirs = [ "include" ] | ||
|
||
defines = [] | ||
|
||
if (enable_heap_monitoring) { | ||
sources += [ "${examples_plat_dir}/MemMonitoring.cpp" ] | ||
defines += [ "HEAP_MONITORING" ] | ||
} | ||
|
||
if (efr32_family == "efr32mg12") { | ||
ldscript = "${examples_plat_dir}/ldscripts/efr32-MG12P.ld" | ||
} else if (efr32_family == "efr32mg21") { | ||
ldscript = "${examples_plat_dir}/ldscripts/efr32-MG21.ld" | ||
} | ||
|
||
inputs = [ ldscript ] | ||
|
||
ldflags = [ "-T" + rebase_path(ldscript, root_build_dir) ] | ||
|
||
if (chip_print_memory_usage) { | ||
ldflags += [ | ||
"-Wl,--print-memory-usage", | ||
"-fstack-usage", | ||
] | ||
} | ||
|
||
output_dir = root_out_dir | ||
} | ||
|
||
group("efr32") { | ||
deps = [ ":shell_app" ] | ||
} | ||
|
||
group("default") { | ||
deps = [ ":efr32" ] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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_overrides/pigweed.gni") | ||
import("${chip_root}/src/platform/EFR32/args.gni") | ||
|
||
efr32_sdk_target = get_label_info(":sdk", "label_no_toolchain") | ||
|
||
pw_log_BACKEND = "${chip_root}/src/lib/support/pw_log_chip" | ||
pw_assert_BACKEND = "$dir_pw_assert_log" | ||
chip_enable_openthread = true | ||
chip_build_shell_lib = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../build_overrides |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/* | ||
* | ||
* Copyright (c) 2020 Project CHIP Authors | ||
* Copyright (c) 2019 Google LLC. | ||
* 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. | ||
*/ | ||
|
||
#pragma once | ||
|
||
// ---- Lighting Example App Config ---- | ||
|
||
#define APP_TASK_NAME "Shell_Task" | ||
|
||
// EFR32 WSTK Buttons | ||
#define PB0 0 | ||
#define PB1 1 | ||
|
||
// EFR32 WSTK LEDs | ||
#define BSP_LED_0 0 | ||
#define BSP_LED_1 1 | ||
|
||
#define APP_LIGHT_SWITCH PB1 | ||
#define APP_FUNCTION_BUTTON PB0 | ||
#define APP_BUTTON_DEBOUNCE_PERIOD_MS 50 | ||
|
||
#define APP_BUTTON_PRESSED 0 | ||
#define APP_BUTTON_RELEASED 1 | ||
|
||
#define SYSTEM_STATE_LED BSP_LED_0 | ||
#define LIGHT_LED BSP_LED_1 | ||
|
||
// Time it takes in ms for the simulated actuator to move from one | ||
// state to another. | ||
#define ACTUATOR_MOVEMENT_PERIOS_MS 10 | ||
|
||
// ---- Light Example SWU Config ---- | ||
#define SWU_INTERVAl_WINDOW_MIN_MS (23 * 60 * 60 * 1000) // 23 hours | ||
#define SWU_INTERVAl_WINDOW_MAX_MS (24 * 60 * 60 * 1000) // 24 hours | ||
|
||
// ---- Thread Polling Config ---- | ||
#define THREAD_ACTIVE_POLLING_INTERVAL_MS 100 | ||
#define THREAD_INACTIVE_POLLING_INTERVAL_MS 1000 | ||
|
||
// EFR Logging | ||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
void efr32LogInit(void); | ||
|
||
void efr32Log(const char * aFormat, ...); | ||
#define EFR32_LOG(...) efr32Log(__VA_ARGS__); | ||
void appError(int err); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
/* | ||
* | ||
* Copyright (c) 2020 Project CHIP Authors | ||
* Copyright (c) 2019 Google LLC. | ||
* 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. | ||
*/ | ||
|
||
/** | ||
* @file | ||
* Example project configuration file for CHIP. | ||
* | ||
* This is a place to put application or project-specific overrides | ||
* to the default configuration values for general CHIP features. | ||
* | ||
*/ | ||
|
||
#pragma once | ||
|
||
/** | ||
* CHIP_DEVICE_CONFIG_ENABLE_TEST_DEVICE_IDENTITY | ||
* | ||
* Enables the use of a hard-coded default Chip device id and credentials if no device id | ||
* is found in Chip NV storage. | ||
* | ||
* This option is for testing only and should be disabled in production releases. | ||
*/ | ||
#define CHIP_DEVICE_CONFIG_ENABLE_TEST_DEVICE_IDENTITY 34 | ||
|
||
// Use a default pairing code if one hasn't been provisioned in flash. | ||
#ifndef CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE | ||
#define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE 20202021 | ||
#endif | ||
#define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR 0xF00 | ||
|
||
// For convenience, Chip Security Test Mode can be enabled and the | ||
// requirement for authentication in various protocols can be disabled. | ||
// | ||
// WARNING: These options make it possible to circumvent basic Chip security functionality, | ||
// including message encryption. Because of this they MUST NEVER BE ENABLED IN PRODUCTION BUILDS. | ||
// | ||
#define CHIP_CONFIG_SECURITY_TEST_MODE 0 | ||
#define CHIP_CONFIG_REQUIRE_AUTH 1 | ||
|
||
/** | ||
* CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID | ||
* | ||
* 0x235A: Chip's Vendor Id. | ||
*/ | ||
#define CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID 0x235A | ||
|
||
/** | ||
* CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID | ||
* | ||
* 0x534C: EFR32 lighting-app | ||
*/ | ||
#define CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID 0x534C | ||
|
||
/** | ||
* CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_REVISION | ||
* | ||
* The product revision number assigned to device or product by the device vendor. This | ||
* number is scoped to the device product id, and typically corresponds to a revision of the | ||
* physical device, a change to its packaging, and/or a change to its marketing presentation. | ||
* This value is generally *not* incremented for device software revisions. | ||
*/ | ||
#define CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_REVISION 1 | ||
|
||
/** | ||
* CHIP_DEVICE_CONFIG_DEVICE_FIRMWARE_REVISION_STRING | ||
* | ||
* A string identifying the firmware revision running on the device. | ||
* CHIP service currently expects the firmware version to be in the format | ||
* {MAJOR_VERSION}.0d{MINOR_VERSION} | ||
*/ | ||
#ifndef CHIP_DEVICE_CONFIG_DEVICE_FIRMWARE_REVISION_STRING | ||
#define CHIP_DEVICE_CONFIG_DEVICE_FIRMWARE_REVISION_STRING "0.1ALPHA" | ||
#endif | ||
/** | ||
* CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE | ||
* | ||
* Enable support for Chip-over-BLE (CHIPoBLE). | ||
*/ | ||
#define CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE 1 | ||
|
||
/** | ||
* CHIP_DEVICE_CONFIG_ENABLE_CHIP_TIME_SERVICE_TIME_SYNC | ||
* | ||
* Enables synchronizing the device's real time clock with a remote Chip Time service | ||
* using the Chip Time Sync protocol. | ||
*/ | ||
#define CHIP_DEVICE_CONFIG_ENABLE_CHIP_TIME_SERVICE_TIME_SYNC 0 | ||
|
||
/** | ||
* CHIP_DEVICE_CONFIG_TEST_SERIAL_NUMBER | ||
* | ||
* Enables the use of a hard-coded default serial number if none | ||
* is found in Chip NV storage. | ||
*/ | ||
#define CHIP_DEVICE_CONFIG_TEST_SERIAL_NUMBER "TEST_SN" | ||
|
||
/** | ||
* CHIP_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS | ||
* | ||
* Enable recording UTC timestamps. | ||
*/ | ||
#define CHIP_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS 1 | ||
|
||
/** | ||
* CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE | ||
* | ||
* A size, in bytes, of the individual debug event logging buffer. | ||
*/ | ||
#define CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE (512) |
Oops, something went wrong.