-
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.
make platform zephyr stand alone (#19504)
- Loading branch information
1 parent
7690b96
commit 3ffd066
Showing
36 changed files
with
1,828 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# 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. | ||
|
||
# place holder |
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,10 @@ | ||
# Zephyr build and configuration files | ||
|
||
This directory contains build scripts and common configuration files used by | ||
CHIP Zephyr applications. It is structured as follows: | ||
|
||
| File/Folder | Contents | | ||
| ----------- | ----------------------------------------------------------------------------------------------------------------------------------- | | ||
| chip-gn | GN project used to build selected CHIP libraries with the _Zephyr_ platform integration layer | | ||
| chip-module | CMake wrapper for the GN project defined in `chip-gn` directory, and other components that allow one to use CHIP as a Zephyr module | | ||
| app | Common and optional Kconfig configuration files that can be used in Zephyr applications | |
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,25 @@ | ||
# | ||
# Copyright (c) 2022 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. | ||
# | ||
|
||
# Copy the merged.hex file if it exists, otherwise copy zephyr.hex | ||
|
||
set(HEX_NAME merged.hex) | ||
|
||
if(EXISTS "zephyr/${HEX_NAME}") | ||
configure_file("zephyr/${HEX_NAME}" "${FLASHBUNDLE_FIRMWARE}" COPYONLY) | ||
else() | ||
configure_file("zephyr/${KERNEL_HEX_NAME}" "${FLASHBUNDLE_FIRMWARE}" COPYONLY) | ||
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,6 @@ | ||
add_library(gnu17 INTERFACE) | ||
target_compile_options(gnu17 | ||
INTERFACE | ||
$<$<COMPILE_LANGUAGE:CXX>:-std=gnu++17> | ||
-D_SYS__PTHREADTYPES_H_) | ||
target_link_libraries(app PRIVATE gnu17) |
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,55 @@ | ||
# | ||
# 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. | ||
# | ||
|
||
# Adds rules to generate a flashing wrapper script for an nrfconnect firmware. | ||
|
||
set(FLASHBUNDLE_FLASHER_COMMON ${CMAKE_PROJECT_NAME}/firmware_utils.py) | ||
set(FLASHBUNDLE_FLASHER_PLATFORM ${CMAKE_PROJECT_NAME}/nrfconnect_firmware_utils.py) | ||
set(FLASHBUNDLE_FLASHER_WRAPPER ${CMAKE_PROJECT_NAME}/${CMAKE_PROJECT_NAME}.flash.py) | ||
set(FLASHBUNDLE_FIRMWARE ${CMAKE_PROJECT_NAME}/${CMAKE_PROJECT_NAME}.hex) | ||
set(FLASHBUNDLE_FILES ${FLASHBUNDLE_FLASHER_COMMON} ${FLASHBUNDLE_FLASHER_PLATFORM} ${FLASHBUNDLE_FLASHER_WRAPPER} ${FLASHBUNDLE_FIRMWARE}) | ||
|
||
get_filename_component(FLASHBUNDLE_FIRMWARE_BASENAME ${FLASHBUNDLE_FIRMWARE} NAME) | ||
|
||
list(JOIN FLASHBUNDLE_FILES "\n" FLASHBUNDLE_MANIFEST) | ||
|
||
file(GENERATE | ||
OUTPUT ${CMAKE_PROJECT_NAME}.flashbundle.txt | ||
CONTENT "${FLASHBUNDLE_MANIFEST}\n" | ||
) | ||
|
||
add_custom_command(OUTPUT "${FLASHBUNDLE_FLASHER_COMMON}" | ||
COMMAND ${CMAKE_COMMAND} ARGS -E copy "${PROJECT_SOURCE_DIR}/third_party/connectedhomeip/scripts/flashing/firmware_utils.py" "${FLASHBUNDLE_FLASHER_COMMON}" | ||
VERBATIM) | ||
|
||
add_custom_command(OUTPUT "${FLASHBUNDLE_FLASHER_PLATFORM}" | ||
COMMAND ${CMAKE_COMMAND} ARGS -E copy "${PROJECT_SOURCE_DIR}/third_party/connectedhomeip/scripts/flashing/nrfconnect_firmware_utils.py" "${FLASHBUNDLE_FLASHER_PLATFORM}" | ||
VERBATIM) | ||
|
||
add_custom_command(OUTPUT "${FLASHBUNDLE_FIRMWARE}" | ||
DEPENDS zephyr/${KERNEL_HEX_NAME} | ||
COMMAND ${CMAKE_COMMAND} ARGS -DFLASHBUNDLE_FIRMWARE=${FLASHBUNDLE_FIRMWARE} -DKERNEL_HEX_NAME=${KERNEL_HEX_NAME} -P "${CHIP_ROOT}/config/nrfconnect/app/copy-flashbundle-firmware.cmake" | ||
VERBATIM) | ||
|
||
add_custom_command(OUTPUT "${CMAKE_PROJECT_NAME}/${CMAKE_PROJECT_NAME}.flash.py" | ||
COMMAND ${python} | ||
"${PROJECT_SOURCE_DIR}/third_party/connectedhomeip/scripts/flashing/gen_flashing_script.py" nrfconnect | ||
--output "${FLASHBUNDLE_FLASHER_WRAPPER}" | ||
--application "${FLASHBUNDLE_FIRMWARE_BASENAME}" | ||
COMMENT "To flash ${FLASHBUNDLE_FIRMWARE_BASENAME} run ${FLASHBUNDLE_FLASHER_WRAPPER}" | ||
VERBATIM) | ||
|
||
add_custom_target(flashing_script DEPENDS ${FLASHBUNDLE_FILES}) |
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. | ||
# | ||
|
||
CONFIG_GPIO=y | ||
|
||
CONFIG_USB=y | ||
CONFIG_USB_DEVICE_STACK=y | ||
CONFIG_USB_UART_CONSOLE=y | ||
|
||
CONFIG_UART_INTERRUPT_DRIVEN=y | ||
CONFIG_UART_LINE_CTRL=y |
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,29 @@ | ||
# 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") | ||
|
||
# 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 = "" | ||
target_os = "zephyr" | ||
|
||
import("${chip_root}/config/zephyr/chip-gn/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,40 @@ | ||
# 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("${chip_root}/build/chip/tests.gni") | ||
|
||
assert(current_os == "zephyr") | ||
|
||
declare_args() { | ||
chip_build_example_providers = false | ||
} | ||
|
||
group("zephyr") { | ||
deps = [ "${chip_root}/src/lib" ] | ||
|
||
if (chip_build_tests) { | ||
deps += [ "${chip_root}/src:tests" ] | ||
} | ||
|
||
if (chip_build_example_providers) { | ||
deps += [ "${chip_root}/examples/providers:device_info_provider" ] | ||
} | ||
} | ||
|
||
group("default") { | ||
deps = [ ":zephyr" ] | ||
} |
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,27 @@ | ||
# 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") | ||
|
||
chip_device_platform = "zephyr" | ||
|
||
chip_build_tests = false | ||
|
||
chip_project_config_include = "" | ||
chip_system_project_config_include = "" | ||
chip_ble_project_config_include = "" | ||
|
||
custom_toolchain = "${chip_root}/config/zephyr/chip-gn/toolchain:zephyr" | ||
|
||
pw_build_PIP_CONSTRAINTS = [ "${chip_root}/scripts/constraints.txt" ] |
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,33 @@ | ||
# 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/toolchain/gcc_toolchain.gni") | ||
import("//build_overrides/build.gni") | ||
|
||
declare_args() { | ||
zephyr_ar = "" | ||
zephyr_cc = "" | ||
zephyr_cxx = "" | ||
} | ||
|
||
gcc_toolchain("zephyr") { | ||
ar = zephyr_ar | ||
cc = zephyr_cc | ||
cxx = zephyr_cxx | ||
|
||
toolchain_args = { | ||
current_os = "zephyr" | ||
is_clang = false | ||
} | ||
} |
Oops, something went wrong.