-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add k32w support into build_examples and use it for CI (#13062)
* Start adding k32w support for build_examples * Fix typo * Make sure vscode user can actually run the nxp patch sdk script * Ensure all targets exported work, fix names for outputs * Switch k32w CI builds to use example_builds * Support release builds as well * Fix build args duplication * Update targets and builds and unit tests. The build logic is a bit off though * Update unit test and run logic * update cloudbuild to use 0.5.40 build images as well * Restyle files * Fix typo in size info naming * Fix yaml indent typo * One more typo fix * Update to only build release on k32w - it turns out debug does not compile * Restyle files * Increase timeout for k32w example builds
- Loading branch information
Showing
10 changed files
with
185 additions
and
59 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
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,93 @@ | ||
# 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 os | ||
from enum import Enum, auto | ||
|
||
from .gn import GnBuilder | ||
|
||
|
||
class K32WApp(Enum): | ||
LIGHT = auto() | ||
LOCK = auto() | ||
SHELL = auto() | ||
|
||
def ExampleName(self): | ||
if self == K32WApp.LIGHT: | ||
return 'lighting-app' | ||
elif self == K32WApp.LOCK: | ||
return 'lock-app' | ||
elif self == K32WApp.SHELL: | ||
return 'shell' | ||
else: | ||
raise Exception('Unknown app type: %r' % self) | ||
|
||
def AppNamePrefix(self): | ||
if self == K32WApp.LIGHT: | ||
return 'chip-k32w061-light-example' | ||
elif self == K32WApp.LOCK: | ||
return 'chip-k32w061-lock-example' | ||
elif self == K32WApp.SHELL: | ||
return 'chip-k32w061-shell-example' | ||
else: | ||
raise Exception('Unknown app type: %r' % self) | ||
|
||
def BuildRoot(self, root): | ||
return os.path.join(root, 'examples', self.ExampleName(), 'nxp', 'k32w', 'k32w0') | ||
|
||
|
||
class K32WBuilder(GnBuilder): | ||
|
||
def __init__(self, | ||
root, | ||
runner, | ||
app: K32WApp = K32WApp.LIGHT, | ||
release: bool = False, | ||
low_power: bool = False): | ||
super(K32WBuilder, self).__init__( | ||
root=app.BuildRoot(root), | ||
runner=runner) | ||
self.code_root = root | ||
self.app = app | ||
self.low_power = low_power | ||
self.release = release | ||
|
||
def GnBuildArgs(self): | ||
args = [ | ||
'k32w0_sdk_root="%s"' % os.environ['NXP_K32W061_SDK_ROOT'], | ||
] | ||
|
||
if self.low_power: | ||
args.append('chip_with_low_power=1') | ||
else: | ||
args.append('chip_with_low_power=0') | ||
|
||
if self.release: | ||
args.append('is_debug=false') | ||
|
||
return args | ||
|
||
def generate(self): | ||
self._Execute([os.path.join( | ||
self.code_root, 'third_party/nxp/k32w0_sdk/sdk_fixes/patch_k32w_sdk.sh')]) | ||
|
||
super(K32WBuilder, self).generate() | ||
|
||
def build_outputs(self): | ||
items = {} | ||
for extension in ["", ".map", ".hex"]: | ||
name = '%s%s' % (self.app.AppNamePrefix(), extension) | ||
items[name] = os.path.join(self.output_dir, name) | ||
|
||
return items |
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
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 was deleted.
Oops, something went wrong.