Allow overriding debug adapter speed using "debug_speed" option

Resolve #459, #463
This commit is contained in:
valeros
2021-01-28 16:43:39 +02:00
parent 01034c8ef7
commit 8d1b13f274
2 changed files with 12 additions and 6 deletions
+2 -1
View File
@@ -372,9 +372,10 @@ elif upload_protocol in debug_tools:
openocd_args.extend(
debug_tools.get(upload_protocol).get("server").get("arguments", []))
openocd_args.extend([
"-c", "adapter_khz %s" % env.GetProjectOption("debug_speed", "5000"),
"-c",
"program_esp {{$SOURCE}} %s verify" %
board.get("upload.offset_address", "$ESP32_APP_OFFSET")
board.get("upload.offset_address", "$ESP32_APP_OFFSET"),
])
for image in env.get("FLASH_EXTRA_IMAGES", []):
openocd_args.extend([
+10 -5
View File
@@ -130,8 +130,6 @@ class Espressif32Platform(PlatformBase):
if "openocd_target" in debug
else ("board", debug.get("openocd_board"))
),
"-c",
"adapter_khz %d" % debug.get("adapter_speed", 5000),
]
debug["tools"][link] = {
@@ -164,15 +162,22 @@ class Espressif32Platform(PlatformBase):
def configure_debug_options(self, initial_debug_options, ide_data):
ide_extra_data = ide_data.get("extra", {})
flash_images = ide_extra_data.get("flash_images", [])
debug_options = copy.deepcopy(initial_debug_options)
if "openocd" in debug_options["server"].get("executable", ""):
debug_options["server"]["arguments"].extend(
["-c", "adapter_khz %s" % (initial_debug_options.get("speed") or "5000")]
)
ignore_conds = [
initial_debug_options["load_cmds"] != ["load"],
not flash_images,
not all([os.path.isfile(item["path"]) for item in flash_images]),
]
if any(ignore_conds):
return initial_debug_options
debug_options = copy.deepcopy(initial_debug_options)
if any(ignore_conds):
return debug_options
load_cmds = [
'monitor program_esp "{{{path}}}" {offset} verify'.format(
path=fs.to_unix_path(item["path"]), offset=item["offset"]