Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix telink examples on vscode image #22911

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions scripts/build/builders/telink.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,22 +67,26 @@ def __init__(self,
self.app = app
self.board = board

def generate(self):
if os.path.exists(self.output_dir):
return

def get_cmd_prefixes(self):
if not self._runner.dry_run:
# Zephyr base
if 'TELINK_ZEPHYR_BASE' not in os.environ:
raise Exception("Telink builds require TELINK_ZEPHYR_BASE")

cmd = 'export ZEPHYR_BASE="$TELINK_ZEPHYR_BASE"\n'
cmd = 'export ZEPHYR_TOOLCHAIN_VARIANT=zephyr\n'
cmd += 'export ZEPHYR_BASE="$TELINK_ZEPHYR_BASE"\n'

if 'TELINK_ZEPHYR_SDK_DIR' in os.environ:
cmd += 'export ZEPHYR_SDK_INSTALL_DIR="$TELINK_ZEPHYR_SDK_DIR"\n'

return cmd

def generate(self):
if os.path.exists(self.output_dir):
return

cmd = self.get_cmd_prefixes()
cmd += '''
export ZEPHYR_TOOLCHAIN_VARIANT=zephyr
source "$ZEPHYR_BASE/zephyr-env.sh";
west build --cmake-only -d {outdir} -b {board} {sourcedir}
'''.format(
Expand All @@ -97,8 +101,9 @@ def generate(self):
def _build(self):
logging.info('Compiling Telink at %s', self.output_dir)

self._Execute(['ninja', '-C', self.output_dir],
title='Building ' + self.identifier)
cmd = self.get_cmd_prefixes() + ("ninja -C %s" % self.output_dir)

self._Execute(['bash', '-c', cmd], title='Building ' + self.identifier)

def build_outputs(self):
return {
Expand Down
27 changes: 18 additions & 9 deletions scripts/build/testdata/build_all_except_host.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1163,23 +1163,23 @@ gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/exa
gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/shell/qpg '--args=qpg_target_ic="qpg6105"' {out}/qpg-shell

# Generating telink-tlsr9518adk80d-light
bash -c 'export ZEPHYR_BASE="$TELINK_ZEPHYR_BASE"
bash -c 'export ZEPHYR_TOOLCHAIN_VARIANT=zephyr
export ZEPHYR_BASE="$TELINK_ZEPHYR_BASE"
export ZEPHYR_SDK_INSTALL_DIR="$TELINK_ZEPHYR_SDK_DIR"
export ZEPHYR_TOOLCHAIN_VARIANT=zephyr
source "$ZEPHYR_BASE/zephyr-env.sh";
west build --cmake-only -d {out}/telink-tlsr9518adk80d-light -b tlsr9518adk80d {root}/examples/lighting-app/telink'

# Generating telink-tlsr9518adk80d-light-switch
bash -c 'export ZEPHYR_BASE="$TELINK_ZEPHYR_BASE"
bash -c 'export ZEPHYR_TOOLCHAIN_VARIANT=zephyr
export ZEPHYR_BASE="$TELINK_ZEPHYR_BASE"
export ZEPHYR_SDK_INSTALL_DIR="$TELINK_ZEPHYR_SDK_DIR"
export ZEPHYR_TOOLCHAIN_VARIANT=zephyr
source "$ZEPHYR_BASE/zephyr-env.sh";
west build --cmake-only -d {out}/telink-tlsr9518adk80d-light-switch -b tlsr9518adk80d {root}/examples/light-switch-app/telink'

# Generating telink-tlsr9518adk80d-ota-requestor
bash -c 'export ZEPHYR_BASE="$TELINK_ZEPHYR_BASE"
bash -c 'export ZEPHYR_TOOLCHAIN_VARIANT=zephyr
export ZEPHYR_BASE="$TELINK_ZEPHYR_BASE"
export ZEPHYR_SDK_INSTALL_DIR="$TELINK_ZEPHYR_SDK_DIR"
export ZEPHYR_TOOLCHAIN_VARIANT=zephyr
source "$ZEPHYR_BASE/zephyr-env.sh";
west build --cmake-only -d {out}/telink-tlsr9518adk80d-ota-requestor -b tlsr9518adk80d {root}/examples/ota-requestor-app/telink'

Expand Down Expand Up @@ -2402,13 +2402,22 @@ ninja -C {out}/qpg-persistent-storage
ninja -C {out}/qpg-shell

# Building telink-tlsr9518adk80d-light
ninja -C {out}/telink-tlsr9518adk80d-light
bash -c 'export ZEPHYR_TOOLCHAIN_VARIANT=zephyr
export ZEPHYR_BASE="$TELINK_ZEPHYR_BASE"
export ZEPHYR_SDK_INSTALL_DIR="$TELINK_ZEPHYR_SDK_DIR"
ninja -C {out}/telink-tlsr9518adk80d-light'

# Building telink-tlsr9518adk80d-light-switch
ninja -C {out}/telink-tlsr9518adk80d-light-switch
bash -c 'export ZEPHYR_TOOLCHAIN_VARIANT=zephyr
export ZEPHYR_BASE="$TELINK_ZEPHYR_BASE"
export ZEPHYR_SDK_INSTALL_DIR="$TELINK_ZEPHYR_SDK_DIR"
ninja -C {out}/telink-tlsr9518adk80d-light-switch'

# Building telink-tlsr9518adk80d-ota-requestor
ninja -C {out}/telink-tlsr9518adk80d-ota-requestor
bash -c 'export ZEPHYR_TOOLCHAIN_VARIANT=zephyr
export ZEPHYR_BASE="$TELINK_ZEPHYR_BASE"
export ZEPHYR_SDK_INSTALL_DIR="$TELINK_ZEPHYR_SDK_DIR"
ninja -C {out}/telink-tlsr9518adk80d-ota-requestor'

# Building tizen-arm-all-clusters
ninja -C {out}/tizen-arm-all-clusters
Expand Down