@@ -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,16 +181,19 @@ 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 = [
183192 env .VerboseAction ("$UPLOADCMD" , "Uploading $SOURCE" )
184193 ]
185194
186195# custom upload tool
187- elif "UPLOADCMD" in env :
196+ elif upload_protocol == "custom" :
188197 upload_actions = [env .VerboseAction ("$UPLOADCMD" , "Uploading $SOURCE" )]
189198
190199if not upload_actions :
0 commit comments