forked from micropython/micropython
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Espressif: fix handling of single-partition CIRCUITPY (non-CIRCUITPY_STORAGE_EXTEND) - fixes MEMENTO bug #8952
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
Merged
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
3871899
wip
dhalbert c64630a
espressif: add a script to check for incompatibilities...
jepler fbbfa3a
ports/espressif/tools/check-sdkconfig.py: use click
dhalbert c6e0935
ports/espressif/supervisor/internal_flash.c: correct write when there…
dhalbert 9a3e087
ports/espressif/boards/adafruit_esp32s3_camera/mpconfigboard.mk: fix …
dhalbert File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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
File renamed without changes.
13 changes: 10 additions & 3 deletions
13
...-config/sdkconfig-flash-4MB-1ota.defaults → ...onfig/sdkconfig-flash-4MB-no-ota.defaults
This file contains hidden or 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 |
---|---|---|
@@ -1,18 +1,25 @@ | ||
# | ||
# Espressif IoT Development Framework Configuration | ||
# | ||
# | ||
# Serial flasher config | ||
# | ||
# CONFIG_ESPTOOLPY_FLASHSIZE_1MB is not set | ||
# CONFIG_ESPTOOLPY_FLASHSIZE_2MB is not set | ||
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y | ||
# CONFIG_ESPTOOLPY_FLASHSIZE_8MB is not set | ||
# CONFIG_ESPTOOLPY_FLASHSIZE_16MB is not set | ||
# CONFIG_ESPTOOLPY_FLASHSIZE_32MB is not set | ||
# CONFIG_ESPTOOLPY_FLASHSIZE_64MB is not set | ||
# CONFIG_ESPTOOLPY_FLASHSIZE_128MB is not set | ||
CONFIG_ESPTOOLPY_FLASHSIZE="4MB" | ||
CONFIG_ESPTOOLPY_FLASHSIZE_DETECT=y | ||
# end of Serial flasher config | ||
|
||
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="esp-idf-config/partitions-4MB-1ota.csv" | ||
# | ||
# Partition Table | ||
# | ||
CONFIG_PARTITION_TABLE_FILENAME="esp-idf-config/partitions-4MB-1ota.csv" | ||
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="esp-idf-config/partitions-4MB-no-ota.csv" | ||
CONFIG_PARTITION_TABLE_FILENAME="esp-idf-config/partitions-4MB-no-ota.csv" | ||
# end of Partition Table | ||
|
||
# end of Espressif IoT Development Framework Configuration |
This file contains hidden or 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 hidden or 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 hidden or 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,60 @@ | ||
#!/usr/bin/env python3 | ||
import sys | ||
|
||
import click | ||
|
||
|
||
def int_or_string(s): | ||
try: | ||
return int(s) | ||
except ValueError: | ||
return s.strip('"') | ||
|
||
|
||
def collect_definitions(file): | ||
"""Collect all definitions in supplied sdkconfig.h.""" | ||
sdk_config = {} | ||
for line in file: | ||
if line.startswith("#define "): | ||
_, k, v = line.strip().split(None, 2) | ||
# Handle transitive definitions like '#define CONFIG_TCP_MSL CONFIG_LWIP_TCP_MSL' | ||
v = sdk_config.get(k, v) | ||
sdk_config[k] = int_or_string(v) | ||
return sdk_config | ||
|
||
|
||
def validate(sdk_config, circuitpy_config): | ||
partition_table = sdk_config.get("CONFIG_PARTITION_TABLE_FILENAME") | ||
for var in ("CIRCUITPY_STORAGE_EXTEND", "CIRCUITPY_DUALBANK"): | ||
if circuitpy_config.get(var): | ||
with open(partition_table) as f: | ||
content = f.read() | ||
if not "ota_1" in content: | ||
raise SystemExit( | ||
f"{var} is incompatible with {partition_table=} (no ota_1 partition)" | ||
) | ||
|
||
# Add more checks here for other things we want to verify. | ||
return | ||
|
||
|
||
@click.command() | ||
@click.argument("definitions", nargs=-1, metavar="CIRCUITPY_X=1 CIRCUITPY_Y=0 ...") | ||
@click.argument( | ||
"sdkconfig_h", required=True, nargs=1, type=click.File("r"), metavar="<path to sdkconfig.h>" | ||
) | ||
def run(definitions, sdkconfig_h): | ||
sdk_config = collect_definitions(sdkconfig_h) | ||
|
||
# Parse definitions arguments | ||
circuitpy_config = {} | ||
for definition in definitions: | ||
k, v = definition.split("=", 1) | ||
circuitpy_config[k] = int_or_string(v) | ||
|
||
# Validate. | ||
validate(sdk_config, circuitpy_config) | ||
|
||
|
||
if __name__ == "__main__": | ||
run() |
This file contains hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.