Skip to content

Commit

Permalink
Make esp32 generic
Browse files Browse the repository at this point in the history
  • Loading branch information
aBozowski committed Jun 8, 2022
1 parent 1af3a2e commit fd5689e
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions examples/chef/chef.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ def bundle(platform: str, device_name: str) -> None:
platform: the platform to bundle
device_name: the example to bundle
"""
flush_print(f"Bundling {platform}")
shutil.rmtree(_CD_STAGING_DIR, ignore_errors=True)
os.mkdir(_CD_STAGING_DIR)
bundle_fn_name = f"bundle_{platform}"
Expand All @@ -199,17 +200,17 @@ def bundle(platform: str, device_name: str) -> None:


def bundle_linux(device_name: str) -> None:
exit(1)
pass


def bundle_nrfconnect(device_name: str) -> None:
exit(1)
pass


def bundle_esp32(device_name: str) -> None:
"""Reference example for bundle_
Should copy/move files crom cicd_config()['build_dir']
into _CD_STAGING_DIR.
into _CD_STAGING_DIR to be tar'd and archived.
Args:
device_name: the device currently built.
Expand All @@ -219,11 +220,13 @@ def bundle_esp32(device_name: str) -> None:
"build")
manifest = os.path.join(esp_root,
"chip-shell.flashbundle.txt")
os.mkdir(os.path.join(_CD_STAGING_DIR, "partition_table"))
os.mkdir(os.path.join(_CD_STAGING_DIR, "bootloader")) # TODO UNHARDCODE
with open(manifest) as m:
for item in m:
item = item.replace("\n", "")
if os.sep in item:
new_dir = item[:item.rindex(os.sep)]
new_dir = os.path.join(_CD_STAGING_DIR, new_dir)
os.makedirs(new_dir)
src_item = os.path.join(esp_root, item)
dest_item = os.path.join(_CD_STAGING_DIR, item)
shutil.copy(src_item, dest_item)
Expand Down Expand Up @@ -426,7 +429,7 @@ def main(argv: Sequence[str]) -> None:
shell.run_cmd(f"cd {_CHEF_SCRIPT_PATH}")
command = f"./chef.py -cbr --use_zzz -d {device_name} -t {options.build_target}"
flush_print(f"Building {command}", with_border=True)
shell.run_cmd(command)
# shell.run_cmd(command)
bundle(options.build_target, device_name)
exit(0)

Expand All @@ -448,7 +451,7 @@ def main(argv: Sequence[str]) -> None:
flush_print(f"Building {command}", with_border=True)
shell.run_cmd(f"cd {_CHEF_SCRIPT_PATH}")
shell.run_cmd("export GNUARMEMB_TOOLCHAIN_PATH=\"$PW_ARM_CIPD_INSTALL_DIR\"")
shell.run_cmd(command)
# shell.run_cmd(command)
bundle(platform, device_name)
archive_name = f"{label}-{device_name}"
archive_full_name = archive_prefix + archive_name + archive_suffix
Expand Down

0 comments on commit fd5689e

Please sign in to comment.