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

remove fixed address 0x10000 for firmware #785

Closed
wants to merge 4 commits into from
Closed
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
1 change: 0 additions & 1 deletion builder/frameworks/arduino.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,3 @@
SConscript(
join(DefaultEnvironment().PioPlatform().get_package_dir(
"framework-arduinoespressif32"), "tools", "platformio-build.py"))
env["INTEGRATION_EXTRA_DATA"].update({"application_offset": env.subst("$ESP32_APP_OFFSET")})
22 changes: 12 additions & 10 deletions builder/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ def _parse_partitions(env):

result = []
next_offset = 0
bound = int(board.get("upload.offset_address", "0x10000"), 16) # default 0x10000
with open(partitions_csv) as fp:
for line in fp.readlines():
line = line.strip()
Expand All @@ -126,13 +127,14 @@ def _parse_partitions(env):
"flags": tokens[5] if len(tokens) > 5 else None
}
result.append(partition)
next_offset = _parse_size(partition["offset"]) + _parse_size(
partition["size"]
)

bound = 0x10000 if partition["type"] in ("0", "app") else 4
next_offset = _parse_size(partition["offset"])
if (partition["subtype"] == "ota_0"):
bound = next_offset
next_offset = (next_offset + bound - 1) & ~(bound - 1)

# Configure application partition offset
env.Replace(ESP32_APP_OFFSET=str(hex(bound)))
# Propagate application offset to debug configurations
env["INTEGRATION_EXTRA_DATA"].update({"application_offset": str(hex(bound))})
return result


Expand Down Expand Up @@ -246,8 +248,7 @@ def __fetch_fs_size(target, source, env):
"ESP32_FS_IMAGE_NAME", env.get("ESP32_SPIFFS_IMAGE_NAME", filesystem)
),

ESP32_APP_OFFSET=board.get("upload.offset_address", "0x10000"),

ESP32_APP_OFFSET=env.get("INTEGRATION_EXTRA_DATA").get("application_offset"),
PROGSUFFIX=".elf"
)

Expand Down Expand Up @@ -457,6 +458,7 @@ def __fetch_fs_size(target, source, env):


elif upload_protocol in debug_tools:
_parse_partitions(env)
openocd_args = ["-d%d" % (2 if int(ARGUMENTS.get("PIOVERBOSE", 0)) else 1)]
openocd_args.extend(
debug_tools.get(upload_protocol).get("server").get("arguments", []))
Expand All @@ -469,8 +471,8 @@ def __fetch_fs_size(target, source, env):
% (
"$FS_START"
if "uploadfs" in COMMAND_LINE_TARGETS
else board.get(
"upload.offset_address", "$ESP32_APP_OFFSET"
else env.get(
"INTEGRATION_EXTRA_DATA").get("application_offset"
)
),
]
Expand Down