From 1b36337f0403abc6b7c09a6fdc630dc19c5d8c27 Mon Sep 17 00:00:00 2001 From: ATmobica Date: Wed, 27 Oct 2021 16:29:23 +0000 Subject: [PATCH 01/12] Add Mbed python builder Add Mbed targets to python builder --- scripts/build/build/targets.py | 22 ++++++ scripts/build/builders/mbed.py | 138 +++++++++++++++++++++++++++++++++ 2 files changed, 160 insertions(+) create mode 100644 scripts/build/builders/mbed.py diff --git a/scripts/build/build/targets.py b/scripts/build/build/targets.py index ba7927b2deb9a4..862a0398295033 100644 --- a/scripts/build/build/targets.py +++ b/scripts/build/build/targets.py @@ -24,6 +24,7 @@ from builders.telink import TelinkApp, TelinkBoard, TelinkBuilder from builders.tizen import TizenApp, TizenBoard, TizenBuilder from builders.ameba import AmebaApp, AmebaBoard, AmebaBuilder +from builders.mbed import MbedApp, MbedBoard, MbedProfile, MbedBuilder class Target: @@ -190,6 +191,26 @@ def AndroidTargets(): yield target.Extend('androidstudio-x86-chip-tool', board=AndroidBoard.AndroidStudio_X86, app=AndroidApp.CHIP_TOOL) yield target.Extend('androidstudio-x64-chip-tool', board=AndroidBoard.AndroidStudio_X64, app=AndroidApp.CHIP_TOOL) +def MbedTargets(): + target = Target('mbed', MbedBuilder) + + targets = [ + target.Extend('CY8CPROTO_062_4343W', board=MbedBoard.CY8CPROTO_062_4343W), + ] + + app_targets = [] + for target in targets: + app_targets.append(target.Extend('lock', app=MbedApp.LOCK)) + app_targets.append(target.Extend('light', app=MbedApp.LIGHT)) + app_targets.append(target.Extend('all-clusters', app=MbedApp.ALL_CLUSTERS)) + app_targets.append(target.Extend('pigweed', app=MbedApp.PIGWEED)) + app_targets.append(target.Extend('shell', app=MbedApp.SHELL)) + + for target in app_targets: + yield target.Extend('release', profile=MbedProfile.RELEASE) + yield target.Extend('develop', profile=MbedProfile.DEVELOP) + yield target.Extend('debug', profile=MbedProfile.DEBUG) + ALL = [] @@ -199,6 +220,7 @@ def AndroidTargets(): Efr32Targets(), NrfTargets(), AndroidTargets(), + MbedTargets() ] for generator in target_generators: diff --git a/scripts/build/builders/mbed.py b/scripts/build/builders/mbed.py new file mode 100644 index 00000000000000..3a07e517fc1f74 --- /dev/null +++ b/scripts/build/builders/mbed.py @@ -0,0 +1,138 @@ +# 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 logging +import os +import shlex +import pathlib + +from enum import Enum, auto +from .builder import Builder + +from mbed_tools.project import MbedProgram +from mbed_tools.build import generate_config, build_project + +class MbedApp(Enum): + LOCK = auto() + LIGHT = auto() + ALL_CLUSTERS = auto() + PIGWEED = auto() + SHELL = auto() + + @property + def ExampleName(self): + if self == MbedApp.LOCK: + return 'lock-app' + elif self == MbedApp.LIGHT: + return 'lighting-app' + elif self == MbedApp.ALL_CLUSTERS: + return 'all-clusters-app' + elif self == MbedApp.PIGWEED: + return 'pigweed-app' + elif self == MbedApp.SHELL: + return 'shell' + else: + raise Exception('Unknown app type: %r' % self) + + @property + def AppNamePrefix(self): + if self == MbedApp.LOCK: + return 'chip-mbed-lock-app-example' + elif self == MbedApp.LIGHT: + return 'chip-mbed-lighting-app-example' + elif self == MbedApp.ALL_CLUSTERS: + return 'chip-mbed-all-clusters-app-example' + elif self == MbedApp.PIGWEED: + return 'chip-mbed-pigweed-app-example' + elif self == MbedApp.SHELL: + return 'shell' + else: + raise Exception('Unknown app type: %r' % self) + + +class MbedBoard(Enum): + CY8CPROTO_062_4343W = auto() + + @property + def BoardName(self): + if self == MbedBoard.CY8CPROTO_062_4343W: + return 'CY8CPROTO_062_4343W' + else: + raise Exception('Unknown board type: %r' % self) + + +class MbedProfile(Enum): + RELEASE = auto() + DEVELOP = auto() + DEBUG = auto() + + @property + def ProfileName(self): + if self == MbedProfile.RELEASE: + return 'release' + elif self == MbedProfile.DEVELOP: + return 'develop' + elif self == MbedProfile.DEBUG: + return 'debug' + else: + raise Exception('Unknown board type: %r' % self) + + +class MbedBuilder(Builder): + def __init__(self, + root, + runner, + app: MbedApp = MbedApp.LOCK, + board: MbedBoard = MbedBoard.CY8CPROTO_062_4343W, + profile: MbedProfile = MbedProfile.RELEASE): + super(MbedBuilder, self).__init__(root, runner) + self.app = app + self.board = board + self.profile = profile + self.toolchain = "GCC_ARM" + self.mbed_os_path = os.path.join(os.environ['PW_PROJECT_ROOT'], 'third_party', 'mbed-os', 'repo') + self.mbed_os_posix_socket_path = os.path.join(os.environ['PW_PROJECT_ROOT'], 'third_party', 'mbed-os-posix-socket', 'repo') + + cmake_build_subdir = pathlib.Path(self.board.BoardName.upper(), self.profile.ProfileName.lower(), self.toolchain.upper()) + self.program = MbedProgram.from_existing(pathlib.Path(self.ExamplePath), cmake_build_subdir, pathlib.Path(self.mbed_os_path)) + + + @property + def ExamplePath(self): + return os.path.join('examples', self.app.ExampleName, 'mbed') + + def generate(self): + if not os.path.exists(self.output_dir): + self.program.files.cmake_build_dir = pathlib.Path(self.output_dir) + _, output_path = generate_config(self.board.BoardName.upper(), self.toolchain, self.program) + logging.info(f"mbed_config.cmake has been generated and written to '{str(output_path.resolve())}'") + + self._Execute(['cmake', '-S', shlex.quote(self.ExamplePath), '-B', shlex.quote(self.output_dir), '-GNinja', + '-DCMAKE_BUILD_TYPE={}'.format(self.profile.ProfileName.lower()), + '-DMBED_OS_PATH={}'.format(shlex.quote(self.mbed_os_path)), + '-DMBED_OS_POSIX_SOCKET_PATH={}'.format(shlex.quote(self.mbed_os_posix_socket_path)), + ], title='Generating ' + self.identifier) + + + def _build(self): + logging.info('Compiling Mbed at %s', self.output_dir) + build_project(pathlib.Path(self.output_dir)) + + def build_outputs(self): + return { + self.app.AppNamePrefix + '.elf': + os.path.join(self.output_dir, self.app.AppNamePrefix + '.elf'), + self.app.AppNamePrefix + '.map': + os.path.join(self.output_dir, self.app.AppNamePrefix + '.map'), + } From eb2bc2b318246d37559a8606cf0005b362cb2eb4 Mon Sep 17 00:00:00 2001 From: ATmobica Date: Thu, 28 Oct 2021 13:53:22 +0000 Subject: [PATCH 02/12] Improve mbed_example.sh script - Python builder compatibility Improve examples cmake file and gitignore --- examples/all-clusters-app/mbed/.gitignore | 1 - examples/all-clusters-app/mbed/CMakeLists.txt | 4 ++-- examples/lighting-app/mbed/.gitignore | 1 - examples/lighting-app/mbed/CMakeLists.txt | 4 ++-- examples/lock-app/mbed/.gitignore | 1 - examples/lock-app/mbed/CMakeLists.txt | 4 ++-- examples/pigweed-app/mbed/.gitignore | 1 - examples/pigweed-app/mbed/CMakeLists.txt | 4 ++-- examples/shell/mbed/.gitignore | 1 - examples/shell/mbed/CMakeLists.txt | 4 ++-- scripts/examples/mbed_example.sh | 15 ++++----------- src/test_driver/mbed/.gitignore | 1 - src/test_driver/mbed/CMakeLists.txt | 4 ++-- 13 files changed, 16 insertions(+), 29 deletions(-) diff --git a/examples/all-clusters-app/mbed/.gitignore b/examples/all-clusters-app/mbed/.gitignore index 58f6e14fd6f5b2..414487d53eb835 100644 --- a/examples/all-clusters-app/mbed/.gitignore +++ b/examples/all-clusters-app/mbed/.gitignore @@ -1,2 +1 @@ -config/ build-*/ diff --git a/examples/all-clusters-app/mbed/CMakeLists.txt b/examples/all-clusters-app/mbed/CMakeLists.txt index 9f27e485a132e5..12cdd6bf6e6615 100644 --- a/examples/all-clusters-app/mbed/CMakeLists.txt +++ b/examples/all-clusters-app/mbed/CMakeLists.txt @@ -16,7 +16,7 @@ configure_file( @ONLY ) -set(MBED_PATH $ENV{MBED_OS_PATH} CACHE INTERNAL "") +set(MBED_PATH ${MBED_OS_PATH} CACHE INTERNAL "") set(MBED_CONFIG_PATH ${CMAKE_CURRENT_BINARY_DIR} CACHE INTERNAL "") set(APP_TARGET chip-mbed-all-clusters-app-example) @@ -25,7 +25,7 @@ include(${MBED_PATH}/tools/cmake/app.cmake) project(${APP_TARGET}) add_subdirectory(${MBED_PATH} ./mbed_build) -add_subdirectory($ENV{MBED_OS_POSIX_SOCKET_PATH} ./mbed_os_posix_socket_build) +add_subdirectory(${MBED_OS_POSIX_SOCKET_PATH} ./mbed_os_posix_socket_build) add_executable(${APP_TARGET}) diff --git a/examples/lighting-app/mbed/.gitignore b/examples/lighting-app/mbed/.gitignore index 58f6e14fd6f5b2..414487d53eb835 100644 --- a/examples/lighting-app/mbed/.gitignore +++ b/examples/lighting-app/mbed/.gitignore @@ -1,2 +1 @@ -config/ build-*/ diff --git a/examples/lighting-app/mbed/CMakeLists.txt b/examples/lighting-app/mbed/CMakeLists.txt index 102159a11f4ccc..c638320b71ea4c 100644 --- a/examples/lighting-app/mbed/CMakeLists.txt +++ b/examples/lighting-app/mbed/CMakeLists.txt @@ -14,7 +14,7 @@ configure_file( @ONLY ) -set(MBED_PATH $ENV{MBED_OS_PATH} CACHE INTERNAL "") +set(MBED_PATH ${MBED_OS_PATH} CACHE INTERNAL "") set(MBED_CONFIG_PATH ${CMAKE_CURRENT_BINARY_DIR} CACHE INTERNAL "") set(APP_TARGET chip-mbed-lighting-app-example) @@ -23,7 +23,7 @@ include(${MBED_PATH}/tools/cmake/app.cmake) project(${APP_TARGET}) add_subdirectory(${MBED_PATH} ./mbed_build) -add_subdirectory($ENV{MBED_OS_POSIX_SOCKET_PATH} ./mbed_os_posix_socket_build) +add_subdirectory(${MBED_OS_POSIX_SOCKET_PATH} ./mbed_os_posix_socket_build) add_executable(${APP_TARGET}) diff --git a/examples/lock-app/mbed/.gitignore b/examples/lock-app/mbed/.gitignore index 58f6e14fd6f5b2..414487d53eb835 100644 --- a/examples/lock-app/mbed/.gitignore +++ b/examples/lock-app/mbed/.gitignore @@ -1,2 +1 @@ -config/ build-*/ diff --git a/examples/lock-app/mbed/CMakeLists.txt b/examples/lock-app/mbed/CMakeLists.txt index b3bb2b1381cdb4..d6ca61db3ac0d2 100644 --- a/examples/lock-app/mbed/CMakeLists.txt +++ b/examples/lock-app/mbed/CMakeLists.txt @@ -14,7 +14,7 @@ configure_file( @ONLY ) -set(MBED_PATH $ENV{MBED_OS_PATH} CACHE INTERNAL "") +set(MBED_PATH ${MBED_OS_PATH} CACHE INTERNAL "") set(MBED_CONFIG_PATH ${CMAKE_CURRENT_BINARY_DIR} CACHE INTERNAL "") set(APP_TARGET chip-mbed-lock-app-example) @@ -23,7 +23,7 @@ include(${MBED_PATH}/tools/cmake/app.cmake) project(${APP_TARGET}) add_subdirectory(${MBED_PATH} ./mbed_build) -add_subdirectory($ENV{MBED_OS_POSIX_SOCKET_PATH} ./mbed_os_posix_socket_build) +add_subdirectory(${MBED_OS_POSIX_SOCKET_PATH} ./mbed_os_posix_socket_build) add_executable(${APP_TARGET}) diff --git a/examples/pigweed-app/mbed/.gitignore b/examples/pigweed-app/mbed/.gitignore index 58f6e14fd6f5b2..414487d53eb835 100644 --- a/examples/pigweed-app/mbed/.gitignore +++ b/examples/pigweed-app/mbed/.gitignore @@ -1,2 +1 @@ -config/ build-*/ diff --git a/examples/pigweed-app/mbed/CMakeLists.txt b/examples/pigweed-app/mbed/CMakeLists.txt index 7f53397dfdedb8..140c8a64b61aa8 100644 --- a/examples/pigweed-app/mbed/CMakeLists.txt +++ b/examples/pigweed-app/mbed/CMakeLists.txt @@ -13,7 +13,7 @@ configure_file( @ONLY ) -set(MBED_PATH $ENV{MBED_OS_PATH} CACHE INTERNAL "") +set(MBED_PATH ${MBED_OS_PATH} CACHE INTERNAL "") set(MBED_CONFIG_PATH ${CMAKE_CURRENT_BINARY_DIR} CACHE INTERNAL "") set(APP_TARGET chip-mbed-pigweed-app-example) @@ -22,7 +22,7 @@ include(${MBED_PATH}/tools/cmake/app.cmake) project(${APP_TARGET}) add_subdirectory(${MBED_PATH} ./mbed_build) -add_subdirectory($ENV{MBED_OS_POSIX_SOCKET_PATH} ./mbed_os_posix_socket_build) +add_subdirectory(${MBED_OS_POSIX_SOCKET_PATH} ./mbed_os_posix_socket_build) add_executable(${APP_TARGET}) diff --git a/examples/shell/mbed/.gitignore b/examples/shell/mbed/.gitignore index 58f6e14fd6f5b2..414487d53eb835 100644 --- a/examples/shell/mbed/.gitignore +++ b/examples/shell/mbed/.gitignore @@ -1,2 +1 @@ -config/ build-*/ diff --git a/examples/shell/mbed/CMakeLists.txt b/examples/shell/mbed/CMakeLists.txt index 17ec6390124cd6..18397ba9b8d689 100644 --- a/examples/shell/mbed/CMakeLists.txt +++ b/examples/shell/mbed/CMakeLists.txt @@ -13,7 +13,7 @@ configure_file( @ONLY ) -set(MBED_PATH $ENV{MBED_OS_PATH} CACHE INTERNAL "") +set(MBED_PATH ${MBED_OS_PATH} CACHE INTERNAL "") set(MBED_CONFIG_PATH ${CMAKE_CURRENT_BINARY_DIR} CACHE INTERNAL "") set(APP_TARGET chip-mbed-shell-example) @@ -22,7 +22,7 @@ include(${MBED_PATH}/tools/cmake/app.cmake) project(${APP_TARGET}) add_subdirectory(${MBED_PATH} ./mbed_build) -add_subdirectory($ENV{MBED_OS_POSIX_SOCKET_PATH} ./mbed_os_posix_socket_build) +add_subdirectory(${MBED_OS_POSIX_SOCKET_PATH} ./mbed_os_posix_socket_build) add_executable(${APP_TARGET}) diff --git a/scripts/examples/mbed_example.sh b/scripts/examples/mbed_example.sh index ba66762b6b8f5c..9c26b5b3804e1b 100755 --- a/scripts/examples/mbed_example.sh +++ b/scripts/examples/mbed_example.sh @@ -96,27 +96,20 @@ BUILD_DIRECTORY="$APP"/mbed/build-"$TARGET_BOARD"/"$PROFILE"/ if [[ "$COMMAND" == *"build"* ]]; then echo "Build $APP app for $TARGET_BOARD target with $TOOLCHAIN toolchain and $PROFILE profile" - # Config directory setup - MBED_CONFIG_PATH="$APP"/mbed/config/"$TARGET_BOARD"/"$PROFILE"/"$TOOLCHAIN"/ - # Set Mbed OS path - export MBED_OS_PATH="$CHIP_ROOT"/third_party/mbed-os/repo + MBED_OS_PATH="$CHIP_ROOT"/third_party/mbed-os/repo # Set Mbed OS posix socket submodule path - export MBED_OS_POSIX_SOCKET_PATH="$CHIP_ROOT"/third_party/mbed-os-posix-socket/repo + MBED_OS_POSIX_SOCKET_PATH="$CHIP_ROOT"/third_party/mbed-os-posix-socket/repo # Generate config file for selected target, toolchain and hardware - mbed-tools configure -t "$TOOLCHAIN" -m "$TARGET_BOARD" -p "$APP"/mbed/ -o "$MBED_CONFIG_PATH" --mbed-os-path "$MBED_OS_PATH" + mbed-tools configure -t "$TOOLCHAIN" -m "$TARGET_BOARD" -p "$APP"/mbed/ -o "$BUILD_DIRECTORY" --mbed-os-path "$MBED_OS_PATH" # Remove old artifacts to force linking rm -rf "$BUILD_DIRECTORY/chip-"* - # Create output directory and copy config file there. - mkdir -p "$BUILD_DIRECTORY" - cp -f "$MBED_CONFIG_PATH"/mbed_config.cmake "$BUILD_DIRECTORY"/mbed_config.cmake - # Build application - cmake -S "$APP/mbed" -B "$BUILD_DIRECTORY" -GNinja -DCMAKE_BUILD_TYPE="$PROFILE" + cmake -S "$APP/mbed" -B "$BUILD_DIRECTORY" -GNinja -DCMAKE_BUILD_TYPE="$PROFILE" -DMBED_OS_PATH="$MBED_OS_PATH" -DMBED_OS_POSIX_SOCKET_PATH="$MBED_OS_POSIX_SOCKET_PATH" cmake --build "$BUILD_DIRECTORY" fi diff --git a/src/test_driver/mbed/.gitignore b/src/test_driver/mbed/.gitignore index 58f6e14fd6f5b2..414487d53eb835 100644 --- a/src/test_driver/mbed/.gitignore +++ b/src/test_driver/mbed/.gitignore @@ -1,2 +1 @@ -config/ build-*/ diff --git a/src/test_driver/mbed/CMakeLists.txt b/src/test_driver/mbed/CMakeLists.txt index b8600888e5a96a..f4b921528f6317 100644 --- a/src/test_driver/mbed/CMakeLists.txt +++ b/src/test_driver/mbed/CMakeLists.txt @@ -11,7 +11,7 @@ configure_file( @ONLY ) -set(MBED_PATH $ENV{MBED_OS_PATH} CACHE INTERNAL "") +set(MBED_PATH ${MBED_OS_PATH} CACHE INTERNAL "") set(MBED_CONFIG_PATH ${CMAKE_CURRENT_BINARY_DIR} CACHE INTERNAL "") set(APP_TARGET chip-mbed-unit-tests) @@ -20,7 +20,7 @@ include(${MBED_PATH}/tools/cmake/app.cmake) project(${APP_TARGET}) add_subdirectory(${MBED_PATH} ./mbed_build) -add_subdirectory($ENV{MBED_OS_POSIX_SOCKET_PATH} ./mbed_os_posix_socket_build) +add_subdirectory(${MBED_OS_POSIX_SOCKET_PATH} ./mbed_os_posix_socket_build) add_executable(${APP_TARGET}) From ed7efecbdfed844fa4cbeef668da2132f8dcb326 Mon Sep 17 00:00:00 2001 From: ATmobica Date: Thu, 28 Oct 2021 13:55:18 +0000 Subject: [PATCH 03/12] Improve build and outputs definition in Python builder --- scripts/build/builders/mbed.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/scripts/build/builders/mbed.py b/scripts/build/builders/mbed.py index 3a07e517fc1f74..9848c1bc1ef3fb 100644 --- a/scripts/build/builders/mbed.py +++ b/scripts/build/builders/mbed.py @@ -14,6 +14,7 @@ import logging import os +import glob import shlex import pathlib @@ -107,7 +108,6 @@ def __init__(self, cmake_build_subdir = pathlib.Path(self.board.BoardName.upper(), self.profile.ProfileName.lower(), self.toolchain.upper()) self.program = MbedProgram.from_existing(pathlib.Path(self.ExamplePath), cmake_build_subdir, pathlib.Path(self.mbed_os_path)) - @property def ExamplePath(self): return os.path.join('examples', self.app.ExampleName, 'mbed') @@ -124,15 +124,20 @@ def generate(self): '-DMBED_OS_POSIX_SOCKET_PATH={}'.format(shlex.quote(self.mbed_os_posix_socket_path)), ], title='Generating ' + self.identifier) - def _build(self): - logging.info('Compiling Mbed at %s', self.output_dir) + logging.info('Building ' + self.identifier) + # Remove old artifacts to force linking + if pathlib.Path(self.output_dir, self.app.AppNamePrefix + '.elf').is_file(): + for filename in glob.glob(os.path.join(self.output_dir, self.app.AppNamePrefix + '*')): + os.remove(filename) build_project(pathlib.Path(self.output_dir)) def build_outputs(self): return { self.app.AppNamePrefix + '.elf': os.path.join(self.output_dir, self.app.AppNamePrefix + '.elf'), + self.app.AppNamePrefix + '.hex': + os.path.join(self.output_dir, self.app.AppNamePrefix + '.hex'), self.app.AppNamePrefix + '.map': - os.path.join(self.output_dir, self.app.AppNamePrefix + '.map'), + os.path.join(self.output_dir, self.app.AppNamePrefix + '.elf.map'), } From 299d6da31142177c81c40f20a215b132d5354714 Mon Sep 17 00:00:00 2001 From: ATmobica Date: Thu, 28 Oct 2021 15:38:51 +0000 Subject: [PATCH 04/12] Update all_targets_except_host.txt --- .../build/testdata/all_targets_except_host.txt | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/scripts/build/testdata/all_targets_except_host.txt b/scripts/build/testdata/all_targets_except_host.txt index 8dc6550999a821..55ca19dfabe1a3 100644 --- a/scripts/build/testdata/all_targets_except_host.txt +++ b/scripts/build/testdata/all_targets_except_host.txt @@ -24,6 +24,21 @@ esp32-m5stack-all-clusters-ipv6only esp32-m5stack-all-clusters-rpc esp32-m5stack-all-clusters-rpc-ipv6only infineon-p6-lock +mbed-CY8CPROTO_062_4343W-all-clusters-debug +mbed-CY8CPROTO_062_4343W-all-clusters-develop +mbed-CY8CPROTO_062_4343W-all-clusters-release +mbed-CY8CPROTO_062_4343W-light-debug +mbed-CY8CPROTO_062_4343W-light-develop +mbed-CY8CPROTO_062_4343W-light-release +mbed-CY8CPROTO_062_4343W-lock-debug +mbed-CY8CPROTO_062_4343W-lock-develop +mbed-CY8CPROTO_062_4343W-lock-release +mbed-CY8CPROTO_062_4343W-pigweed-debug +mbed-CY8CPROTO_062_4343W-pigweed-develop +mbed-CY8CPROTO_062_4343W-pigweed-release +mbed-CY8CPROTO_062_4343W-shell-debug +mbed-CY8CPROTO_062_4343W-shell-develop +mbed-CY8CPROTO_062_4343W-shell-release nrf-nrf52840-light nrf-nrf52840-light-rpc nrf-nrf52840-lock From edd4fb10b7bb065c4d224361dd3a0bebca3ae059 Mon Sep 17 00:00:00 2001 From: ATmobica Date: Fri, 29 Oct 2021 09:52:32 +0000 Subject: [PATCH 05/12] Update testdata Fix mbed builder for testing --- scripts/build/builders/mbed.py | 20 ++--- .../build/testdata/build_all_except_host.txt | 90 +++++++++++++++++++ 2 files changed, 100 insertions(+), 10 deletions(-) diff --git a/scripts/build/builders/mbed.py b/scripts/build/builders/mbed.py index 9848c1bc1ef3fb..5c7b22cb7708f6 100644 --- a/scripts/build/builders/mbed.py +++ b/scripts/build/builders/mbed.py @@ -22,7 +22,7 @@ from .builder import Builder from mbed_tools.project import MbedProgram -from mbed_tools.build import generate_config, build_project +from mbed_tools.build import generate_config class MbedApp(Enum): LOCK = auto() @@ -102,11 +102,8 @@ def __init__(self, self.board = board self.profile = profile self.toolchain = "GCC_ARM" - self.mbed_os_path = os.path.join(os.environ['PW_PROJECT_ROOT'], 'third_party', 'mbed-os', 'repo') - self.mbed_os_posix_socket_path = os.path.join(os.environ['PW_PROJECT_ROOT'], 'third_party', 'mbed-os-posix-socket', 'repo') - - cmake_build_subdir = pathlib.Path(self.board.BoardName.upper(), self.profile.ProfileName.lower(), self.toolchain.upper()) - self.program = MbedProgram.from_existing(pathlib.Path(self.ExamplePath), cmake_build_subdir, pathlib.Path(self.mbed_os_path)) + self.mbed_os_path = os.path.join(self.root, 'third_party', 'mbed-os', 'repo') + self.mbed_os_posix_socket_path = os.path.join(self.root, 'third_party', 'mbed-os-posix-socket', 'repo') @property def ExamplePath(self): @@ -114,9 +111,12 @@ def ExamplePath(self): def generate(self): if not os.path.exists(self.output_dir): - self.program.files.cmake_build_dir = pathlib.Path(self.output_dir) - _, output_path = generate_config(self.board.BoardName.upper(), self.toolchain, self.program) - logging.info(f"mbed_config.cmake has been generated and written to '{str(output_path.resolve())}'") + if not self._runner.dry_run: + cmake_build_subdir = pathlib.Path(self.board.BoardName.upper(), self.profile.ProfileName.lower(), self.toolchain.upper()) + program = MbedProgram.from_existing(pathlib.Path(self.ExamplePath), cmake_build_subdir, pathlib.Path(self.mbed_os_path)) + program.files.cmake_build_dir = pathlib.Path(self.output_dir) + _, output_path = generate_config(self.board.BoardName.upper(), self.toolchain, program) + logging.info(f"mbed_config.cmake has been generated and written to '{str(output_path.resolve())}'") self._Execute(['cmake', '-S', shlex.quote(self.ExamplePath), '-B', shlex.quote(self.output_dir), '-GNinja', '-DCMAKE_BUILD_TYPE={}'.format(self.profile.ProfileName.lower()), @@ -130,7 +130,7 @@ def _build(self): if pathlib.Path(self.output_dir, self.app.AppNamePrefix + '.elf').is_file(): for filename in glob.glob(os.path.join(self.output_dir, self.app.AppNamePrefix + '*')): os.remove(filename) - build_project(pathlib.Path(self.output_dir)) + self._Execute(['cmake', '--build', shlex.quote(self.output_dir)], title='Building ' + self.identifier) def build_outputs(self): return { diff --git a/scripts/build/testdata/build_all_except_host.txt b/scripts/build/testdata/build_all_except_host.txt index 3cb809d040e0c3..e3084e270c4a53 100644 --- a/scripts/build/testdata/build_all_except_host.txt +++ b/scripts/build/testdata/build_all_except_host.txt @@ -254,6 +254,51 @@ idf.py -C examples/all-clusters-app/esp32 -B {out}/esp32-m5stack-all-clusters-rp # Generating infineon-p6-lock gn gen --check --fail-on-unused-args --root={root}/examples/lock-app/p6 '--args=p6_board="CY8CKIT-062S2-43012"' {out}/infineon-p6-lock +# Generating mbed-CY8CPROTO_062_4343W-all-clusters-debug +cmake -S examples/all-clusters-app/mbed -B {out}/mbed-CY8CPROTO_062_4343W-all-clusters-debug -GNinja -DCMAKE_BUILD_TYPE=debug -DMBED_OS_PATH={root}/third_party/mbed-os/repo -DMBED_OS_POSIX_SOCKET_PATH={root}/third_party/mbed-os-posix-socket/repo + +# Generating mbed-CY8CPROTO_062_4343W-all-clusters-develop +cmake -S examples/all-clusters-app/mbed -B {out}/mbed-CY8CPROTO_062_4343W-all-clusters-develop -GNinja -DCMAKE_BUILD_TYPE=develop -DMBED_OS_PATH={root}/third_party/mbed-os/repo -DMBED_OS_POSIX_SOCKET_PATH={root}/third_party/mbed-os-posix-socket/repo + +# Generating mbed-CY8CPROTO_062_4343W-all-clusters-release +cmake -S examples/all-clusters-app/mbed -B {out}/mbed-CY8CPROTO_062_4343W-all-clusters-release -GNinja -DCMAKE_BUILD_TYPE=release -DMBED_OS_PATH={root}/third_party/mbed-os/repo -DMBED_OS_POSIX_SOCKET_PATH={root}/third_party/mbed-os-posix-socket/repo + +# Generating mbed-CY8CPROTO_062_4343W-light-debug +cmake -S examples/lighting-app/mbed -B {out}/mbed-CY8CPROTO_062_4343W-light-debug -GNinja -DCMAKE_BUILD_TYPE=debug -DMBED_OS_PATH={root}/third_party/mbed-os/repo -DMBED_OS_POSIX_SOCKET_PATH={root}/third_party/mbed-os-posix-socket/repo + +# Generating mbed-CY8CPROTO_062_4343W-light-develop +cmake -S examples/lighting-app/mbed -B {out}/mbed-CY8CPROTO_062_4343W-light-develop -GNinja -DCMAKE_BUILD_TYPE=develop -DMBED_OS_PATH={root}/third_party/mbed-os/repo -DMBED_OS_POSIX_SOCKET_PATH={root}/third_party/mbed-os-posix-socket/repo + +# Generating mbed-CY8CPROTO_062_4343W-light-release +cmake -S examples/lighting-app/mbed -B {out}/mbed-CY8CPROTO_062_4343W-light-release -GNinja -DCMAKE_BUILD_TYPE=release -DMBED_OS_PATH={root}/third_party/mbed-os/repo -DMBED_OS_POSIX_SOCKET_PATH={root}/third_party/mbed-os-posix-socket/repo + +# Generating mbed-CY8CPROTO_062_4343W-lock-debug +cmake -S examples/lock-app/mbed -B {out}/mbed-CY8CPROTO_062_4343W-lock-debug -GNinja -DCMAKE_BUILD_TYPE=debug -DMBED_OS_PATH={root}/third_party/mbed-os/repo -DMBED_OS_POSIX_SOCKET_PATH={root}/third_party/mbed-os-posix-socket/repo + +# Generating mbed-CY8CPROTO_062_4343W-lock-develop +cmake -S examples/lock-app/mbed -B {out}/mbed-CY8CPROTO_062_4343W-lock-develop -GNinja -DCMAKE_BUILD_TYPE=develop -DMBED_OS_PATH={root}/third_party/mbed-os/repo -DMBED_OS_POSIX_SOCKET_PATH={root}/third_party/mbed-os-posix-socket/repo + +# Generating mbed-CY8CPROTO_062_4343W-lock-release +cmake -S examples/lock-app/mbed -B {out}/mbed-CY8CPROTO_062_4343W-lock-release -GNinja -DCMAKE_BUILD_TYPE=release -DMBED_OS_PATH={root}/third_party/mbed-os/repo -DMBED_OS_POSIX_SOCKET_PATH={root}/third_party/mbed-os-posix-socket/repo + +# Generating mbed-CY8CPROTO_062_4343W-pigweed-debug +cmake -S examples/pigweed-app/mbed -B {out}/mbed-CY8CPROTO_062_4343W-pigweed-debug -GNinja -DCMAKE_BUILD_TYPE=debug -DMBED_OS_PATH={root}/third_party/mbed-os/repo -DMBED_OS_POSIX_SOCKET_PATH={root}/third_party/mbed-os-posix-socket/repo + +# Generating mbed-CY8CPROTO_062_4343W-pigweed-develop +cmake -S examples/pigweed-app/mbed -B {out}/mbed-CY8CPROTO_062_4343W-pigweed-develop -GNinja -DCMAKE_BUILD_TYPE=develop -DMBED_OS_PATH={root}/third_party/mbed-os/repo -DMBED_OS_POSIX_SOCKET_PATH={root}/third_party/mbed-os-posix-socket/repo + +# Generating mbed-CY8CPROTO_062_4343W-pigweed-release +cmake -S examples/pigweed-app/mbed -B {out}/mbed-CY8CPROTO_062_4343W-pigweed-release -GNinja -DCMAKE_BUILD_TYPE=release -DMBED_OS_PATH={root}/third_party/mbed-os/repo -DMBED_OS_POSIX_SOCKET_PATH={root}/third_party/mbed-os-posix-socket/repo + +# Generating mbed-CY8CPROTO_062_4343W-shell-debug +cmake -S examples/shell/mbed -B {out}/mbed-CY8CPROTO_062_4343W-shell-debug -GNinja -DCMAKE_BUILD_TYPE=debug -DMBED_OS_PATH={root}/third_party/mbed-os/repo -DMBED_OS_POSIX_SOCKET_PATH={root}/third_party/mbed-os-posix-socket/repo + +# Generating mbed-CY8CPROTO_062_4343W-shell-develop +cmake -S examples/shell/mbed -B {out}/mbed-CY8CPROTO_062_4343W-shell-develop -GNinja -DCMAKE_BUILD_TYPE=develop -DMBED_OS_PATH={root}/third_party/mbed-os/repo -DMBED_OS_POSIX_SOCKET_PATH={root}/third_party/mbed-os-posix-socket/repo + +# Generating mbed-CY8CPROTO_062_4343W-shell-release +cmake -S examples/shell/mbed -B {out}/mbed-CY8CPROTO_062_4343W-shell-release -GNinja -DCMAKE_BUILD_TYPE=release -DMBED_OS_PATH={root}/third_party/mbed-os/repo -DMBED_OS_POSIX_SOCKET_PATH={root}/third_party/mbed-os-posix-socket/repo + # Generating nrf-nrf52840-light bash -c 'source "$ZEPHYR_BASE/zephyr-env.sh"; export GNUARMEMB_TOOLCHAIN_PATH="$PW_PIGWEED_CIPD_INSTALL_DIR"; @@ -539,6 +584,51 @@ idf.py -C examples/all-clusters-app/esp32 -B {out}/esp32-m5stack-all-clusters-rp # Building infineon-p6-lock ninja -C {out}/infineon-p6-lock +# Building mbed-CY8CPROTO_062_4343W-all-clusters-debug +cmake --build {out}/mbed-CY8CPROTO_062_4343W-all-clusters-debug + +# Building mbed-CY8CPROTO_062_4343W-all-clusters-develop +cmake --build {out}/mbed-CY8CPROTO_062_4343W-all-clusters-develop + +# Building mbed-CY8CPROTO_062_4343W-all-clusters-release +cmake --build {out}/mbed-CY8CPROTO_062_4343W-all-clusters-release + +# Building mbed-CY8CPROTO_062_4343W-light-debug +cmake --build {out}/mbed-CY8CPROTO_062_4343W-light-debug + +# Building mbed-CY8CPROTO_062_4343W-light-develop +cmake --build {out}/mbed-CY8CPROTO_062_4343W-light-develop + +# Building mbed-CY8CPROTO_062_4343W-light-release +cmake --build {out}/mbed-CY8CPROTO_062_4343W-light-release + +# Building mbed-CY8CPROTO_062_4343W-lock-debug +cmake --build {out}/mbed-CY8CPROTO_062_4343W-lock-debug + +# Building mbed-CY8CPROTO_062_4343W-lock-develop +cmake --build {out}/mbed-CY8CPROTO_062_4343W-lock-develop + +# Building mbed-CY8CPROTO_062_4343W-lock-release +cmake --build {out}/mbed-CY8CPROTO_062_4343W-lock-release + +# Building mbed-CY8CPROTO_062_4343W-pigweed-debug +cmake --build {out}/mbed-CY8CPROTO_062_4343W-pigweed-debug + +# Building mbed-CY8CPROTO_062_4343W-pigweed-develop +cmake --build {out}/mbed-CY8CPROTO_062_4343W-pigweed-develop + +# Building mbed-CY8CPROTO_062_4343W-pigweed-release +cmake --build {out}/mbed-CY8CPROTO_062_4343W-pigweed-release + +# Building mbed-CY8CPROTO_062_4343W-shell-debug +cmake --build {out}/mbed-CY8CPROTO_062_4343W-shell-debug + +# Building mbed-CY8CPROTO_062_4343W-shell-develop +cmake --build {out}/mbed-CY8CPROTO_062_4343W-shell-develop + +# Building mbed-CY8CPROTO_062_4343W-shell-release +cmake --build {out}/mbed-CY8CPROTO_062_4343W-shell-release + # Building nrf-nrf52840-light ninja -C {out}/nrf-nrf52840-light From 7d1c10d0cc10135839fe2fa2b894677c0778968a Mon Sep 17 00:00:00 2001 From: ATmobica Date: Fri, 29 Oct 2021 12:04:58 +0000 Subject: [PATCH 06/12] Fix mbed unit test build script --- scripts/tests/mbed/mbed_unit_tests.sh | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/scripts/tests/mbed/mbed_unit_tests.sh b/scripts/tests/mbed/mbed_unit_tests.sh index 34fc89a8acc125..8829f3c656c4f5 100755 --- a/scripts/tests/mbed/mbed_unit_tests.sh +++ b/scripts/tests/mbed/mbed_unit_tests.sh @@ -85,27 +85,20 @@ BUILD_DIRECTORY=build-"$TARGET_BOARD"/"$PROFILE"/ if [[ "$COMMAND" == *"build"* ]]; then echo "Build unit tests app for $TARGET_BOARD target with $TOOLCHAIN toolchain and $PROFILE profile" - # Config directory setup - MBED_CONFIG_PATH=./config/"$TARGET_BOARD"/"$PROFILE"/"$TOOLCHAIN"/ - # Set Mbed OS path - export MBED_OS_PATH="$CHIP_ROOT"/third_party/mbed-os/repo + MBED_OS_PATH="$CHIP_ROOT"/third_party/mbed-os/repo # Set Mbed OS posix socket submodule path - export MBED_OS_POSIX_SOCKET_PATH="$CHIP_ROOT"/third_party/mbed-os-posix-socket/repo + MBED_OS_POSIX_SOCKET_PATH="$CHIP_ROOT"/third_party/mbed-os-posix-socket/repo # Generate config file for selected target, toolchain and hardware - mbed-tools configure -t "$TOOLCHAIN" -m "$TARGET_BOARD" -o "$MBED_CONFIG_PATH" --mbed-os-path "$MBED_OS_PATH" + mbed-tools configure -t "$TOOLCHAIN" -m "$TARGET_BOARD" -o "$BUILD_DIRECTORY" --mbed-os-path "$MBED_OS_PATH" # Remove old artifacts to force linking rm -rf "$BUILD_DIRECTORY/chip-"* - # Create output directory and copy config file there. - mkdir -p "$BUILD_DIRECTORY" - cp -f "$MBED_CONFIG_PATH"/mbed_config.cmake "$BUILD_DIRECTORY"/mbed_config.cmake - # Build application - cmake -S "./" -B "$BUILD_DIRECTORY" -GNinja -DCMAKE_BUILD_TYPE="$PROFILE" + cmake -S "./" -B "$BUILD_DIRECTORY" -GNinja -DCMAKE_BUILD_TYPE="$PROFILE" -DMBED_OS_PATH="$MBED_OS_PATH" -DMBED_OS_POSIX_SOCKET_PATH="$MBED_OS_POSIX_SOCKET_PATH" cmake --build "$BUILD_DIRECTORY" fi From c192877e58de3d02477b7d1c2b739e71462e495f Mon Sep 17 00:00:00 2001 From: ATmobica Date: Fri, 29 Oct 2021 12:07:41 +0000 Subject: [PATCH 07/12] Fix mbed builder for Darwin platform --- scripts/build/builders/mbed.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/build/builders/mbed.py b/scripts/build/builders/mbed.py index 5c7b22cb7708f6..633187aedf2aa1 100644 --- a/scripts/build/builders/mbed.py +++ b/scripts/build/builders/mbed.py @@ -14,6 +14,7 @@ import logging import os +import platform import glob import shlex import pathlib @@ -21,8 +22,9 @@ from enum import Enum, auto from .builder import Builder -from mbed_tools.project import MbedProgram -from mbed_tools.build import generate_config +if platform.system() != 'Darwin': + from mbed_tools.project import MbedProgram + from mbed_tools.build import generate_config class MbedApp(Enum): LOCK = auto() From 63d62758d9cc7f0b8ebd43203d83ca9c4e1e4436 Mon Sep 17 00:00:00 2001 From: ATmobica Date: Fri, 29 Oct 2021 14:23:06 +0000 Subject: [PATCH 08/12] Add mbed-release targets to exampleTarget input - task.json --- .vscode/tasks.json | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 8baf5533a94d4c..1107813e26b6e6 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -260,7 +260,12 @@ "nrf-nrf5340-shell", "qpg-qpg6100-lock", "telink-tlsr9518adk80d-light", - "tizen-arm-light" + "tizen-arm-light", + "mbed-CY8CPROTO_062_4343W-all-clusters-release", + "mbed-CY8CPROTO_062_4343W-light-release", + "mbed-CY8CPROTO_062_4343W-lock-release", + "mbed-CY8CPROTO_062_4343W-pigweed-release", + "mbed-CY8CPROTO_062_4343W-shell-release" ] } ] From fe7308e5adf42622ca6bb816175688235cd36822 Mon Sep 17 00:00:00 2001 From: ATmobica Date: Fri, 29 Oct 2021 14:26:26 +0000 Subject: [PATCH 09/12] Changes restyle --- scripts/build/build/targets.py | 7 ++++-- scripts/build/builders/mbed.py | 44 +++++++++++++++++++++------------- 2 files changed, 33 insertions(+), 18 deletions(-) diff --git a/scripts/build/build/targets.py b/scripts/build/build/targets.py index 862a0398295033..dc73ee312126a0 100644 --- a/scripts/build/build/targets.py +++ b/scripts/build/build/targets.py @@ -191,18 +191,21 @@ def AndroidTargets(): yield target.Extend('androidstudio-x86-chip-tool', board=AndroidBoard.AndroidStudio_X86, app=AndroidApp.CHIP_TOOL) yield target.Extend('androidstudio-x64-chip-tool', board=AndroidBoard.AndroidStudio_X64, app=AndroidApp.CHIP_TOOL) + def MbedTargets(): target = Target('mbed', MbedBuilder) targets = [ - target.Extend('CY8CPROTO_062_4343W', board=MbedBoard.CY8CPROTO_062_4343W), + target.Extend('CY8CPROTO_062_4343W', + board=MbedBoard.CY8CPROTO_062_4343W), ] app_targets = [] for target in targets: app_targets.append(target.Extend('lock', app=MbedApp.LOCK)) app_targets.append(target.Extend('light', app=MbedApp.LIGHT)) - app_targets.append(target.Extend('all-clusters', app=MbedApp.ALL_CLUSTERS)) + app_targets.append(target.Extend( + 'all-clusters', app=MbedApp.ALL_CLUSTERS)) app_targets.append(target.Extend('pigweed', app=MbedApp.PIGWEED)) app_targets.append(target.Extend('shell', app=MbedApp.SHELL)) diff --git a/scripts/build/builders/mbed.py b/scripts/build/builders/mbed.py index 633187aedf2aa1..47d0532a4b8c16 100644 --- a/scripts/build/builders/mbed.py +++ b/scripts/build/builders/mbed.py @@ -26,6 +26,7 @@ from mbed_tools.project import MbedProgram from mbed_tools.build import generate_config + class MbedApp(Enum): LOCK = auto() LIGHT = auto() @@ -104,9 +105,11 @@ def __init__(self, self.board = board self.profile = profile self.toolchain = "GCC_ARM" - self.mbed_os_path = os.path.join(self.root, 'third_party', 'mbed-os', 'repo') - self.mbed_os_posix_socket_path = os.path.join(self.root, 'third_party', 'mbed-os-posix-socket', 'repo') - + self.mbed_os_path = os.path.join( + self.root, 'third_party', 'mbed-os', 'repo') + self.mbed_os_posix_socket_path = os.path.join( + self.root, 'third_party', 'mbed-os-posix-socket', 'repo') + @property def ExamplePath(self): return os.path.join('examples', self.app.ExampleName, 'mbed') @@ -114,25 +117,33 @@ def ExamplePath(self): def generate(self): if not os.path.exists(self.output_dir): if not self._runner.dry_run: - cmake_build_subdir = pathlib.Path(self.board.BoardName.upper(), self.profile.ProfileName.lower(), self.toolchain.upper()) - program = MbedProgram.from_existing(pathlib.Path(self.ExamplePath), cmake_build_subdir, pathlib.Path(self.mbed_os_path)) + cmake_build_subdir = pathlib.Path(self.board.BoardName.upper( + ), self.profile.ProfileName.lower(), self.toolchain.upper()) + program = MbedProgram.from_existing(pathlib.Path( + self.ExamplePath), cmake_build_subdir, pathlib.Path(self.mbed_os_path)) program.files.cmake_build_dir = pathlib.Path(self.output_dir) - _, output_path = generate_config(self.board.BoardName.upper(), self.toolchain, program) - logging.info(f"mbed_config.cmake has been generated and written to '{str(output_path.resolve())}'") - - self._Execute(['cmake', '-S', shlex.quote(self.ExamplePath), '-B', shlex.quote(self.output_dir), '-GNinja', - '-DCMAKE_BUILD_TYPE={}'.format(self.profile.ProfileName.lower()), - '-DMBED_OS_PATH={}'.format(shlex.quote(self.mbed_os_path)), - '-DMBED_OS_POSIX_SOCKET_PATH={}'.format(shlex.quote(self.mbed_os_posix_socket_path)), - ], title='Generating ' + self.identifier) - + _, output_path = generate_config( + self.board.BoardName.upper(), self.toolchain, program) + logging.info( + f"mbed_config.cmake has been generated and written to '{str(output_path.resolve())}'") + + self._Execute(['cmake', '-S', shlex.quote(self.ExamplePath), '-B', shlex.quote(self.output_dir), '-GNinja', + '-DCMAKE_BUILD_TYPE={}'.format( + self.profile.ProfileName.lower()), + '-DMBED_OS_PATH={}'.format( + shlex.quote(self.mbed_os_path)), + '-DMBED_OS_POSIX_SOCKET_PATH={}'.format( + shlex.quote(self.mbed_os_posix_socket_path)), + ], title='Generating ' + self.identifier) + def _build(self): logging.info('Building ' + self.identifier) # Remove old artifacts to force linking if pathlib.Path(self.output_dir, self.app.AppNamePrefix + '.elf').is_file(): for filename in glob.glob(os.path.join(self.output_dir, self.app.AppNamePrefix + '*')): os.remove(filename) - self._Execute(['cmake', '--build', shlex.quote(self.output_dir)], title='Building ' + self.identifier) + self._Execute(['cmake', '--build', shlex.quote(self.output_dir)], + title='Building ' + self.identifier) def build_outputs(self): return { @@ -141,5 +152,6 @@ def build_outputs(self): self.app.AppNamePrefix + '.hex': os.path.join(self.output_dir, self.app.AppNamePrefix + '.hex'), self.app.AppNamePrefix + '.map': - os.path.join(self.output_dir, self.app.AppNamePrefix + '.elf.map'), + os.path.join(self.output_dir, + self.app.AppNamePrefix + '.elf.map'), } From aa263d5f1292547639400c6022185079b42adfe3 Mon Sep 17 00:00:00 2001 From: ATmobica Date: Tue, 2 Nov 2021 11:07:51 +0000 Subject: [PATCH 10/12] Add all Mbed supported targets and sorted - tasks.json --- .vscode/tasks.json | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 1107813e26b6e6..b44986db5fd8f7 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -248,6 +248,21 @@ "linux-x64-chip-tool-ipv6only", "linux-x64-thermostat", "linux-x64-thermostat-ipv6only", + "mbed-CY8CPROTO_062_4343W-all-clusters-debug", + "mbed-CY8CPROTO_062_4343W-all-clusters-develop", + "mbed-CY8CPROTO_062_4343W-all-clusters-release", + "mbed-CY8CPROTO_062_4343W-light-debug", + "mbed-CY8CPROTO_062_4343W-light-develop", + "mbed-CY8CPROTO_062_4343W-light-release", + "mbed-CY8CPROTO_062_4343W-lock-debug", + "mbed-CY8CPROTO_062_4343W-lock-develop", + "mbed-CY8CPROTO_062_4343W-lock-release", + "mbed-CY8CPROTO_062_4343W-pigweed-debug", + "mbed-CY8CPROTO_062_4343W-pigweed-develop", + "mbed-CY8CPROTO_062_4343W-pigweed-release", + "mbed-CY8CPROTO_062_4343W-shell-debug", + "mbed-CY8CPROTO_062_4343W-shell-develop", + "mbed-CY8CPROTO_062_4343W-shell-release", "nrf-nrf52840-light", "nrf-nrf52840-lock", "nrf-nrf52840-pump", @@ -260,12 +275,7 @@ "nrf-nrf5340-shell", "qpg-qpg6100-lock", "telink-tlsr9518adk80d-light", - "tizen-arm-light", - "mbed-CY8CPROTO_062_4343W-all-clusters-release", - "mbed-CY8CPROTO_062_4343W-light-release", - "mbed-CY8CPROTO_062_4343W-lock-release", - "mbed-CY8CPROTO_062_4343W-pigweed-release", - "mbed-CY8CPROTO_062_4343W-shell-release" + "tizen-arm-light" ] } ] From 9658b59507223dbb6d91fb57ddd9b769261e9a03 Mon Sep 17 00:00:00 2001 From: ATmobica Date: Tue, 2 Nov 2021 12:33:17 +0000 Subject: [PATCH 11/12] Improve mbed builder - more dry-run commands Add develop and debug profiles to glob-blacklist --- scripts/build/build/targets.py | 4 +- scripts/build/builders/mbed.py | 31 ++--- .../testdata/all_targets_except_host.txt | 20 +-- .../build/testdata/build_all_except_host.txt | 120 +++++++++++++++--- .../glob_star_targets_except_host.txt | 5 + 5 files changed, 134 insertions(+), 46 deletions(-) diff --git a/scripts/build/build/targets.py b/scripts/build/build/targets.py index dc73ee312126a0..c11fe42ee13791 100644 --- a/scripts/build/build/targets.py +++ b/scripts/build/build/targets.py @@ -211,8 +211,8 @@ def MbedTargets(): for target in app_targets: yield target.Extend('release', profile=MbedProfile.RELEASE) - yield target.Extend('develop', profile=MbedProfile.DEVELOP) - yield target.Extend('debug', profile=MbedProfile.DEBUG) + yield target.Extend('develop', profile=MbedProfile.DEVELOP).GlobBlacklist('Compile only for debugging purpose - https://os.mbed.com/docs/mbed-os/latest/program-setup/build-profiles-and-rules.html') + yield target.Extend('debug', profile=MbedProfile.DEBUG).GlobBlacklist('Compile only for debugging purpose - https://os.mbed.com/docs/mbed-os/latest/program-setup/build-profiles-and-rules.html') ALL = [] diff --git a/scripts/build/builders/mbed.py b/scripts/build/builders/mbed.py index 47d0532a4b8c16..d6c87dc7bffff7 100644 --- a/scripts/build/builders/mbed.py +++ b/scripts/build/builders/mbed.py @@ -22,10 +22,6 @@ from enum import Enum, auto from .builder import Builder -if platform.system() != 'Darwin': - from mbed_tools.project import MbedProgram - from mbed_tools.build import generate_config - class MbedApp(Enum): LOCK = auto() @@ -112,20 +108,17 @@ def __init__(self, @property def ExamplePath(self): - return os.path.join('examples', self.app.ExampleName, 'mbed') + return os.path.join(self.root, 'examples', self.app.ExampleName, 'mbed') def generate(self): if not os.path.exists(self.output_dir): - if not self._runner.dry_run: - cmake_build_subdir = pathlib.Path(self.board.BoardName.upper( - ), self.profile.ProfileName.lower(), self.toolchain.upper()) - program = MbedProgram.from_existing(pathlib.Path( - self.ExamplePath), cmake_build_subdir, pathlib.Path(self.mbed_os_path)) - program.files.cmake_build_dir = pathlib.Path(self.output_dir) - _, output_path = generate_config( - self.board.BoardName.upper(), self.toolchain, program) - logging.info( - f"mbed_config.cmake has been generated and written to '{str(output_path.resolve())}'") + self._Execute(['mbed-tools', 'configure', + '-t', self.toolchain, + '-m', self.board.BoardName, + '-p', self.ExamplePath, + '-o', self.output_dir, + '--mbed-os-path', self.mbed_os_path, + ], title='Generating config ' + self.identifier) self._Execute(['cmake', '-S', shlex.quote(self.ExamplePath), '-B', shlex.quote(self.output_dir), '-GNinja', '-DCMAKE_BUILD_TYPE={}'.format( @@ -137,11 +130,11 @@ def generate(self): ], title='Generating ' + self.identifier) def _build(self): - logging.info('Building ' + self.identifier) # Remove old artifacts to force linking - if pathlib.Path(self.output_dir, self.app.AppNamePrefix + '.elf').is_file(): - for filename in glob.glob(os.path.join(self.output_dir, self.app.AppNamePrefix + '*')): - os.remove(filename) + cmd = 'rm -rf {}/chip-*'.format(self.output_dir) + self._Execute(['bash', '-c', cmd], + title='Remove old artifacts ' + self.identifier) + self._Execute(['cmake', '--build', shlex.quote(self.output_dir)], title='Building ' + self.identifier) diff --git a/scripts/build/testdata/all_targets_except_host.txt b/scripts/build/testdata/all_targets_except_host.txt index 55ca19dfabe1a3..03c247dc42e7b0 100644 --- a/scripts/build/testdata/all_targets_except_host.txt +++ b/scripts/build/testdata/all_targets_except_host.txt @@ -24,20 +24,20 @@ esp32-m5stack-all-clusters-ipv6only esp32-m5stack-all-clusters-rpc esp32-m5stack-all-clusters-rpc-ipv6only infineon-p6-lock -mbed-CY8CPROTO_062_4343W-all-clusters-debug -mbed-CY8CPROTO_062_4343W-all-clusters-develop +mbed-CY8CPROTO_062_4343W-all-clusters-debug (NOGLOB: Compile only for debugging purpose - https://os.mbed.com/docs/mbed-os/latest/program-setup/build-profiles-and-rules.html) +mbed-CY8CPROTO_062_4343W-all-clusters-develop (NOGLOB: Compile only for debugging purpose - https://os.mbed.com/docs/mbed-os/latest/program-setup/build-profiles-and-rules.html) mbed-CY8CPROTO_062_4343W-all-clusters-release -mbed-CY8CPROTO_062_4343W-light-debug -mbed-CY8CPROTO_062_4343W-light-develop +mbed-CY8CPROTO_062_4343W-light-debug (NOGLOB: Compile only for debugging purpose - https://os.mbed.com/docs/mbed-os/latest/program-setup/build-profiles-and-rules.html) +mbed-CY8CPROTO_062_4343W-light-develop (NOGLOB: Compile only for debugging purpose - https://os.mbed.com/docs/mbed-os/latest/program-setup/build-profiles-and-rules.html) mbed-CY8CPROTO_062_4343W-light-release -mbed-CY8CPROTO_062_4343W-lock-debug -mbed-CY8CPROTO_062_4343W-lock-develop +mbed-CY8CPROTO_062_4343W-lock-debug (NOGLOB: Compile only for debugging purpose - https://os.mbed.com/docs/mbed-os/latest/program-setup/build-profiles-and-rules.html) +mbed-CY8CPROTO_062_4343W-lock-develop (NOGLOB: Compile only for debugging purpose - https://os.mbed.com/docs/mbed-os/latest/program-setup/build-profiles-and-rules.html) mbed-CY8CPROTO_062_4343W-lock-release -mbed-CY8CPROTO_062_4343W-pigweed-debug -mbed-CY8CPROTO_062_4343W-pigweed-develop +mbed-CY8CPROTO_062_4343W-pigweed-debug (NOGLOB: Compile only for debugging purpose - https://os.mbed.com/docs/mbed-os/latest/program-setup/build-profiles-and-rules.html) +mbed-CY8CPROTO_062_4343W-pigweed-develop (NOGLOB: Compile only for debugging purpose - https://os.mbed.com/docs/mbed-os/latest/program-setup/build-profiles-and-rules.html) mbed-CY8CPROTO_062_4343W-pigweed-release -mbed-CY8CPROTO_062_4343W-shell-debug -mbed-CY8CPROTO_062_4343W-shell-develop +mbed-CY8CPROTO_062_4343W-shell-debug (NOGLOB: Compile only for debugging purpose - https://os.mbed.com/docs/mbed-os/latest/program-setup/build-profiles-and-rules.html) +mbed-CY8CPROTO_062_4343W-shell-develop (NOGLOB: Compile only for debugging purpose - https://os.mbed.com/docs/mbed-os/latest/program-setup/build-profiles-and-rules.html) mbed-CY8CPROTO_062_4343W-shell-release nrf-nrf52840-light nrf-nrf52840-light-rpc diff --git a/scripts/build/testdata/build_all_except_host.txt b/scripts/build/testdata/build_all_except_host.txt index e3084e270c4a53..3f785fbe107712 100644 --- a/scripts/build/testdata/build_all_except_host.txt +++ b/scripts/build/testdata/build_all_except_host.txt @@ -254,50 +254,95 @@ idf.py -C examples/all-clusters-app/esp32 -B {out}/esp32-m5stack-all-clusters-rp # Generating infineon-p6-lock gn gen --check --fail-on-unused-args --root={root}/examples/lock-app/p6 '--args=p6_board="CY8CKIT-062S2-43012"' {out}/infineon-p6-lock +# Generating config mbed-CY8CPROTO_062_4343W-all-clusters-debug +mbed-tools configure -t GCC_ARM -m CY8CPROTO_062_4343W -p {root}/examples/all-clusters-app/mbed -o {out}/mbed-CY8CPROTO_062_4343W-all-clusters-debug --mbed-os-path {root}/third_party/mbed-os/repo + # Generating mbed-CY8CPROTO_062_4343W-all-clusters-debug -cmake -S examples/all-clusters-app/mbed -B {out}/mbed-CY8CPROTO_062_4343W-all-clusters-debug -GNinja -DCMAKE_BUILD_TYPE=debug -DMBED_OS_PATH={root}/third_party/mbed-os/repo -DMBED_OS_POSIX_SOCKET_PATH={root}/third_party/mbed-os-posix-socket/repo +cmake -S {root}/examples/all-clusters-app/mbed -B {out}/mbed-CY8CPROTO_062_4343W-all-clusters-debug -GNinja -DCMAKE_BUILD_TYPE=debug -DMBED_OS_PATH={root}/third_party/mbed-os/repo -DMBED_OS_POSIX_SOCKET_PATH={root}/third_party/mbed-os-posix-socket/repo + +# Generating config mbed-CY8CPROTO_062_4343W-all-clusters-develop +mbed-tools configure -t GCC_ARM -m CY8CPROTO_062_4343W -p {root}/examples/all-clusters-app/mbed -o {out}/mbed-CY8CPROTO_062_4343W-all-clusters-develop --mbed-os-path {root}/third_party/mbed-os/repo # Generating mbed-CY8CPROTO_062_4343W-all-clusters-develop -cmake -S examples/all-clusters-app/mbed -B {out}/mbed-CY8CPROTO_062_4343W-all-clusters-develop -GNinja -DCMAKE_BUILD_TYPE=develop -DMBED_OS_PATH={root}/third_party/mbed-os/repo -DMBED_OS_POSIX_SOCKET_PATH={root}/third_party/mbed-os-posix-socket/repo +cmake -S {root}/examples/all-clusters-app/mbed -B {out}/mbed-CY8CPROTO_062_4343W-all-clusters-develop -GNinja -DCMAKE_BUILD_TYPE=develop -DMBED_OS_PATH={root}/third_party/mbed-os/repo -DMBED_OS_POSIX_SOCKET_PATH={root}/third_party/mbed-os-posix-socket/repo + +# Generating config mbed-CY8CPROTO_062_4343W-all-clusters-release +mbed-tools configure -t GCC_ARM -m CY8CPROTO_062_4343W -p {root}/examples/all-clusters-app/mbed -o {out}/mbed-CY8CPROTO_062_4343W-all-clusters-release --mbed-os-path {root}/third_party/mbed-os/repo # Generating mbed-CY8CPROTO_062_4343W-all-clusters-release -cmake -S examples/all-clusters-app/mbed -B {out}/mbed-CY8CPROTO_062_4343W-all-clusters-release -GNinja -DCMAKE_BUILD_TYPE=release -DMBED_OS_PATH={root}/third_party/mbed-os/repo -DMBED_OS_POSIX_SOCKET_PATH={root}/third_party/mbed-os-posix-socket/repo +cmake -S {root}/examples/all-clusters-app/mbed -B {out}/mbed-CY8CPROTO_062_4343W-all-clusters-release -GNinja -DCMAKE_BUILD_TYPE=release -DMBED_OS_PATH={root}/third_party/mbed-os/repo -DMBED_OS_POSIX_SOCKET_PATH={root}/third_party/mbed-os-posix-socket/repo + +# Generating config mbed-CY8CPROTO_062_4343W-light-debug +mbed-tools configure -t GCC_ARM -m CY8CPROTO_062_4343W -p {root}/examples/lighting-app/mbed -o {out}/mbed-CY8CPROTO_062_4343W-light-debug --mbed-os-path {root}/third_party/mbed-os/repo # Generating mbed-CY8CPROTO_062_4343W-light-debug -cmake -S examples/lighting-app/mbed -B {out}/mbed-CY8CPROTO_062_4343W-light-debug -GNinja -DCMAKE_BUILD_TYPE=debug -DMBED_OS_PATH={root}/third_party/mbed-os/repo -DMBED_OS_POSIX_SOCKET_PATH={root}/third_party/mbed-os-posix-socket/repo +cmake -S {root}/examples/lighting-app/mbed -B {out}/mbed-CY8CPROTO_062_4343W-light-debug -GNinja -DCMAKE_BUILD_TYPE=debug -DMBED_OS_PATH={root}/third_party/mbed-os/repo -DMBED_OS_POSIX_SOCKET_PATH={root}/third_party/mbed-os-posix-socket/repo + +# Generating config mbed-CY8CPROTO_062_4343W-light-develop +mbed-tools configure -t GCC_ARM -m CY8CPROTO_062_4343W -p {root}/examples/lighting-app/mbed -o {out}/mbed-CY8CPROTO_062_4343W-light-develop --mbed-os-path {root}/third_party/mbed-os/repo # Generating mbed-CY8CPROTO_062_4343W-light-develop -cmake -S examples/lighting-app/mbed -B {out}/mbed-CY8CPROTO_062_4343W-light-develop -GNinja -DCMAKE_BUILD_TYPE=develop -DMBED_OS_PATH={root}/third_party/mbed-os/repo -DMBED_OS_POSIX_SOCKET_PATH={root}/third_party/mbed-os-posix-socket/repo +cmake -S {root}/examples/lighting-app/mbed -B {out}/mbed-CY8CPROTO_062_4343W-light-develop -GNinja -DCMAKE_BUILD_TYPE=develop -DMBED_OS_PATH={root}/third_party/mbed-os/repo -DMBED_OS_POSIX_SOCKET_PATH={root}/third_party/mbed-os-posix-socket/repo + +# Generating config mbed-CY8CPROTO_062_4343W-light-release +mbed-tools configure -t GCC_ARM -m CY8CPROTO_062_4343W -p {root}/examples/lighting-app/mbed -o {out}/mbed-CY8CPROTO_062_4343W-light-release --mbed-os-path {root}/third_party/mbed-os/repo # Generating mbed-CY8CPROTO_062_4343W-light-release -cmake -S examples/lighting-app/mbed -B {out}/mbed-CY8CPROTO_062_4343W-light-release -GNinja -DCMAKE_BUILD_TYPE=release -DMBED_OS_PATH={root}/third_party/mbed-os/repo -DMBED_OS_POSIX_SOCKET_PATH={root}/third_party/mbed-os-posix-socket/repo +cmake -S {root}/examples/lighting-app/mbed -B {out}/mbed-CY8CPROTO_062_4343W-light-release -GNinja -DCMAKE_BUILD_TYPE=release -DMBED_OS_PATH={root}/third_party/mbed-os/repo -DMBED_OS_POSIX_SOCKET_PATH={root}/third_party/mbed-os-posix-socket/repo + +# Generating config mbed-CY8CPROTO_062_4343W-lock-debug +mbed-tools configure -t GCC_ARM -m CY8CPROTO_062_4343W -p {root}/examples/lock-app/mbed -o {out}/mbed-CY8CPROTO_062_4343W-lock-debug --mbed-os-path {root}/third_party/mbed-os/repo # Generating mbed-CY8CPROTO_062_4343W-lock-debug -cmake -S examples/lock-app/mbed -B {out}/mbed-CY8CPROTO_062_4343W-lock-debug -GNinja -DCMAKE_BUILD_TYPE=debug -DMBED_OS_PATH={root}/third_party/mbed-os/repo -DMBED_OS_POSIX_SOCKET_PATH={root}/third_party/mbed-os-posix-socket/repo +cmake -S {root}/examples/lock-app/mbed -B {out}/mbed-CY8CPROTO_062_4343W-lock-debug -GNinja -DCMAKE_BUILD_TYPE=debug -DMBED_OS_PATH={root}/third_party/mbed-os/repo -DMBED_OS_POSIX_SOCKET_PATH={root}/third_party/mbed-os-posix-socket/repo + +# Generating config mbed-CY8CPROTO_062_4343W-lock-develop +mbed-tools configure -t GCC_ARM -m CY8CPROTO_062_4343W -p {root}/examples/lock-app/mbed -o {out}/mbed-CY8CPROTO_062_4343W-lock-develop --mbed-os-path {root}/third_party/mbed-os/repo # Generating mbed-CY8CPROTO_062_4343W-lock-develop -cmake -S examples/lock-app/mbed -B {out}/mbed-CY8CPROTO_062_4343W-lock-develop -GNinja -DCMAKE_BUILD_TYPE=develop -DMBED_OS_PATH={root}/third_party/mbed-os/repo -DMBED_OS_POSIX_SOCKET_PATH={root}/third_party/mbed-os-posix-socket/repo +cmake -S {root}/examples/lock-app/mbed -B {out}/mbed-CY8CPROTO_062_4343W-lock-develop -GNinja -DCMAKE_BUILD_TYPE=develop -DMBED_OS_PATH={root}/third_party/mbed-os/repo -DMBED_OS_POSIX_SOCKET_PATH={root}/third_party/mbed-os-posix-socket/repo + +# Generating config mbed-CY8CPROTO_062_4343W-lock-release +mbed-tools configure -t GCC_ARM -m CY8CPROTO_062_4343W -p {root}/examples/lock-app/mbed -o {out}/mbed-CY8CPROTO_062_4343W-lock-release --mbed-os-path {root}/third_party/mbed-os/repo # Generating mbed-CY8CPROTO_062_4343W-lock-release -cmake -S examples/lock-app/mbed -B {out}/mbed-CY8CPROTO_062_4343W-lock-release -GNinja -DCMAKE_BUILD_TYPE=release -DMBED_OS_PATH={root}/third_party/mbed-os/repo -DMBED_OS_POSIX_SOCKET_PATH={root}/third_party/mbed-os-posix-socket/repo +cmake -S {root}/examples/lock-app/mbed -B {out}/mbed-CY8CPROTO_062_4343W-lock-release -GNinja -DCMAKE_BUILD_TYPE=release -DMBED_OS_PATH={root}/third_party/mbed-os/repo -DMBED_OS_POSIX_SOCKET_PATH={root}/third_party/mbed-os-posix-socket/repo + +# Generating config mbed-CY8CPROTO_062_4343W-pigweed-debug +mbed-tools configure -t GCC_ARM -m CY8CPROTO_062_4343W -p {root}/examples/pigweed-app/mbed -o {out}/mbed-CY8CPROTO_062_4343W-pigweed-debug --mbed-os-path {root}/third_party/mbed-os/repo # Generating mbed-CY8CPROTO_062_4343W-pigweed-debug -cmake -S examples/pigweed-app/mbed -B {out}/mbed-CY8CPROTO_062_4343W-pigweed-debug -GNinja -DCMAKE_BUILD_TYPE=debug -DMBED_OS_PATH={root}/third_party/mbed-os/repo -DMBED_OS_POSIX_SOCKET_PATH={root}/third_party/mbed-os-posix-socket/repo +cmake -S {root}/examples/pigweed-app/mbed -B {out}/mbed-CY8CPROTO_062_4343W-pigweed-debug -GNinja -DCMAKE_BUILD_TYPE=debug -DMBED_OS_PATH={root}/third_party/mbed-os/repo -DMBED_OS_POSIX_SOCKET_PATH={root}/third_party/mbed-os-posix-socket/repo + +# Generating config mbed-CY8CPROTO_062_4343W-pigweed-develop +mbed-tools configure -t GCC_ARM -m CY8CPROTO_062_4343W -p {root}/examples/pigweed-app/mbed -o {out}/mbed-CY8CPROTO_062_4343W-pigweed-develop --mbed-os-path {root}/third_party/mbed-os/repo # Generating mbed-CY8CPROTO_062_4343W-pigweed-develop -cmake -S examples/pigweed-app/mbed -B {out}/mbed-CY8CPROTO_062_4343W-pigweed-develop -GNinja -DCMAKE_BUILD_TYPE=develop -DMBED_OS_PATH={root}/third_party/mbed-os/repo -DMBED_OS_POSIX_SOCKET_PATH={root}/third_party/mbed-os-posix-socket/repo +cmake -S {root}/examples/pigweed-app/mbed -B {out}/mbed-CY8CPROTO_062_4343W-pigweed-develop -GNinja -DCMAKE_BUILD_TYPE=develop -DMBED_OS_PATH={root}/third_party/mbed-os/repo -DMBED_OS_POSIX_SOCKET_PATH={root}/third_party/mbed-os-posix-socket/repo + +# Generating config mbed-CY8CPROTO_062_4343W-pigweed-release +mbed-tools configure -t GCC_ARM -m CY8CPROTO_062_4343W -p {root}/examples/pigweed-app/mbed -o {out}/mbed-CY8CPROTO_062_4343W-pigweed-release --mbed-os-path {root}/third_party/mbed-os/repo # Generating mbed-CY8CPROTO_062_4343W-pigweed-release -cmake -S examples/pigweed-app/mbed -B {out}/mbed-CY8CPROTO_062_4343W-pigweed-release -GNinja -DCMAKE_BUILD_TYPE=release -DMBED_OS_PATH={root}/third_party/mbed-os/repo -DMBED_OS_POSIX_SOCKET_PATH={root}/third_party/mbed-os-posix-socket/repo +cmake -S {root}/examples/pigweed-app/mbed -B {out}/mbed-CY8CPROTO_062_4343W-pigweed-release -GNinja -DCMAKE_BUILD_TYPE=release -DMBED_OS_PATH={root}/third_party/mbed-os/repo -DMBED_OS_POSIX_SOCKET_PATH={root}/third_party/mbed-os-posix-socket/repo + +# Generating config mbed-CY8CPROTO_062_4343W-shell-debug +mbed-tools configure -t GCC_ARM -m CY8CPROTO_062_4343W -p {root}/examples/shell/mbed -o {out}/mbed-CY8CPROTO_062_4343W-shell-debug --mbed-os-path {root}/third_party/mbed-os/repo # Generating mbed-CY8CPROTO_062_4343W-shell-debug -cmake -S examples/shell/mbed -B {out}/mbed-CY8CPROTO_062_4343W-shell-debug -GNinja -DCMAKE_BUILD_TYPE=debug -DMBED_OS_PATH={root}/third_party/mbed-os/repo -DMBED_OS_POSIX_SOCKET_PATH={root}/third_party/mbed-os-posix-socket/repo +cmake -S {root}/examples/shell/mbed -B {out}/mbed-CY8CPROTO_062_4343W-shell-debug -GNinja -DCMAKE_BUILD_TYPE=debug -DMBED_OS_PATH={root}/third_party/mbed-os/repo -DMBED_OS_POSIX_SOCKET_PATH={root}/third_party/mbed-os-posix-socket/repo + +# Generating config mbed-CY8CPROTO_062_4343W-shell-develop +mbed-tools configure -t GCC_ARM -m CY8CPROTO_062_4343W -p {root}/examples/shell/mbed -o {out}/mbed-CY8CPROTO_062_4343W-shell-develop --mbed-os-path {root}/third_party/mbed-os/repo # Generating mbed-CY8CPROTO_062_4343W-shell-develop -cmake -S examples/shell/mbed -B {out}/mbed-CY8CPROTO_062_4343W-shell-develop -GNinja -DCMAKE_BUILD_TYPE=develop -DMBED_OS_PATH={root}/third_party/mbed-os/repo -DMBED_OS_POSIX_SOCKET_PATH={root}/third_party/mbed-os-posix-socket/repo +cmake -S {root}/examples/shell/mbed -B {out}/mbed-CY8CPROTO_062_4343W-shell-develop -GNinja -DCMAKE_BUILD_TYPE=develop -DMBED_OS_PATH={root}/third_party/mbed-os/repo -DMBED_OS_POSIX_SOCKET_PATH={root}/third_party/mbed-os-posix-socket/repo + +# Generating config mbed-CY8CPROTO_062_4343W-shell-release +mbed-tools configure -t GCC_ARM -m CY8CPROTO_062_4343W -p {root}/examples/shell/mbed -o {out}/mbed-CY8CPROTO_062_4343W-shell-release --mbed-os-path {root}/third_party/mbed-os/repo # Generating mbed-CY8CPROTO_062_4343W-shell-release -cmake -S examples/shell/mbed -B {out}/mbed-CY8CPROTO_062_4343W-shell-release -GNinja -DCMAKE_BUILD_TYPE=release -DMBED_OS_PATH={root}/third_party/mbed-os/repo -DMBED_OS_POSIX_SOCKET_PATH={root}/third_party/mbed-os-posix-socket/repo +cmake -S {root}/examples/shell/mbed -B {out}/mbed-CY8CPROTO_062_4343W-shell-release -GNinja -DCMAKE_BUILD_TYPE=release -DMBED_OS_PATH={root}/third_party/mbed-os/repo -DMBED_OS_POSIX_SOCKET_PATH={root}/third_party/mbed-os-posix-socket/repo # Generating nrf-nrf52840-light bash -c 'source "$ZEPHYR_BASE/zephyr-env.sh"; @@ -584,48 +629,93 @@ idf.py -C examples/all-clusters-app/esp32 -B {out}/esp32-m5stack-all-clusters-rp # Building infineon-p6-lock ninja -C {out}/infineon-p6-lock +# Remove old artifacts mbed-CY8CPROTO_062_4343W-all-clusters-debug +bash -c 'rm -rf {out}/mbed-CY8CPROTO_062_4343W-all-clusters-debug/chip-*' + # Building mbed-CY8CPROTO_062_4343W-all-clusters-debug cmake --build {out}/mbed-CY8CPROTO_062_4343W-all-clusters-debug +# Remove old artifacts mbed-CY8CPROTO_062_4343W-all-clusters-develop +bash -c 'rm -rf {out}/mbed-CY8CPROTO_062_4343W-all-clusters-develop/chip-*' + # Building mbed-CY8CPROTO_062_4343W-all-clusters-develop cmake --build {out}/mbed-CY8CPROTO_062_4343W-all-clusters-develop +# Remove old artifacts mbed-CY8CPROTO_062_4343W-all-clusters-release +bash -c 'rm -rf {out}/mbed-CY8CPROTO_062_4343W-all-clusters-release/chip-*' + # Building mbed-CY8CPROTO_062_4343W-all-clusters-release cmake --build {out}/mbed-CY8CPROTO_062_4343W-all-clusters-release +# Remove old artifacts mbed-CY8CPROTO_062_4343W-light-debug +bash -c 'rm -rf {out}/mbed-CY8CPROTO_062_4343W-light-debug/chip-*' + # Building mbed-CY8CPROTO_062_4343W-light-debug cmake --build {out}/mbed-CY8CPROTO_062_4343W-light-debug +# Remove old artifacts mbed-CY8CPROTO_062_4343W-light-develop +bash -c 'rm -rf {out}/mbed-CY8CPROTO_062_4343W-light-develop/chip-*' + # Building mbed-CY8CPROTO_062_4343W-light-develop cmake --build {out}/mbed-CY8CPROTO_062_4343W-light-develop +# Remove old artifacts mbed-CY8CPROTO_062_4343W-light-release +bash -c 'rm -rf {out}/mbed-CY8CPROTO_062_4343W-light-release/chip-*' + # Building mbed-CY8CPROTO_062_4343W-light-release cmake --build {out}/mbed-CY8CPROTO_062_4343W-light-release +# Remove old artifacts mbed-CY8CPROTO_062_4343W-lock-debug +bash -c 'rm -rf {out}/mbed-CY8CPROTO_062_4343W-lock-debug/chip-*' + # Building mbed-CY8CPROTO_062_4343W-lock-debug cmake --build {out}/mbed-CY8CPROTO_062_4343W-lock-debug +# Remove old artifacts mbed-CY8CPROTO_062_4343W-lock-develop +bash -c 'rm -rf {out}/mbed-CY8CPROTO_062_4343W-lock-develop/chip-*' + # Building mbed-CY8CPROTO_062_4343W-lock-develop cmake --build {out}/mbed-CY8CPROTO_062_4343W-lock-develop +# Remove old artifacts mbed-CY8CPROTO_062_4343W-lock-release +bash -c 'rm -rf {out}/mbed-CY8CPROTO_062_4343W-lock-release/chip-*' + # Building mbed-CY8CPROTO_062_4343W-lock-release cmake --build {out}/mbed-CY8CPROTO_062_4343W-lock-release +# Remove old artifacts mbed-CY8CPROTO_062_4343W-pigweed-debug +bash -c 'rm -rf {out}/mbed-CY8CPROTO_062_4343W-pigweed-debug/chip-*' + # Building mbed-CY8CPROTO_062_4343W-pigweed-debug cmake --build {out}/mbed-CY8CPROTO_062_4343W-pigweed-debug +# Remove old artifacts mbed-CY8CPROTO_062_4343W-pigweed-develop +bash -c 'rm -rf {out}/mbed-CY8CPROTO_062_4343W-pigweed-develop/chip-*' + # Building mbed-CY8CPROTO_062_4343W-pigweed-develop cmake --build {out}/mbed-CY8CPROTO_062_4343W-pigweed-develop +# Remove old artifacts mbed-CY8CPROTO_062_4343W-pigweed-release +bash -c 'rm -rf {out}/mbed-CY8CPROTO_062_4343W-pigweed-release/chip-*' + # Building mbed-CY8CPROTO_062_4343W-pigweed-release cmake --build {out}/mbed-CY8CPROTO_062_4343W-pigweed-release +# Remove old artifacts mbed-CY8CPROTO_062_4343W-shell-debug +bash -c 'rm -rf {out}/mbed-CY8CPROTO_062_4343W-shell-debug/chip-*' + # Building mbed-CY8CPROTO_062_4343W-shell-debug cmake --build {out}/mbed-CY8CPROTO_062_4343W-shell-debug +# Remove old artifacts mbed-CY8CPROTO_062_4343W-shell-develop +bash -c 'rm -rf {out}/mbed-CY8CPROTO_062_4343W-shell-develop/chip-*' + # Building mbed-CY8CPROTO_062_4343W-shell-develop cmake --build {out}/mbed-CY8CPROTO_062_4343W-shell-develop +# Remove old artifacts mbed-CY8CPROTO_062_4343W-shell-release +bash -c 'rm -rf {out}/mbed-CY8CPROTO_062_4343W-shell-release/chip-*' + # Building mbed-CY8CPROTO_062_4343W-shell-release cmake --build {out}/mbed-CY8CPROTO_062_4343W-shell-release diff --git a/scripts/build/testdata/glob_star_targets_except_host.txt b/scripts/build/testdata/glob_star_targets_except_host.txt index 72c4fac84e8590..a5e973ae56bad5 100644 --- a/scripts/build/testdata/glob_star_targets_except_host.txt +++ b/scripts/build/testdata/glob_star_targets_except_host.txt @@ -24,6 +24,11 @@ esp32-m5stack-all-clusters-ipv6only esp32-m5stack-all-clusters-rpc esp32-m5stack-all-clusters-rpc-ipv6only infineon-p6-lock +mbed-CY8CPROTO_062_4343W-all-clusters-release +mbed-CY8CPROTO_062_4343W-light-release +mbed-CY8CPROTO_062_4343W-lock-release +mbed-CY8CPROTO_062_4343W-pigweed-release +mbed-CY8CPROTO_062_4343W-shell-release nrf-nrf52840-light nrf-nrf52840-light-rpc nrf-nrf52840-lock From fbda8de8b109ae5d6fde801cb3d0013e1a9fc088 Mon Sep 17 00:00:00 2001 From: ATmobica Date: Tue, 2 Nov 2021 12:34:55 +0000 Subject: [PATCH 12/12] Changes restyle --- scripts/build/builders/mbed.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/scripts/build/builders/mbed.py b/scripts/build/builders/mbed.py index d6c87dc7bffff7..547481a2539bb2 100644 --- a/scripts/build/builders/mbed.py +++ b/scripts/build/builders/mbed.py @@ -113,11 +113,11 @@ def ExamplePath(self): def generate(self): if not os.path.exists(self.output_dir): self._Execute(['mbed-tools', 'configure', - '-t', self.toolchain, - '-m', self.board.BoardName, - '-p', self.ExamplePath, - '-o', self.output_dir, - '--mbed-os-path', self.mbed_os_path, + '-t', self.toolchain, + '-m', self.board.BoardName, + '-p', self.ExamplePath, + '-o', self.output_dir, + '--mbed-os-path', self.mbed_os_path, ], title='Generating config ' + self.identifier) self._Execute(['cmake', '-S', shlex.quote(self.ExamplePath), '-B', shlex.quote(self.output_dir), '-GNinja', @@ -133,8 +133,8 @@ def _build(self): # Remove old artifacts to force linking cmd = 'rm -rf {}/chip-*'.format(self.output_dir) self._Execute(['bash', '-c', cmd], - title='Remove old artifacts ' + self.identifier) - + title='Remove old artifacts ' + self.identifier) + self._Execute(['cmake', '--build', shlex.quote(self.output_dir)], title='Building ' + self.identifier)