How to disable verify after upload?

Hi all,

In order to increase upload speeds when troubleshooting code, I’d like to disable verification after upload.

I’ve had a look and tried to configure this in .platformio\packages\framework-arduinoavr\platform.txt, but I’ve had no luck.

Can anyone point me in the right direction? Thanks!

See

For anyone in the future, the answers in this thread didn’t work for me, and this is the first hit that comes up in google when searching for the answer. I did find the answer and so id like to share it with anyone who needs a SIMPLE example.

It starts in platformio.ini, where you simply point to a python script that handles the upload, using the extra_scripts option as shown here (this is my whole platform.ini file - I included all of it just to show a real world example of how to do this. the only lines that matter for this purpose are the last three):

[env:nanoatmega328new]
platform = atmelavr
board = nanoatmega328new
framework = arduino
lib_extra_dirs = /Users/michael/Documents/Arduino/libraries
                 /Applications/Arduino.app/Contents/Java/libraries
                 /Users/michael/Documents/Arduino/libraries/Adafruit_BusIO
lib_ldf_mode = chain+
lib_compat_mode = soft

extra_scripts = /Users/michael/Documents/Arduino/PlatformIO_Configs/nano_upload.py
upload_protocol = custom
upload_port = /dev/cu.usbserial-14110

Then in the python script, you reference the upload port using Import then a method from it as you can see here.

Here is my extra_script called nano_upload.py

Import("env")

# Generic
env.Replace(
#    UPLOADER="executable or path to executable",
    UPLOADCMD="$UPLOADER $UPLOADERFLAGS $SOURCE"
)

# this line extracts the USB port from your platform.ini file
UPLOAD_PORT = env.get("UPLOAD_PORT")

# In-line command with arguments
env.Replace(
    UPLOADCMD="avrdude -p atmega328p -v -V -C /Users/michael/.platformio/packages/tool-avrdude/avrdude.conf -c arduino -b 115200 -D -P $UPLOAD_PORT -U flash:w:.pio/build/nanoatmega328new/firmware.hex:i"
)

The magic in not verifying the upload is the -V switch in the avrdude command.

And that’s it, it’s fairly straight forward and relatively simple to stop that annoying verification step after uploading.

Mike

The accepted solution post from this topic is 3 years old. Now we have better options like upload_flags and upload_command which do the same thing but don’t require that you add Python code to script it.

Have you tried something simple like adding

upload_flags = -V

to the platformio.ini or, in a more direct form,

upload_protocol = custom
upload_flags =
    -C
    $PROJECT_PACKAGES_DIR/tool-avrdude/avrdude.conf
    -p
    atmega328p
    -P
    $UPLOAD_PORT
    -b
    115200
    -c
    arduino
    -D 
    -v 
    -V
upload_command = avrdude $UPLOAD_FLAGS -U flash:w:$SOURCE:i

(If it cannot find the command avrdude, you may need to give it the full path as in $PROJECT_PACKAGES_DIR/tool-avrdude/avrdude/avrdude, optionally with .exe at the end for Windows)

1 Like

No, but I’m going to try that right now.

OK, I changed my platformio.ini file to this:

[env:nanoatmega328new]
platform = atmelavr
board = nanoatmega328new
framework = arduino
lib_extra_dirs = /Users/michael/Documents/Arduino/libraries
                 /Applications/Arduino.app/Contents/Java/libraries
                 /Users/michael/Documents/Arduino/libraries/Adafruit_BusIO
lib_ldf_mode = chain+
lib_compat_mode = soft
upload_port = /dev/cu.usbserial-14110
upload_protocol = custom
upload_flags =
    -p
    atmega328p
    -v
    -V
    -C
    $PROJECT_PACKAGES_DIR/tool-avrdude/avrdude.conf
    -c
    arduino
    -b
    115200
    -D
    -P
    $UPLOAD_PORT

upload_command = avrdude $UPLOAD_FLAGS -U flash:w:$SOURCE:i

without any reference to external scripts and it works PERFFECTLY!

THANK YOU!

NOW, do you know how I can make this platformio.ini file the default file anytime I create a new project?

Because that would bring this whole Platform.IO tool full circle for me. I use it in CLion and the process of writing code in CLion is light years beyond the Arduino IDE … contextual drop down of available class methods while you type … alone is worth the price of admission if you ask me.

Thanks again!

Mike

Hmm are you absolutely sure the first option doesn’t work too? Because when I do a verbose upload and see the avrdude invocation command, the -V is there so it looks all good, too

If you could only use this option then I’d be much easier to integrate in the projects you want, since it’s more compact.

To my knowledge that’s not possible in the IDE, after looking at possible environment variable settings that would affect every project generation. The command line usage of PIO would allow this via a pio project init -O "upload_flags = -V" command, for example (docs). The repository is always open for feature requests though – in this case however please double check if the shorter option doesn’t work too.

That’s how I see the things too :smiley:. Many people saying that when trying PlatformIO once after being in the Arduino IDE all the time, it’s a night and day difference ease of code writing and usage.

1 Like

OK, excellent point … just adding a single line and accomplishing the desired result would be nothing short of amazing … so, here is my new platformio.ini file and it still works WITHOUT external script reference and WITHOUT verifying the code once it’s uploaded:

[env:nanoatmega328new]
platform = atmelavr
board = nanoatmega328new
framework = arduino
lib_extra_dirs = /Users/michael/Documents/Arduino/libraries
/Applications/Arduino.app/Contents/Java/libraries
/Users/michael/Documents/Arduino/libraries/Adafruit_BusIO
lib_ldf_mode = chain+
lib_compat_mode = soft
upload_port = /dev/cu.usbserial-14110
upload_flags =
-V

This is great… and when you think about it, being able to just add a command line option to avrdude using a simple syntax like this … well … it just makes sense, doesn’t it?

And I was just looking at this post and notice is says you can incorporate your own ini file using the command

pio run -c custom_platformio.ini

But I have no idea if CLion creates Platform.io projects using the pio command or some other means … and then … how to find it and modify it … any ideas?