|
206 | 206 | # |
207 | 207 | # Target: Disable / Enable / Check Code Read Protection, Erase |
208 | 208 | # |
209 | | -def generate_minichlink_action(args: List[str], action_name:str): |
210 | | - wchisp_path = os.path.join( |
| 209 | +def generate_minichlink_action(args: List[str], action_name:str, upload_protocol_is_minichlink: bool): |
| 210 | + minichlink_path = os.path.join( |
211 | 211 | platform.get_package_dir("tool-minichlink") or "", |
212 | 212 | "minichlink" |
213 | 213 | ) |
214 | | - cmd = ["\"%s\"" % wchisp_path] |
215 | | - cmd.append("$UPLOADERFLAGS") |
| 214 | + cmd = ["\"%s\"" % minichlink_path] |
| 215 | + # we don't want uploader flags pertaining to other uploaders like wch-linke. |
| 216 | + if upload_protocol_is_minichlink: |
| 217 | + cmd.append("$UPLOADERFLAGS") |
216 | 218 | cmd.extend(args) |
| 219 | + # print("Returning action: " + str(cmd)) |
217 | 220 | return env.VerboseAction(" ".join(cmd), action_name) |
218 | 221 |
|
219 | 222 | def generate_wlink_action(args: List[str], action_name:str): |
@@ -337,24 +340,25 @@ def generate_openocd_action(args: List[str], action_name:str): |
337 | 340 | "Reset (ISP)" |
338 | 341 | ) |
339 | 342 | # make minichlink SDI printf monitor show up even when it's not the selected upload protocol |
| 343 | +is_minichlink = upload_protocol == "minichlink" |
340 | 344 | if upload_protocol == "minichlink" or "ch32v003fun" in frameworks or len(frameworks) == 0: |
341 | 345 | env.AddPlatformTarget( |
342 | 346 | "sdi_printf_monitor", None, generate_minichlink_action([ |
343 | 347 | "-T" |
344 | | - ], "Starting SDI Printf Monitor"), |
| 348 | + ], "Starting SDI Printf Monitor", is_minichlink), |
345 | 349 | "Monitor SDI Printf (ch32v003fun)" |
346 | 350 | ) |
347 | 351 | if upload_protocol == "minichlink": |
348 | 352 | env.AddPlatformTarget( |
349 | 353 | "enable_flash_protection", None, generate_minichlink_action([ |
350 | 354 | "-P" |
351 | | - ], "Enabling Flash Protection"), |
| 355 | + ], "Enabling Flash Protection", is_minichlink), |
352 | 356 | "Enable Flash Protection" |
353 | 357 | ) |
354 | 358 | env.AddPlatformTarget( |
355 | 359 | "disable_flash_protection", None, generate_minichlink_action([ |
356 | 360 | "-p" |
357 | | - ], "Disabling Flash Protection"), |
| 361 | + ], "Disabling Flash Protection", is_minichlink), |
358 | 362 | "Disable Flash Protection" |
359 | 363 | ) |
360 | 364 |
|
|
0 commit comments