Skip to content

Commit 1898651

Browse files
committed
Don't try to invoke OpenOCD or JLinkExe in BlackMagic (GDB) case
1 parent e070e2f commit 1898651

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

builder/main.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -723,9 +723,11 @@ def generate_openocd_action(args: list[str], action_name:str):
723723
env.AddPlatformTarget("uploadfs", target_firm, upload_actions, "Upload Filesystem Image")
724724

725725
# Erase targets
726-
access_via_openocd = upload_protocol in debug_tools
727-
if access_via_openocd:
728-
if "jlink" not in upload_protocol:
726+
access_via_debug_tool = upload_protocol in debug_tools
727+
debug_tools_not_using_openocd = ["jlink", "blackmagic", "blackmagic-jtag"]
728+
if access_via_debug_tool:
729+
# means "upload protocol uses openocd.."
730+
if upload_protocol not in debug_tools_not_using_openocd:
729731
env.AddPlatformTarget(
730732
"erase", None, generate_openocd_action([
731733
"-c", "\"flash probe 0\"",
@@ -734,7 +736,7 @@ def generate_openocd_action(args: list[str], action_name:str):
734736
], "Erasing Flash."),
735737
"Erase Flash (via OpenOCD)"
736738
)
737-
else:
739+
elif "jlink" in upload_protocol:
738740
env.AddPlatformTarget(
739741
"erase", None, env.VerboseAction(" ".join([
740742
"JLink.exe" if system() == "Windows" else "JLinkExe",
@@ -762,6 +764,7 @@ def generate_openocd_action(args: list[str], action_name:str):
762764
]
763765
with open(script_path, "w") as fp:
764766
fp.write("\n".join(commands))
767+
# Erase via blackmagic not implemented yet, but should be possible with GDB commands.
765768
elif upload_protocol == "picotool" or upload_protocol == "mbed":
766769
# get path of this platform to get flash_nuke.elf
767770
path_to_flash_nuke_uf2 = join(platform.get_dir(), "misc", "binaries", "flash_nuke.uf2")

0 commit comments

Comments
 (0)