Skip to content

Commit

Permalink
Implement the Pigweed-app example on EFR32 (#4630)
Browse files Browse the repository at this point in the history
* Implement the Pigweed-app example on EFR32
- Init uart driver and create function to read and write a character
- link those  functions with pigweed backend
- move some files that can be shared for all EFR32 examples to efr32/platform
- create GN build structure for pigweed usage with EFR32 platform

Implement the Pigweed-app example on EFR32
- Init uart driver and create function to read and write a character
- link those  functions with pigweed backend
- move some files that can be shared for all EFR32 examples to efr32/platform
- create GN build structure for pigweed usage with EFR32 platform

Change uart driver from uartdrv to retargetSerial, using the dma was causing issues reading with pigweed proto
Cleanup in the build GN files

Some cleanup for the build

* Restyled by whitespace

* Restyled by gn

* Restyled by prettier-markdown

* Fix the new symlink to be relative paths
Change copyright to 2021 for new files

* Restyled by gn

* Move config cpp17 -> std_cpp17 to lib/pw_rpc/BUILD.gn so it can be use for all examples. That config is only used when pw_rpc is build
Create a with_pw_rpc.gni file in efr examples. This gni file need to be imported in the build args when we will want to build a example with pw_rpc (this is still a WIP)

This doesn't impact pigweed-app example because it always runs the pw_rpc

* Restyled by gn

Co-authored-by: Restyled.io <[email protected]>
  • Loading branch information
jmartinez-silabs and restyled-commits authored Feb 8, 2021
1 parent 571738d commit f295f98
Show file tree
Hide file tree
Showing 47 changed files with 1,820 additions and 806 deletions.
47 changes: 47 additions & 0 deletions config/efr32/lib/pw_rpc/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# 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.

import("//build_overrides/chip.gni")
import("//build_overrides/pigweed.gni")
import("$dir_pw_build/target_types.gni")

config("cpp17") {
cflags_cc = [ "-std=gnu++17" ]
cflags_c = [ "-std=gnu11" ]
cflags_objc = [ "-std=gnu11" ]
cflags_objcc = [ "-std=gnu++17" ]
}

config("std_cpp17") {
configs = [ ":cpp17" ]
}

static_library("pw_rpc") {
output_name = "libPwRpc"

public_configs = [ "${dir_pigweed}/pw_hdlc:default_config" ]
sources = [ "${dir_pigweed}/pw_hdlc/rpc_example/hdlc_rpc_server.cc" ]
deps = [
"$dir_pw_rpc:server",
"$dir_pw_rpc/nanopb:echo_service",
"$dir_pw_rpc/system_server",
"${chip_root}/examples/platform/efr32/pw_sys_io:pw_sys_io_efr32",
"${dir_pigweed}/pw_hdlc:pw_rpc",
dir_pw_assert,
dir_pw_hdlc,
dir_pw_log,
]

output_dir = "${root_out_dir}/lib"
}
25 changes: 25 additions & 0 deletions config/efr32/lib/pw_rpc/pw_rpc.gni
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# 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.

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

pw_log_BACKEND = "$dir_pw_log_basic"
pw_assert_BACKEND = "$dir_pw_assert_log"
pw_sys_io_BACKEND =
"${chip_root}/examples/platform/efr32/pw_sys_io:pw_sys_io_efr32"
pw_rpc_system_server_BACKEND =
"${chip_root}/examples/common/pigweed:system_rpc_server"

dir_pw_third_party_nanopb = "${chip_root}/third_party/nanopb/repo"
2 changes: 1 addition & 1 deletion config/efr32/toolchain/BUILD.gn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2020 Project CHIP Authors
# 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.
Expand Down
7 changes: 3 additions & 4 deletions examples/lighting-app/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,13 @@ efr32_sdk("sdk") {
include_dirs = [
"${chip_root}/src/platform/EFR32",
"${efr32_project_dir}/include",
"${efr32_project_dir}/src",
"${examples_plat_dir}",
"${examples_plat_dir}/${efr32_family}/${efr32_board}",
]

sources = [
"${efr32_project_dir}/include/CHIPProjectConfig.h",
"${efr32_project_dir}/include/FreeRTOSConfig.h",
"${examples_plat_dir}/${efr32_family}/${efr32_board}/hal-config.h",
]

defines = []
Expand Down Expand Up @@ -79,14 +78,14 @@ efr32_executable("lighting_app") {
]

include_dirs += [
"${efr32_project_dir}/include",
"include",
"${chip_root}/src/app/util",
"${chip_root}/src/app/server",
"${examples_plat_dir}",
"${examples_plat_dir}/${efr32_family}/${efr32_board}",
]

sources = [
"${examples_plat_dir}/${efr32_family}/${efr32_board}/hal-config.h",
"${examples_plat_dir}/${efr32_family}/${efr32_board}/init_board.c",
"${examples_plat_dir}/${efr32_family}/${efr32_board}/init_mcu.c",
"${examples_plat_dir}/LEDWidget.cpp",
Expand Down
4 changes: 4 additions & 0 deletions examples/lighting-app/efr32/args.gni
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
# limitations under the License.

import("//build_overrides/chip.gni")
import("//build_overrides/pigweed.gni")
import("${chip_root}/examples/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"
29 changes: 29 additions & 0 deletions examples/lighting-app/efr32/with_pw_rpc.gni
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# 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.

# add this gni as import in your build args to use pigweed in the example
# 'import("//with_pw_rpc.gni")'
# *WIP* pigweed is not fully integrated in this EFR example yet

import("//build_overrides/chip.gni")
import("${chip_root}/config/efr32/lib/pw_rpc/pw_rpc.gni")
import("${chip_root}/examples/platform/efr32/args.gni")

efr32_sdk_target = get_label_info(":sdk", "label_no_toolchain")

declare_args() {
chip_build_pw_rpc_lib = true
}

default_configs_std = [ "${chip_root}/config/efr32/lib/pw_rpc:std_cpp17" ]
9 changes: 4 additions & 5 deletions examples/lock-app/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,14 @@ if (efr32_board == "BRD4166A") {
efr32_sdk("sdk") {
include_dirs = [
"${chip_root}/src/platform/EFR32",
"${efr32_project_dir}/include/",
"${efr32_project_dir}/src/",
"${efr32_project_dir}/include",
"${examples_plat_dir}",
"${examples_plat_dir}/${efr32_family}/${efr32_board}",
]

sources = [
"${efr32_project_dir}/include/CHIPProjectConfig.h",
"${efr32_project_dir}/include/FreeRTOSConfig.h",
"${examples_plat_dir}/${efr32_family}/${efr32_board}/hal-config.h",
]

defines = []
Expand Down Expand Up @@ -79,14 +78,14 @@ efr32_executable("lock_app") {
]

include_dirs += [
"${efr32_project_dir}/include",
"include",
"${chip_root}/src/app/util",
"${chip_root}/src/app/server",
"${examples_plat_dir}",
"${examples_plat_dir}/${efr32_family}/${efr32_board}",
]

sources = [
"${examples_plat_dir}/${efr32_family}/${efr32_board}/hal-config.h",
"${examples_plat_dir}/${efr32_family}/${efr32_board}/init_board.c",
"${examples_plat_dir}/${efr32_family}/${efr32_board}/init_mcu.c",
"${examples_plat_dir}/LEDWidget.cpp",
Expand Down
4 changes: 4 additions & 0 deletions examples/lock-app/efr32/args.gni
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
# limitations under the License.

import("//build_overrides/chip.gni")
import("//build_overrides/pigweed.gni")
import("${chip_root}/examples/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"
46 changes: 0 additions & 46 deletions examples/lock-app/efr32/include/ble-configuration.h

This file was deleted.

Loading

0 comments on commit f295f98

Please sign in to comment.