Disable Flash reset on ISP upload

This commit is contained in:
GHOSCHT 2021-08-26 18:48:24 +02:00
parent c10494dd8f
commit 9955e70611
2 changed files with 164 additions and 162 deletions

View file

@ -1,86 +1,87 @@
[platformio] [platformio]
default_envs = Upload_UART ; Default build target default_envs = Upload_UART ; Default build target
; Common settings for all environments ; Common settings for all environments
[env] [env]
platform = atmelavr platform = atmelavr
framework = arduino framework = arduino
; TARGET SETTINGS ; TARGET SETTINGS
; Chip in use ; Chip in use
board = ATmega328P board = ATmega328P
; Clock frequency in [Hz] ; Clock frequency in [Hz]
board_build.f_cpu = 16000000L board_build.f_cpu = 16000000L
; BUILD OPTIONS ; BUILD OPTIONS
; Comment out to enable LTO (this line unflags it) ; Comment out to enable LTO (this line unflags it)
build_unflags = -flto build_unflags = -flto
; Extra build flags ; Extra build flags
build_flags = build_flags =
; SERIAL MONITOR OPTIONS ; SERIAL MONITOR OPTIONS
; Serial monitor port defined in the Upload_UART environment ; Serial monitor port defined in the Upload_UART environment
monitor_port = ${env:Upload_UART.upload_port} monitor_port = ${env:Upload_UART.upload_port}
; Serial monitor baud rate ; Serial monitor baud rate
monitor_speed = 9600 monitor_speed = 9600
; Run the following command to upload with this environment ; Run the following command to upload with this environment
; pio run -e Upload_UART -t upload ; pio run -e Upload_UART -t upload
[env:Upload_UART] [env:Upload_UART]
; Serial bootloader protocol ; Serial bootloader protocol
upload_protocol = arduino upload_protocol = arduino
; Serial upload port ; Serial upload port
upload_port = COM4 upload_port = COM4
; Get upload baud rate defined in the fuses_bootloader environment ; Get upload baud rate defined in the fuses_bootloader environment
board_upload.speed = ${env:fuses_bootloader.board_bootloader.speed} board_upload.speed = ${env:fuses_bootloader.board_bootloader.speed}
[env:Upload_UART_Forwarded] [env:Upload_UART_Forwarded]
; Serial bootloader protocol ; Serial bootloader protocol
upload_protocol = custom upload_protocol = custom
; Serial upload port ; Serial upload port
upload_port = COM5 upload_port = COM5
; Get upload baud rate defined in the fuses_bootloader environment ; Get upload baud rate defined in the fuses_bootloader environment
board_upload.speed = ${env:fuses_bootloader.board_bootloader.speed} board_upload.speed = ${env:fuses_bootloader.board_bootloader.speed}
upload_flags = upload_flags =
-C$PROJECT_PACKAGES_DIR/tool-avrdude/avrdude.conf -C$PROJECT_PACKAGES_DIR/tool-avrdude/avrdude.conf
-p$BOARD_MCU -p$BOARD_MCU
-P${env:Upload_UART.upload_port} -P${env:Upload_UART.upload_port}
-carduino -carduino
-v -v
-V -V
-D -D
upload_command = python switchDevice.py ${env:Upload_UART_Forwarded.upload_port} && avrdude $UPLOAD_FLAGS -U flash:w:$SOURCE:i upload_command = python switchDevice.py ${env:Upload_UART_Forwarded.upload_port} && avrdude $UPLOAD_FLAGS -U flash:w:$SOURCE:i
; Run the following command to upload with this environment ; Run the following command to upload with this environment
; pio run -e Upload_ISP -t upload ; pio run -e Upload_ISP -t upload
[env:Upload_ISP] [env:Upload_ISP]
; Custom upload procedure ; Custom upload procedure
upload_protocol = custom upload_protocol = custom
; Avrdude upload flags ; Avrdude upload flags
upload_flags = upload_flags =
-C$PROJECT_PACKAGES_DIR/tool-avrdude/avrdude.conf -C$PROJECT_PACKAGES_DIR/tool-avrdude/avrdude.conf
-p$BOARD_MCU -p$BOARD_MCU
-PUSB -PUSB
-cusbasp -cusbasp
; Avrdude upload command -D
upload_command = avrdude $UPLOAD_FLAGS -U flash:w:$SOURCE:i ; Avrdude upload command
upload_command = avrdude $UPLOAD_FLAGS -U flash:w:$SOURCE:i
; Run the following command to set fuses
; pio run -e fuses_bootloader -t fuses ; Run the following command to set fuses
; Run the following command to set fuses + burn bootloader ; pio run -e fuses_bootloader -t fuses
; pio run -e fuses_bootloader -t bootloader ; Run the following command to set fuses + burn bootloader
[env:fuses_bootloader] ; pio run -e fuses_bootloader -t bootloader
board_hardware.oscillator = external ; Oscillator type [env:fuses_bootloader]
board_hardware.uart = uart0 ; Set UART to use for serial upload board_hardware.oscillator = external ; Oscillator type
board_bootloader.speed = 115200 ; Set bootloader baud rate board_hardware.uart = uart0 ; Set UART to use for serial upload
board_hardware.bod = 2.7v ; Set brown-out detection board_bootloader.speed = 115200 ; Set bootloader baud rate
board_hardware.eesave = yes ; Preserve EEPROM when uploading using programmer board_hardware.bod = 2.7v ; Set brown-out detection
upload_protocol = usbasp ; Use the USBasp as programmer board_hardware.eesave = yes ; Preserve EEPROM when uploading using programmer
upload_flags = ; Select USB as upload port and divide the SPI clock by 8 upload_protocol = usbasp ; Use the USBasp as programmer
-PUSB upload_flags = ; Select USB as upload port and divide the SPI clock by 8
-B8 -PUSB
-B8

View file

@ -1,76 +1,77 @@
[platformio] [platformio]
default_envs = Upload_UART ; Default build target default_envs = Upload_UART ; Default build target
; Common settings for all environments ; Common settings for all environments
[env] [env]
platform = atmelavr platform = atmelavr
framework = arduino framework = arduino
; TARGET SETTINGS ; TARGET SETTINGS
; Chip in use ; Chip in use
board = ATmega328P board = ATmega328P
; Clock frequency in [Hz] ; Clock frequency in [Hz]
board_build.f_cpu = 16000000L board_build.f_cpu = 16000000L
; BUILD OPTIONS ; BUILD OPTIONS
; Comment out to enable LTO (this line unflags it) ; Comment out to enable LTO (this line unflags it)
build_unflags = -flto build_unflags = -flto
; Extra build flags ; Extra build flags
build_flags = build_flags =
; SERIAL MONITOR OPTIONS ; SERIAL MONITOR OPTIONS
; Serial monitor port defined in the Upload_UART environment ; Serial monitor port defined in the Upload_UART environment
monitor_port = ${env:Upload_UART.upload_port} monitor_port = ${env:Upload_UART.upload_port}
; Serial monitor baud rate ; Serial monitor baud rate
monitor_speed = 9600 monitor_speed = 9600
; Run the following command to upload with this environment ; Run the following command to upload with this environment
; pio run -e Upload_UART -t upload ; pio run -e Upload_UART -t upload
[env:Upload_UART] [env:Upload_UART]
; Serial bootloader protocol ; Serial bootloader protocol
upload_protocol = custom upload_protocol = custom
; Serial upload port ; Serial upload port
upload_port = COM5 upload_port = COM5
; Get upload baud rate defined in the fuses_bootloader environment ; Get upload baud rate defined in the fuses_bootloader environment
board_upload.speed = ${env:fuses_bootloader.board_bootloader.speed} board_upload.speed = ${env:fuses_bootloader.board_bootloader.speed}
upload_flags = upload_flags =
-C$PROJECT_PACKAGES_DIR/tool-avrdude/avrdude.conf -C$PROJECT_PACKAGES_DIR/tool-avrdude/avrdude.conf
-p$BOARD_MCU -p$BOARD_MCU
-P${env:Upload_UART.upload_port} -P${env:Upload_UART.upload_port}
-carduino -carduino
-v -v
-V -V
-D -D
upload_command = python enableReset.py ${env:Upload_UART.upload_port} && avrdude $UPLOAD_FLAGS -U flash:w:$SOURCE:i upload_command = python enableReset.py ${env:Upload_UART.upload_port} && avrdude $UPLOAD_FLAGS -U flash:w:$SOURCE:i
; Run the following command to upload with this environment ; Run the following command to upload with this environment
; pio run -e Upload_ISP -t upload ; pio run -e Upload_ISP -t upload
[env:Upload_ISP] [env:Upload_ISP]
; Custom upload procedure ; Custom upload procedure
upload_protocol = custom upload_protocol = custom
; Avrdude upload flags ; Avrdude upload flags
upload_flags = upload_flags =
-C$PROJECT_PACKAGES_DIR/tool-avrdude/avrdude.conf -C$PROJECT_PACKAGES_DIR/tool-avrdude/avrdude.conf
-p$BOARD_MCU -p$BOARD_MCU
-PUSB -PUSB
-cusbasp -cusbasp
; Avrdude upload command -D
upload_command = avrdude $UPLOAD_FLAGS -U flash:w:$SOURCE:i ; Avrdude upload command
upload_command = avrdude $UPLOAD_FLAGS -U flash:w:$SOURCE:i
; Run the following command to set fuses
; pio run -e fuses_bootloader -t fuses ; Run the following command to set fuses
; Run the following command to set fuses + burn bootloader ; pio run -e fuses_bootloader -t fuses
; pio run -e fuses_bootloader -t bootloader ; Run the following command to set fuses + burn bootloader
[env:fuses_bootloader] ; pio run -e fuses_bootloader -t bootloader
board_hardware.oscillator = external ; Oscillator type [env:fuses_bootloader]
board_hardware.uart = uart0 ; Set UART to use for serial upload board_hardware.oscillator = external ; Oscillator type
board_bootloader.speed = 115200 ; Set bootloader baud rate board_hardware.uart = uart0 ; Set UART to use for serial upload
board_hardware.bod = 2.7v ; Set brown-out detection board_bootloader.speed = 115200 ; Set bootloader baud rate
board_hardware.eesave = yes ; Preserve EEPROM when uploading using programmer board_hardware.bod = 2.7v ; Set brown-out detection
upload_protocol = usbasp ; Use the USBasp as programmer board_hardware.eesave = yes ; Preserve EEPROM when uploading using programmer
upload_flags = ; Select USB as upload port and divide the SPI clock by 8 upload_protocol = usbasp ; Use the USBasp as programmer
-PUSB upload_flags = ; Select USB as upload port and divide the SPI clock by 8
-B8 -PUSB
-B8