Skip to content

Commit 421cec4

Browse files
committed
Feature: make --port real optional (also for arduino IDE, cli)
1 parent 845bde6 commit 421cec4

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

platform.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,12 +147,12 @@ recipe.size.regex.data=^(?:\.data|\.VENEER_Code|\.ram_code|\.bss|\.no_init|\Stac
147147
# ----------------
148148
tools.xmcflasher.path={runtime.platform.path}/tools
149149
tools.xmcflasher.cmd.path={path}/xmc-flasher.py
150-
tools.xmcflasher.erase.params=-d XMC{build.board.version}-{build.board.v} -p {serial.port}
150+
tools.xmcflasher.erase.params=-d XMC{build.board.version}-{build.board.v} -p {upload.port.address}
151151
tools.xmcflasher.erase.pattern=python3 {cmd.path} erase {erase.params}
152152
tools.xmcflasher.erase.pattern.windows=python {cmd.path} erase {erase.params}
153153
tools.xmcflasher.upload.protocol=
154154
tools.xmcflasher.upload.params.verbose=--verbose
155155
tools.xmcflasher.upload.params.quiet=
156-
tools.xmcflasher.upload.params=-d XMC{build.board.version}-{build.board.v} -p {serial.port} -f {build.path}/{build.project_name}.hex {upload.verbose}
156+
tools.xmcflasher.upload.params=-d XMC{build.board.version}-{build.board.v} -p {upload.port.address} -f {build.path}/{build.project_name}.hex {upload.verbose}
157157
tools.xmcflasher.upload.pattern=python3 {cmd.path} upload {upload.params}
158158
tools.xmcflasher.upload.pattern.windows=python {cmd.path} upload {upload.params}

tools/xmc-flasher.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,8 @@ def check_device(device, port):
178178
real_device = find_device_by_value(device_value_masked)
179179
#compare with stored master data
180180
if not real_device == device:
181-
print(f"Connected Device is: {real_device}.")
181+
if real_device != None:
182+
print(f"Connected Device is: {real_device}.")
182183
raise Exception(f"Device connected on port {port} does not match the selected device to flash")
183184

184185
def check_mem(device, port):
@@ -293,7 +294,7 @@ def __call__(self, parser, namespace, values, option_string, **kwargs):
293294
parser_upload = subparser.add_parser('upload', description='Upload binary command')
294295
required_upload = parser_upload.add_argument_group('required arguments')
295296
required_upload.add_argument('-d','--device', type=str, help='jlink device name', required=True)
296-
required_upload.add_argument('-p','--port', type=str, help='serial port')
297+
required_upload.add_argument('-p','--port', type=str, nargs='?', const='', help='serial port')
297298
required_upload.add_argument('-f','--binfile', type=str, help='binary file to upload', required=True)
298299
required_upload.add_argument('--verbose', action='store_true', help='Enable verbose logging')
299300
parser_upload.set_defaults(func=parser_upload_func)

0 commit comments

Comments
 (0)