Skip to content

Commit

Permalink
Support building rp2040 (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
jesserockz committed Jan 8, 2023
1 parent 085d178 commit 072aded
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions entrypoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@
platform = "esp32"
elif "esp8266" in config:
platform = "esp8266"
elif "rp2040" in config:
platform = "rp2040"

name += f"-{platform}"

Expand All @@ -81,7 +83,12 @@
print(json.dumps(data, indent=2))

elf = Path(data["prog_path"])
bin = elf.with_name("firmware-factory.bin")
if platform == "rp2040":
source_bin = elf.with_name("firmware.uf2")
dest_bin = file_base / f"{name}.uf2"
else:
source_bin = elf.with_name("firmware-factory.bin")
dest_bin = file_base / f"{name}.bin"
print("::endgroup::")

print("::group::Copy firmware file(s) to folder")
Expand All @@ -90,12 +97,15 @@
if os.environ.get("GITHUB_JOB") is not None:
shutil.chown(file_base, GH_RUNNER_USER_UID, GH_RUNNER_USER_GID)

shutil.copyfile(bin, file_base / f"{name}.bin")
shutil.copyfile(source_bin, dest_bin)
if os.environ.get("GITHUB_JOB") is not None:
shutil.chown(file_base / f"{name}.bin", GH_RUNNER_USER_UID, GH_RUNNER_USER_GID)
shutil.chown(dest_bin, GH_RUNNER_USER_UID, GH_RUNNER_USER_GID)

print("::endgroup::")

if platform == "rp2040":
sys.exit(0)

print("::group::Write manifest.json file")

chip_family = None
Expand All @@ -116,7 +126,7 @@
"chipFamily": chip_family,
"parts": [
{
"path": str(file_base / f"{name}.bin"),
"path": str(dest_bin),
"offset": 0x00,
}
],
Expand Down

0 comments on commit 072aded

Please sign in to comment.