Skip to content

Commit fece770

Browse files
authored
[Realtek] First porting Bee4 (#37005)
* [Realtek] First porting Bee4 * [Realtek] Fix spelling error * [Realtek] Update zap file * [Realtek] Modify zap & code-lints error * [Realtek] Update zap file * [Realtek] Remove some files * [Realtek] Remove commented out lines * [Realtek] Update README * [Realtek] Remove pigweed-app & restyle file * [Realtek] Remove no use code * [Realtek] Add build target for realtek examples * [Realtek] Restyle some files * [Realtek] Update zap * [Realtek] Fix compile error * [Realtek] Fix commission issue * [Realtek] Add realtek targets into testdata * [Realtek] Fix conflict * [Realtek] Fix conflict * [Realtek] fix confict * [Realtek] Optimize build flow * [Realtek] Fix some review errors * [Realtek] Remove include ember internals * [Realtek] Update .matter files * [Realtek] Update zap files * [Realtek] Restyle file * [Realtek] remove os.envir & update ot-realtek * [Realtek] Optimize build script * [Realtek] Support dry-run * [Realtek] Update zap files * [Realtek] Add output log
1 parent 5b1d9f2 commit fece770

File tree

151 files changed

+61244
-4
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

151 files changed

+61244
-4
lines changed

.github/.wordlist.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1201,6 +1201,7 @@ READMEs
12011201
readonly
12021202
readthedocs
12031203
Reag
1204+
Realtek
12041205
rebase
12051206
recommand
12061207
recommanded

.gitmodules

+5-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
path = third_party/freertos/repo
5151
url = https://github.com/FreeRTOS/FreeRTOS-Kernel.git
5252
branch = V10.3.1-kernel-only
53-
platforms = ameba,cc13xx_26xx,bouffalolab,esp32,infineon,qpg,cc32xx
53+
platforms = ameba,cc13xx_26xx,bouffalolab,esp32,infineon,qpg,cc32xx,realtek_bee
5454
[submodule "simw-top-mini"]
5555
path = third_party/simw-top-mini/repo
5656
url = https://github.com/NXP/plug-and-trust.git
@@ -354,3 +354,7 @@
354354
url = https://github.com/paullouisageneau/libdatachannel.git
355355
platforms = linux
356356
recursive = true
357+
[submodule "third_party/openthread/ot-realtek"]
358+
path = third_party/openthread/ot-realtek
359+
url = https://github.com/rtkconnectivity/ot-realtek.git
360+
platforms = realtek_bee

build_overrides/bee_sdk.gni

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Copyright (c) 2020-2021 Project CHIP Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
declare_args() {
16+
# Root directory for Bee SDK.
17+
bee_sdk_build_root = "//third_party/bee_sdk"
18+
}

config/realtek_bee/.gn

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Copyright (c) 2020 Project CHIP Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
import("//build_overrides/build.gni")
16+
17+
# The location of the build configuration file.
18+
buildconfig = "${build_root}/config/BUILDCONFIG.gn"
19+
20+
# CHIP uses angle bracket includes.
21+
check_system_includes = true
22+
23+
default_args = {
24+
target_cpu = "arm"
25+
target_os = "freertos"
26+
27+
import("//args.gni")
28+
}

config/realtek_bee/BUILD.gn

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Copyright (c) 2020 Project CHIP Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# Options from standalone-chip.mk that differ from configure defaults. These
16+
# options are used from examples/.
17+
18+
import("//build_overrides/build.gni")
19+
import("//build_overrides/chip.gni")
20+
21+
import("${chip_root}/build/chip/tests.gni")
22+
23+
declare_args() {
24+
chip_build_pw_rpc_lib = false
25+
}
26+
27+
group("realtek_bee") {
28+
deps = [ "${chip_root}/src/lib" ]
29+
30+
if (chip_build_pw_rpc_lib) {
31+
deps += [ "//lib/pw_rpc" ]
32+
}
33+
34+
if (chip_build_tests) {
35+
deps += [ "${chip_root}/src:tests" ]
36+
}
37+
}

config/realtek_bee/args.gni

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Copyright (c) 2020 Project CHIP Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# Options from standalone-chip.mk that differ from configure defaults. These
16+
# options are used from examples/.
17+
18+
import("//build_overrides/chip.gni")
19+
import("//build_overrides/pigweed.gni")
20+
21+
chip_device_platform = "realtek_bee"
22+
23+
# ARM architecture flags will be set for Bee
24+
arm_platform_config = "${chip_root}/config/realtek_bee/bee_arm.gni"
25+
26+
chip_project_config_include = ""
27+
chip_system_project_config_include = ""
28+
chip_ble_project_config_include = ""
29+
30+
mbedtls_target = "//mbedtls:mbedtls"
31+
lwip_platform = "external"
32+
33+
chip_build_tests = false
34+
35+
chip_enable_openthread = true
36+
37+
chip_inet_config_enable_ipv4 = false
38+
chip_inet_config_enable_tcp_endpoint = false
39+
chip_enable_nfc_onboarding_payload = false
40+
chip_build_libshell = false
41+
chip_enable_ota_requestor = false
42+
43+
openthread_root = ""
44+
45+
chip_config_network_layer_ble = true
46+
47+
custom_toolchain =
48+
"//third_party/connectedhomeip/config/realtek_bee/toolchain:realtek_bee"

config/realtek_bee/bee_arm.gni

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Copyright (c) 2020 Project CHIP Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
arm_arch = "armv8.1-m.main+dsp+mve+fp"
16+
17+
arm_float_abi = "hard"

config/realtek_bee/build

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
third_party/connectedhomeip/build

config/realtek_bee/build_overrides

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../examples/build_overrides

config/realtek_bee/chip.cmake

+193
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,193 @@
1+
cmake_minimum_required(VERSION 3.20)
2+
3+
project(chip-gn)
4+
5+
set(chip_dir "${bee_matter_root}")
6+
set(chip_dir_output "${matter_output_path}/chip")
7+
set(chip_c_flags "")
8+
set(chip_cpp_flags "")
9+
set(chip-gn chip-gn)
10+
11+
set(matter_enable_rotating_id 1)
12+
13+
get_filename_component(CHIP_OUTPUT ${chip_dir_output} REALPATH)
14+
15+
include(ExternalProject)
16+
17+
# FOR CHIP
18+
string(APPEND CHIP_GN_ARGS)
19+
20+
list(
21+
APPEND CHIP_CFLAGS
22+
23+
-DCHIP_PROJECT=1
24+
-DCONFIG_USE_MBEDTLS_ROM_ALG
25+
-DDM_ODM_SUPPORT_TYPE=32
26+
-DCHIP_DEVICE_LAYER_TARGET=Realtek_bee
27+
-D_POSIX_REALTIME_SIGNALS
28+
-DCHIP_SHELL_MAX_TOKENS=11
29+
)
30+
# Build Matter otcli
31+
if (matter_enable_otcli)
32+
list(APPEND CHIP_CFLAGS -DCHIP_DEVICE_CONFIG_THREAD_ENABLE_CLI=1)
33+
endif (matter_enable_otcli)
34+
35+
if (matter_enable_factory_data)
36+
list(APPEND CHIP_CFLAGS -DCONFIG_FACTORY_DATA=1)
37+
endif (matter_enable_factory_data)
38+
39+
list(
40+
APPEND CHIP_CXXFLAGS
41+
42+
-DFD_SETSIZE=10
43+
-Wno-sign-compare
44+
-Wno-unused-function
45+
-Wno-unused-but-set-variable
46+
-Wno-unused-variable
47+
-Wno-deprecated-declarations
48+
-Wno-unused-parameter
49+
-Wno-unused-label
50+
-Wno-format
51+
-Wno-stringop-truncation
52+
-Wno-format-nonliteral
53+
-Wno-format-security
54+
-std=gnu++17
55+
)
56+
57+
list(
58+
APPEND CHIP_INC
59+
60+
${inc_path}
61+
${CHIP_ROOT}/config/realtek_bee
62+
${CHIP_ROOT}/src/include
63+
${CHIP_ROOT}/src/lib
64+
${CHIP_ROOT}/src
65+
${CHIP_ROOT}/src/system
66+
${CHIP_ROOT}/src/app
67+
${CHIP_ROOT}/src/platform/Realtek_bee
68+
${CHIP_ROOT}/src/platform/OpenThread
69+
${CHIP_ROOT}/third_party/nlassert/repo/include
70+
${CHIP_ROOT}/third_party/nlio/repo/include
71+
)
72+
73+
execute_process(
74+
COMMAND echo "mkdir CHIP output folder ..."
75+
COMMAND mkdir -p ${CHIP_OUTPUT}
76+
)
77+
78+
foreach(tmp IN LISTS CHIP_CFLAGS)
79+
string(CONCAT appended "\"" ${tmp} "\", ")
80+
string(APPEND chip_c_flags "${appended}")
81+
endforeach()
82+
foreach(tmp IN LISTS GLOBAL_C_FLAGS)
83+
string(CONCAT appended "\"" ${tmp} "\", ")
84+
string(APPEND chip_c_flags "${appended}")
85+
endforeach()
86+
foreach(tmp IN LISTS inc_path)
87+
string(CONCAT appended "\"-I" ${tmp} "\", ")
88+
string(APPEND chip_c_flags "${appended}")
89+
endforeach()
90+
foreach(tmp IN LISTS CHIP_INC)
91+
string(CONCAT appended "\"-I" ${tmp} "\", ")
92+
string(APPEND chip_c_flags "${appended}")
93+
endforeach()
94+
foreach(tmp IN LISTS CHIP_CXXFLAGS)
95+
string(CONCAT appended "\"" ${tmp} "\", ")
96+
string(APPEND chip_cpp_flags "${appended}")
97+
endforeach()
98+
foreach(tmp IN LISTS GLOBAL_CXX_FLAGS)
99+
string(CONCAT appended "\"" ${tmp} "\", ")
100+
string(APPEND chip_cpp_flags "${appended}")
101+
endforeach()
102+
string(APPEND chip_cpp_flags "${chip_c_flags}")
103+
104+
set(import_str "import(\"//args.gni\")\n" )
105+
106+
string(APPEND CHIP_GN_ARGS "${import_str}")
107+
108+
string(APPEND CHIP_GN_ARGS "target_cflags_c = [${chip_c_flags}]\n")
109+
string(APPEND CHIP_GN_ARGS "target_cflags_cc = [${chip_cpp_flags}]\n")
110+
string(APPEND CHIP_GN_ARGS "bee_ar = \"arm-none-eabi-ar\"\n")
111+
string(APPEND CHIP_GN_ARGS "bee_cc = \"arm-none-eabi-gcc\"\n")
112+
string(APPEND CHIP_GN_ARGS "bee_cxx = \"arm-none-eabi-c++\"\n")
113+
string(APPEND CHIP_GN_ARGS "bee_cpu = \"arm\"\n")
114+
string(APPEND CHIP_GN_ARGS "chip_enable_openthread = true\n")
115+
string(APPEND CHIP_GN_ARGS "chip_inet_config_enable_ipv4 = false\n")
116+
string(APPEND CHIP_GN_ARGS "chip_use_transitional_commissionable_data_provider = false\n")
117+
string(APPEND CHIP_GN_ARGS "chip_logging = true\n")
118+
string(APPEND CHIP_GN_ARGS "chip_error_logging = true\n")
119+
string(APPEND CHIP_GN_ARGS "chip_progress_logging = true\n")
120+
string(APPEND CHIP_GN_ARGS "chip_detail_logging= false\n")
121+
122+
# project config
123+
string(APPEND CHIP_GN_ARGS "chip_project_config_include_dirs = [\"${matter_example_path}/main/include\"]\n")
124+
string(APPEND CHIP_GN_ARGS "chip_device_project_config_include = \"<CHIPProjectConfig.h>\"\n")
125+
string(APPEND CHIP_GN_ARGS "chip_project_config_include = \"<CHIPProjectConfig.h>\"\n")
126+
string(APPEND CHIP_GN_ARGS "chip_system_project_config_include = \"<CHIPProjectConfig.h>\"\n")
127+
128+
# Enable persistent storage audit
129+
if (matter_enable_persistentstorage_audit)
130+
string(APPEND CHIP_GN_ARGS "chip_support_enable_storage_api_audit = true\n")
131+
endif (matter_enable_persistentstorage_audit)
132+
#endif
133+
134+
# Build RPC
135+
if (matter_enable_rpc)
136+
string(APPEND CHIP_GN_ARGS "chip_build_pw_rpc_lib = true\n")
137+
string(APPEND CHIP_GN_ARGS "pw_log_BACKEND = \"//third_party/connectedhomeip/third_party/pigweed/repo/pw_log_basic\"\n")
138+
string(APPEND CHIP_GN_ARGS "pw_assert_BACKEND = \"//third_party/connectedhomeip/third_party/pigweed/repo/pw_assert_log:check_backend\"\n")
139+
string(APPEND CHIP_GN_ARGS "pw_sys_io_BACKEND = \"//third_party/connectedhomeip/examples/platform/realtek_bee/pw_sys_io:pw_sys_io_bee\"\n")
140+
string(APPEND CHIP_GN_ARGS "dir_pw_third_party_nanopb = \"//third_party/connectedhomeip/third_party/nanopb/repo\"\n")
141+
string(APPEND CHIP_GN_ARGS "pw_build_LINK_DEPS = [\"//third_party/connectedhomeip/third_party/pigweed/repo/pw_assert:impl\", \"//third_party/connectedhomeip/third_party/pigweed/repo/pw_log:impl\"]\n")
142+
string(APPEND CHIP_GN_ARGS "pw_rpc_CONFIG = \"//third_party/connectedhomeip/third_party/pigweed/repo/pw_rpc:disable_global_mutex\"")
143+
endif (matter_enable_rpc)
144+
145+
if(matter_enable_ftd)
146+
string(APPEND CHIP_GN_ARGS "chip_openthread_ftd = true\n")
147+
string(APPEND CHIP_GN_ARGS "chip_enable_icd_server = false\n")
148+
endif()
149+
150+
if(matter_enable_mtd)
151+
string(APPEND CHIP_GN_ARGS "chip_openthread_ftd = false\n")
152+
if(matter_enable_med)
153+
string(APPEND CHIP_GN_ARGS "chip_enable_icd_server = false\n")
154+
else()
155+
string(APPEND CHIP_GN_ARGS "chip_enable_icd_server = true\n")
156+
endif()
157+
endif()
158+
159+
# Build Matter Shell
160+
if (matter_enable_shell)
161+
string(APPEND CHIP_GN_ARGS "chip_build_libshell = true\n")
162+
endif (matter_enable_shell)
163+
164+
# Build ota-requestor
165+
if (matter_enable_ota_requestor)
166+
string(APPEND CHIP_GN_ARGS "chip_enable_ota_requestor = true\n")
167+
endif (matter_enable_ota_requestor)
168+
169+
# Rotating ID
170+
if (matter_enable_rotating_id)
171+
string(APPEND CHIP_GN_ARGS "chip_enable_additional_data_advertising = true\n")
172+
string(APPEND CHIP_GN_ARGS "chip_enable_rotating_device_id = true\n")
173+
else (matter_enable_rotating_id)
174+
string(APPEND CHIP_GN_ARGS "chip_enable_additional_data_advertising = false\n")
175+
string(APPEND CHIP_GN_ARGS "chip_enable_rotating_device_id = false\n")
176+
endif (matter_enable_rotating_id)
177+
178+
file(GENERATE OUTPUT ${CHIP_OUTPUT}/args.gn CONTENT ${CHIP_GN_ARGS})
179+
180+
ExternalProject_Add(
181+
chip-gn
182+
PREFIX ${CMAKE_CURRENT_BINARY_DIR}
183+
SOURCE_DIR ${CHIP_ROOT}
184+
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}
185+
CONFIGURE_COMMAND gn --root=${CHIP_ROOT}/config/realtek_bee gen --check --fail-on-unused-args ${CHIP_OUTPUT}
186+
BUILD_COMMAND ninja -C ${CHIP_OUTPUT} :realtek_bee
187+
INSTALL_COMMAND ""
188+
BUILD_BYPRODUCTS -lCHIP -lPwRpc
189+
CONFIGURE_ALWAYS TRUE
190+
BUILD_ALWAYS TRUE
191+
USES_TERMINAL_CONFIGURE TRUE
192+
USES_TERMINAL_BUILD TRUE
193+
)

0 commit comments

Comments
 (0)