blob: 90875fa966013d5c1be4d4990b21d18038f144b0 [file] [edit]
# Copyright 2026 The Pigweed 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
#
# https://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.
"""Helper functions for setting up args to zephyr kconfig parsing."""
def get_kconfig_args(
script,
zephyr_root,
modules = [],
output = None,
output_dir = None,
app_dir = None,
board = None,
board_dir = None,
parent_platform = None,
app_name = None,
board_dirs = [],
oot_dts_roots = [],
conf_fragments = []):
args = [
str(script),
"--zephyr-base",
zephyr_root,
]
if output:
args.extend(["--output", output])
if output_dir:
args.extend(["--output-dir", output_dir])
if app_dir:
args.extend(["--app-dir", app_dir])
if board:
args.extend(["--board", board])
if board_dir:
args.extend(["--board-dir", board_dir])
if parent_platform:
args.extend(["--parent-platform", str(parent_platform)])
if app_name:
args.extend(["--app-name", app_name])
if board_dirs:
args.append("--board-dirs")
args.extend(board_dirs)
if modules:
args.append("--modules")
args.extend(modules)
if oot_dts_roots:
args.append("--oot-dts-roots")
args.extend(oot_dts_roots)
if conf_fragments:
args.append("--conf-fragments")
args.extend(conf_fragments)
return args