-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[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
- Loading branch information
Showing
54 changed files
with
2,843 additions
and
13 deletions.
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
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
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,37 @@ | ||
# 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. | ||
|
||
# Options from standalone-chip.mk that differ from configure defaults. These | ||
# options are used from examples/. | ||
|
||
import("//build_overrides/build.gni") | ||
import("//build_overrides/chip.gni") | ||
|
||
import("${chip_root}/build/chip/tests.gni") | ||
|
||
declare_args() { | ||
chip_build_pw_rpc_lib = false | ||
} | ||
|
||
group("ameba") { | ||
deps = [ "${chip_root}/src/lib" ] | ||
|
||
if (chip_build_pw_rpc_lib) { | ||
deps += [ "//lib/pw_rpc" ] | ||
} | ||
|
||
if (chip_build_tests) { | ||
deps += [ "${chip_root}/src:tests" ] | ||
} | ||
} |
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,36 @@ | ||
# 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. | ||
|
||
# Options from standalone-chip.mk that differ from configure defaults. These | ||
# options are used from examples/. | ||
|
||
chip_device_platform = "ameba" | ||
|
||
chip_project_config_include = "" | ||
chip_system_project_config_include = "" | ||
chip_ble_project_config_include = "" | ||
|
||
mbedtls_target = "//mbedtls:mbedtls" | ||
lwip_platform = "external" | ||
|
||
chip_build_tests = true | ||
chip_inet_config_enable_dns_resolver = false | ||
|
||
chip_inet_config_enable_tcp_endpoint = true | ||
chip_inet_config_enable_udp_endpoint = true | ||
|
||
chip_bypass_rendezvous = true | ||
chip_config_network_layer_ble = false | ||
|
||
custom_toolchain = "//third_party/connectedhomeip/config/ameba/toolchain:ameba" |
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 @@ | ||
third_party/connectedhomeip/build |
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 @@ | ||
../../examples/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,116 @@ | ||
cmake_minimum_required(VERSION 3.6) | ||
|
||
project(chip-gn) | ||
|
||
set(chip_dir "${ameba_matter_root}") | ||
set(chip_dir_output "${matter_output_path}/chip") | ||
set(chip_c_flags "") | ||
set(chip_cpp_flags "") | ||
set(chip-gn chip-gn) | ||
|
||
get_filename_component(CHIP_ROOT ${chip_dir} REALPATH) | ||
get_filename_component(CHIP_OUTPUT ${chip_dir_output} REALPATH) | ||
get_filename_component(LIB_ROOT ${prj_root}/GCC-RELEASE/project_hp/asdk/lib/application REALPATH) | ||
|
||
include(ExternalProject) | ||
|
||
# FOR CHIP | ||
string(APPEND CHIP_GN_ARGS) | ||
|
||
list( | ||
APPEND CHIP_CFLAGS | ||
|
||
-DCHIP_PROJECT=1 | ||
-DCONFIG_PLATFORM_8721D | ||
-DCONFIG_USE_MBEDTLS_ROM_ALG | ||
-DCONFIG_FUNCION_O0_OPTIMIZE | ||
-DDM_ODM_SUPPORT_TYPE=32 | ||
-DCHIP_DEVICE_LAYER_TARGET=Ameba | ||
-DMBEDTLS_CONFIG_FILE=\\\"mbedtls_config.h\\\" | ||
) | ||
|
||
list( | ||
APPEND CHIP_CXXFLAGS | ||
|
||
-DFD_SETSIZE=10 | ||
-Wno-sign-compare | ||
-Wno-unused-function | ||
-Wno-unused-but-set-variable | ||
-Wno-unused-variable | ||
-Wno-deprecated-declarations | ||
-Wno-unused-parameter | ||
-Wno-format | ||
) | ||
|
||
list( | ||
APPEND CHIP_INC | ||
|
||
${CHIP_ROOT}/config/ameba | ||
${CHIP_ROOT}/src/include | ||
${CHIP_ROOT}/src/lib | ||
${CHIP_ROOT}/src | ||
${CHIP_ROOT}/src/system | ||
${CHIP_ROOT}/src/app | ||
${CHIP_ROOT}/third_party/nlassert/repo/include | ||
${CHIP_ROOT}/third_party/nlio/repo/include | ||
${CHIP_ROOT}/third_party/nlunit-test/repo/src | ||
) | ||
|
||
execute_process( | ||
COMMAND echo "mkdir CHIP output folder ..." | ||
COMMAND mkdir -p ${CHIP_OUTPUT} | ||
) | ||
|
||
foreach(tmp IN LISTS CHIP_CFLAGS) | ||
string(CONCAT appended "\"" ${tmp} "\", ") | ||
string(APPEND chip_c_flags "${appended}") | ||
endforeach() | ||
foreach(tmp IN LISTS GLOBAL_C_FLAGS) | ||
string(CONCAT appended "\"" ${tmp} "\", ") | ||
string(APPEND chip_c_flags "${appended}") | ||
endforeach() | ||
foreach(tmp IN LISTS inc_path) | ||
string(CONCAT appended "\"-I" ${tmp} "\", ") | ||
string(APPEND chip_c_flags "${appended}") | ||
endforeach() | ||
foreach(tmp IN LISTS CHIP_INC) | ||
string(CONCAT appended "\"-I" ${tmp} "\", ") | ||
string(APPEND chip_c_flags "${appended}") | ||
endforeach() | ||
foreach(tmp IN LISTS CHIP_CXXFLAGS) | ||
string(CONCAT appended "\"" ${tmp} "\", ") | ||
string(APPEND chip_cpp_flags "${appended}") | ||
endforeach() | ||
foreach(tmp IN LISTS GLOBAL_CPP_FLAGS) | ||
string(CONCAT appended "\"" ${tmp} "\", ") | ||
string(APPEND chip_cpp_flags "${appended}") | ||
endforeach() | ||
string(APPEND chip_cpp_flags "${chip_c_flags}") | ||
|
||
set(import_str "import(\"//args.gni\")\n" ) | ||
|
||
string(APPEND CHIP_GN_ARGS "${import_str}") | ||
string(APPEND CHIP_GN_ARGS "target_cflags_c = [${chip_c_flags}]\n") | ||
string(APPEND CHIP_GN_ARGS "target_cflags_cc = [${chip_cpp_flags}]\n") | ||
string(APPEND CHIP_GN_ARGS "ameba_ar = \"arm-none-eabi-ar\"\n") | ||
string(APPEND CHIP_GN_ARGS "ameba_cc = \"arm-none-eabi-gcc\"\n") | ||
string(APPEND CHIP_GN_ARGS "ameba_cxx = \"arm-none-eabi-c++\"\n") | ||
string(APPEND CHIP_GN_ARGS "ameba_cpu = \"ameba\"\n") | ||
string(APPEND CHIP_GN_ARGS "chip_build_tests = false\n") | ||
|
||
file(GENERATE OUTPUT ${CHIP_OUTPUT}/args.gn CONTENT ${CHIP_GN_ARGS}) | ||
|
||
ExternalProject_Add( | ||
chip-gn | ||
PREFIX ${CMAKE_CURRENT_BINARY_DIR} | ||
SOURCE_DIR ${CHIP_ROOT} | ||
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR} | ||
CONFIGURE_COMMAND gn --root=${CHIP_ROOT}/config/ameba gen --check --fail-on-unused-args ${CHIP_OUTPUT} | ||
BUILD_COMMAND ninja -C ${CHIP_OUTPUT} | ||
INSTALL_COMMAND "" | ||
BUILD_BYPRODUCTS -lCHIP | ||
CONFIGURE_ALWAYS TRUE | ||
BUILD_ALWAYS TRUE | ||
USES_TERMINAL_CONFIGURE TRUE | ||
USES_TERMINAL_BUILD 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,22 @@ | ||
# 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. | ||
|
||
# Options from standalone-chip.mk that differ from configure defaults. These | ||
# options are used from examples/. | ||
|
||
import("//build_overrides/chip.gni") | ||
|
||
# Ameba has its own mbedtls, so nothing to do, just provide a target | ||
group("mbedtls") { | ||
} |
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 @@ | ||
../../.. |
Oops, something went wrong.