Skip to content

Commit dbdeb24

Browse files
committed
Allow to configure upload offset address using board_upload.offset_address option
1 parent 09cafcc commit dbdeb24

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

builder/main.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,13 @@ def _jlink_cmd_script(env, source):
120120
if not isdir(build_dir):
121121
makedirs(build_dir)
122122
script_path = join(build_dir, "upload.jlink")
123-
commands = ["h", "loadbin %s,0x0" % source, "r", "q"]
123+
commands = [
124+
"h",
125+
"loadbin %s, %s" % (source, env.BoardConfig().get(
126+
"upload.offset_address", "0x0")),
127+
"r",
128+
"q"
129+
]
124130
with open(script_path, "w") as fp:
125131
fp.write("\n".join(commands))
126132
return script_path
@@ -175,8 +181,11 @@ def _jlink_cmd_script(env, source):
175181
env.Replace(
176182
UPLOADER="openocd",
177183
UPLOADERFLAGS=["-s", platform.get_package_dir("tool-openocd") or ""] +
178-
debug_server.get("arguments", []) +
179-
["-c", "program {{$SOURCE}} verify reset; shutdown;"],
184+
debug_tools.get(upload_protocol).get("server").get("arguments", []) + [
185+
"-c",
186+
"program {{$SOURCE}} verify reset %s; shutdown;" %
187+
env.BoardConfig().get("upload.offset_address", "")
188+
],
180189
UPLOADCMD="$UPLOADER $UPLOADERFLAGS"
181190
)
182191
upload_actions = [

0 commit comments

Comments
 (0)