diff --git a/builder/bootloader.py b/builder/bootloader.py index fbd9680..0c9eb89 100644 --- a/builder/bootloader.py +++ b/builder/bootloader.py @@ -124,12 +124,15 @@ def get_bootloader_dxcore(framework_dir, board_config): UPLOADBOOTCMD="$BOOTUPLOADER $BOOTUPLOADERFLAGS $UPLOAD_FLAGS $BOOTFLAGS", ) -if not env.BoardConfig().get("upload", {}).get("require_upload_port", False): +if env.subst("$UPLOAD_PROTOCOL") in ( + "jtag2updi", + "serialupdi", +) or env.BoardConfig().get("upload", {}).get("require_upload_port", False): + env.AutodetectUploadPort() + env.Append(BOOTUPLOADERFLAGS=["-P", '"$UPLOAD_PORT"']) +else: # upload methods via USB env.Append(BOOTUPLOADERFLAGS=["-P", "usb"]) -else: - env.AutodetectUploadPort() - env.Append(FUSESUPLOADERFLAGS=["-P", '"$UPLOAD_PORT"']) if env.subst("$UPLOAD_PROTOCOL") != "custom": env.Append(BOOTUPLOADERFLAGS=["-c", "$UPLOAD_PROTOCOL"])