-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from sidoh/megabin
* Use correct cache directory * Move support scripts to ./scripts directory * Build full binary images which include: * The bootloader * Partition table * App loader * Firmware This is done in a way generic enough to not break if new platforms are added. * Distribute "megabins" with tagged releases. These will be prefixed with "INITIALIZER_". * Ignore updates from filenames starting with INITIALIZER_ * Document uploading megabin via esptool * Show firmware update errors in UI
- Loading branch information
Showing
13 changed files
with
153 additions
and
47 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
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,51 @@ | ||
#!/usr/bin/python3 | ||
|
||
from pathlib import Path | ||
|
||
Import("env") | ||
|
||
SOURCE_START_LOCATION = 0x10000 | ||
|
||
|
||
def create_full_bin(source, target, env): | ||
firmware_file = target[0].get_abspath() | ||
full_image_filename = env.subst("$BUILD_DIR/${PROGNAME}-full.bin") | ||
parts = [] | ||
|
||
# Will contain 3 parts outside of the main firmware image: | ||
# * Bootloader | ||
# * Compiled partition table | ||
# * App loader | ||
for part in env.get("FLASH_EXTRA_IMAGES", []): | ||
start, filename = part | ||
|
||
# Parse hext string | ||
if isinstance(start, str): | ||
start = int(start, 16) | ||
|
||
filename = env.subst(filename) | ||
|
||
parts.append((start, filename)) | ||
|
||
# End with the main firmware image | ||
parts.append((SOURCE_START_LOCATION, firmware_file)) | ||
|
||
# Start at location of earliest image (don't start at 0x0) | ||
ix = parts[0][0] | ||
|
||
with open(full_image_filename, "wb") as f: | ||
while len(parts) > 0: | ||
part_ix, part_filename = parts.pop(0) | ||
part_filesize = Path(part_filename).stat().st_size | ||
padding = part_ix - ix | ||
|
||
for _ in range(padding): | ||
f.write(b"\x00") | ||
|
||
with open(part_filename, "rb") as part_file: | ||
f.write(part_file.read()) | ||
|
||
ix = part_ix + part_filesize | ||
|
||
|
||
env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", create_full_bin) |
File renamed without changes.
File renamed without changes.
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
Oops, something went wrong.