Skip to content

Commit 544da73

Browse files
authored
[Rebased] Add new platform: Ameba (#9232)
* Add Dockerfile for Ameba platform * Add Ameba into vscode and amend the ENV * Modify Dockerfile and update version * Add new platform: Ameba * Add docker_build and build_examples features * Patch for adapting the changes up to Base0913 * Remove build.sh * Rename platform and apply updates for the comments * Fix undefined reference usleep * Add cmake files for ameba * Fix compile error after rebase and clean files * Update cmake files * Support build_example build * Made modifications for the review questions * Update based on comments and fix restyled errors * Optimize the script with no env variable added * Include chip_data_model.cmake into cmakelist * Adapt the name change of mdns * Update platform for unit test * Fix the check-spellcheck failure
1 parent 2c53567 commit 544da73

Some content is hidden

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

54 files changed

+2843
-13
lines changed

.github/.wordlist.txt

+15-6
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ AE
2828
aef
2929
algs
3030
alloc
31+
Ameba
32+
ameba
33+
amebad
34+
amebaiot
3135
AnnounceOTAProvider
3236
APIs
3337
apk
@@ -44,6 +48,7 @@ args
4448
argv
4549
armeabi
4650
armv
51+
asdk
4752
ASYNC
4853
att
4954
attId
@@ -52,6 +57,7 @@ attrListName
5257
attrMask
5358
attSizeBytes
5459
attType
60+
ATW
5561
AudioOutput
5662
auth
5763
autoconnect
@@ -113,7 +119,6 @@ CAfile
113119
cancelled
114120
CBB
115121
cbd
116-
CMD
117122
CCMP
118123
CCS
119124
CCSTUDIO
@@ -139,8 +144,8 @@ ChipImInitiator
139144
ChipImResponder
140145
ChipLight
141146
ChipMessageLayer
142-
CHIPTool
143147
CHIPTest
148+
CHIPTool
144149
chmod
145150
chrpath
146151
cipd
@@ -160,6 +165,7 @@ clusterListName
160165
ClusterRevision
161166
ClusterTestGeneration
162167
cmake
168+
CMD
163169
CMSIS
164170
CMVH
165171
cn
@@ -269,6 +275,7 @@ DISTRO
269275
Distutils
270276
DK
271277
DL
278+
DM
272279
DMG
273280
DNS
274281
Dnsmasq
@@ -659,6 +666,7 @@ PacketBuffer
659666
PAI
660667
PairDevice
661668
PAKE
669+
pankore
662670
param
663671
params
664672
PartNumber
@@ -679,9 +687,9 @@ PID
679687
Pigweed
680688
PinCode
681689
pkgconfig
690+
plaintext
682691
PlatformManager
683692
PlatformManagerImpl
684-
plaintext
685693
plt
686694
png
687695
polymorphism
@@ -768,6 +776,7 @@ RPi
768776
rsn
769777
RSSI
770778
rsync
779+
RTL
771780
rtld
772781
RTOS
773782
RTT
@@ -785,9 +794,9 @@ ScriptBinding
785794
SDC
786795
SDHC
787796
SDK
788-
SDK's
789797
sdkconfig
790798
SDKs
799+
SDK's
791800
SDKTARGETSYSROOT
792801
sdl
793802
segger
@@ -798,8 +807,8 @@ SERIALDEVICE
798807
SerialNumber
799808
ServiceId
800809
SetDns
801-
SetUpPINCode
802810
SetpointRaiseLower
811+
SetUpPINCode
803812
SetupQRCode
804813
sexualized
805814
SIGINT
@@ -910,8 +919,8 @@ ttyUSB
910919
TvChannel
911920
txt
912921
uart
913-
udhcpc
914922
UART
923+
udhcpc
915924
UDP
916925
UDPEndPoint
917926
udpPort

.vscode/tasks.json

+1
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@
211211
"id": "exampleTarget",
212212
"description": "What target to build",
213213
"options": [
214+
"ameba-amebad-all-clusters",
214215
"android-arm-chip-tool",
215216
"android-arm64-chip-test",
216217
"android-arm64-chip-tool",

config/ameba/.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/ameba/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("ameba") {
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/ameba/args.gni

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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+
chip_device_platform = "ameba"
19+
20+
chip_project_config_include = ""
21+
chip_system_project_config_include = ""
22+
chip_ble_project_config_include = ""
23+
24+
mbedtls_target = "//mbedtls:mbedtls"
25+
lwip_platform = "external"
26+
27+
chip_build_tests = true
28+
chip_inet_config_enable_dns_resolver = false
29+
30+
chip_inet_config_enable_tcp_endpoint = true
31+
chip_inet_config_enable_udp_endpoint = true
32+
33+
chip_bypass_rendezvous = true
34+
chip_config_network_layer_ble = false
35+
36+
custom_toolchain = "//third_party/connectedhomeip/config/ameba/toolchain:ameba"

config/ameba/build

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

config/ameba/build_overrides

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

config/ameba/chip.cmake

+116
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
cmake_minimum_required(VERSION 3.6)
2+
3+
project(chip-gn)
4+
5+
set(chip_dir "${ameba_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+
get_filename_component(CHIP_ROOT ${chip_dir} REALPATH)
12+
get_filename_component(CHIP_OUTPUT ${chip_dir_output} REALPATH)
13+
get_filename_component(LIB_ROOT ${prj_root}/GCC-RELEASE/project_hp/asdk/lib/application 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_PLATFORM_8721D
25+
-DCONFIG_USE_MBEDTLS_ROM_ALG
26+
-DCONFIG_FUNCION_O0_OPTIMIZE
27+
-DDM_ODM_SUPPORT_TYPE=32
28+
-DCHIP_DEVICE_LAYER_TARGET=Ameba
29+
-DMBEDTLS_CONFIG_FILE=\\\"mbedtls_config.h\\\"
30+
)
31+
32+
list(
33+
APPEND CHIP_CXXFLAGS
34+
35+
-DFD_SETSIZE=10
36+
-Wno-sign-compare
37+
-Wno-unused-function
38+
-Wno-unused-but-set-variable
39+
-Wno-unused-variable
40+
-Wno-deprecated-declarations
41+
-Wno-unused-parameter
42+
-Wno-format
43+
)
44+
45+
list(
46+
APPEND CHIP_INC
47+
48+
${CHIP_ROOT}/config/ameba
49+
${CHIP_ROOT}/src/include
50+
${CHIP_ROOT}/src/lib
51+
${CHIP_ROOT}/src
52+
${CHIP_ROOT}/src/system
53+
${CHIP_ROOT}/src/app
54+
${CHIP_ROOT}/third_party/nlassert/repo/include
55+
${CHIP_ROOT}/third_party/nlio/repo/include
56+
${CHIP_ROOT}/third_party/nlunit-test/repo/src
57+
)
58+
59+
execute_process(
60+
COMMAND echo "mkdir CHIP output folder ..."
61+
COMMAND mkdir -p ${CHIP_OUTPUT}
62+
)
63+
64+
foreach(tmp IN LISTS CHIP_CFLAGS)
65+
string(CONCAT appended "\"" ${tmp} "\", ")
66+
string(APPEND chip_c_flags "${appended}")
67+
endforeach()
68+
foreach(tmp IN LISTS GLOBAL_C_FLAGS)
69+
string(CONCAT appended "\"" ${tmp} "\", ")
70+
string(APPEND chip_c_flags "${appended}")
71+
endforeach()
72+
foreach(tmp IN LISTS inc_path)
73+
string(CONCAT appended "\"-I" ${tmp} "\", ")
74+
string(APPEND chip_c_flags "${appended}")
75+
endforeach()
76+
foreach(tmp IN LISTS CHIP_INC)
77+
string(CONCAT appended "\"-I" ${tmp} "\", ")
78+
string(APPEND chip_c_flags "${appended}")
79+
endforeach()
80+
foreach(tmp IN LISTS CHIP_CXXFLAGS)
81+
string(CONCAT appended "\"" ${tmp} "\", ")
82+
string(APPEND chip_cpp_flags "${appended}")
83+
endforeach()
84+
foreach(tmp IN LISTS GLOBAL_CPP_FLAGS)
85+
string(CONCAT appended "\"" ${tmp} "\", ")
86+
string(APPEND chip_cpp_flags "${appended}")
87+
endforeach()
88+
string(APPEND chip_cpp_flags "${chip_c_flags}")
89+
90+
set(import_str "import(\"//args.gni\")\n" )
91+
92+
string(APPEND CHIP_GN_ARGS "${import_str}")
93+
string(APPEND CHIP_GN_ARGS "target_cflags_c = [${chip_c_flags}]\n")
94+
string(APPEND CHIP_GN_ARGS "target_cflags_cc = [${chip_cpp_flags}]\n")
95+
string(APPEND CHIP_GN_ARGS "ameba_ar = \"arm-none-eabi-ar\"\n")
96+
string(APPEND CHIP_GN_ARGS "ameba_cc = \"arm-none-eabi-gcc\"\n")
97+
string(APPEND CHIP_GN_ARGS "ameba_cxx = \"arm-none-eabi-c++\"\n")
98+
string(APPEND CHIP_GN_ARGS "ameba_cpu = \"ameba\"\n")
99+
string(APPEND CHIP_GN_ARGS "chip_build_tests = false\n")
100+
101+
file(GENERATE OUTPUT ${CHIP_OUTPUT}/args.gn CONTENT ${CHIP_GN_ARGS})
102+
103+
ExternalProject_Add(
104+
chip-gn
105+
PREFIX ${CMAKE_CURRENT_BINARY_DIR}
106+
SOURCE_DIR ${CHIP_ROOT}
107+
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}
108+
CONFIGURE_COMMAND gn --root=${CHIP_ROOT}/config/ameba gen --check --fail-on-unused-args ${CHIP_OUTPUT}
109+
BUILD_COMMAND ninja -C ${CHIP_OUTPUT}
110+
INSTALL_COMMAND ""
111+
BUILD_BYPRODUCTS -lCHIP
112+
CONFIGURE_ALWAYS TRUE
113+
BUILD_ALWAYS TRUE
114+
USES_TERMINAL_CONFIGURE TRUE
115+
USES_TERMINAL_BUILD TRUE
116+
)

config/ameba/mbedtls/BUILD.gn

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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+
20+
# Ameba has its own mbedtls, so nothing to do, just provide a target
21+
group("mbedtls") {
22+
}
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../..

0 commit comments

Comments
 (0)