From 51d17a37f359201a85c3c5a2dae614896dfcd0ca Mon Sep 17 00:00:00 2001 From: miceuz Date: Thu, 15 Dec 2022 14:00:47 +0200 Subject: [PATCH] Add a board level config `upload.gpiostring` This config can be used to specify a custom reset method during serial upload. Example: ``` "upload": { "maximum_ram_size": 65536, "maximum_size": 262144, "protocol": "serial", "protocols": [ "dfu", "serial", "jlink", "stlink", "blackmagic" ], "gpiostring": "-dtr,-rts," ``` Fix #257 Also fix a small bug where 'False' would be inserted in case when tool-stm32duino package is not available. --amend --- builder/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/builder/main.py b/builder/main.py index 9125e69d..a76b0823 100644 --- a/builder/main.py +++ b/builder/main.py @@ -267,13 +267,13 @@ def __configure_upload_port(env): elif upload_protocol == "serial": def __configure_upload_port(env): return env.subst("$UPLOAD_PORT") - env.Replace( __configure_upload_port=__configure_upload_port, UPLOADER=join( - '"%s"' % platform.get_package_dir("tool-stm32duino") or "", + '"%s"' % (platform.get_package_dir("tool-stm32duino") or ""), "stm32flash", "stm32flash"), UPLOADERFLAGS=[ + "-i%s" % board.get("upload.gpiostring") if board.get("upload.gpiostring", False) else "", "-g", board.get("upload.offset_address", "0x08000000"), "-b", env.subst("$UPLOAD_SPEED") or "115200", "-w" ],