I have seen a couple entries but did not feel it was answered (or maybe I just hoped there was a “new answer”).
I have the situation where I am flashing a bunch of processors (most of them virgin). In my old Visual Studio there was an UPLOAD option which took the most recent build and the current platform and port - and just transferred the code.
As best I can see - this works the same as the Arduino (and others) - of doing a code compile validation and then uploads - it works and is fine - just hoping there is a simple way within the IDE to “just upload”.
I know I can use the HEX file and external program - but was hoping for a simpler solution.
I’m not sure what your requirements are. You want an upload button which does not compile the firmware but instantly uploads? (btw, if there are no source code changes, PlatformIO will not recompile a source file and just upload).
If you want a faster upload method then a small custom script which invokes the upload program might be best for you. What board are you using?
There’s no just upload whatever was last built option… ) Ignore me… see next post.
It comes down to a question of ‘what are you trying to achieve’ … as for me, doing a build without changing code takes a whopping 1.040 seconds … so about 1.5 seconds after me hitting the upload button, PlatformIO will be trying to upload the code, if it hasn’t been changed since the last build. If you needed upload only, that is a bit too specific, and as @maxgerhardt pointed out, is best done with a custom script… which could possibly be just a matter of coping the actual upload command from a ‘verbose upload’ run into a script and running that on demand…
I have multiple reasons to get upload working without compile, but the above command does not seem to work for the Arduino UNO either for local or remote projects.
If I do a normal upload then change the main.cpp and run the above command what gets uploaded is always the new version. Makes sense for the default to always be the latest build however I would really like to be able to use the upload command with a pre-compiled build.
I have looked into advanced scripting but nothing seems to be an easy solution.
Thank you so much @maxgerhardt for that complete reply. It works local but not remote for me on Gitpod cloud.
I have been having a few VSCode setup issues (Great on my windows 10 laptop, bad on my windows 10 desktop) so it is really helpful seeing working code. I will file an issue, but only for the remote command. Your code and my own testing shows it works fine for a local VS code build. I am only having problems with my remote build
The following does not work for me running Platformio on a Gitpod Cloud docker github of it here
pio remote run -t nobuild -t upload
.
The following works fine on a local computer running VS Code
pio run -t nobuild -t upload
So I guess I now need someone with a cloud setup to test if “pio remote run -t nobuild -t upload” works for them.
On second thought I might be able to use 2 local computers to test out a remote build. Back in a bit.
.
So running VS-Code local on a windows machine with
pio account login
pio remote agent start
Then on a ubuntu laptop running VS-Code after changing your code to version 2! (By the way I used 9600 for the serial baud rate)
pio account login
pio remote run -t nobuild -t upload
I get serial output of
Version 2!
So it looks like the problem is with “pio remote run” not just on the Gitpod cloud platform. Can someone else confirm this?
Hi @ivankravets,
I apologize for digging out such old thread.
Command line pio run -t nobuild -t upload works as expected.
Is there a method to configure PIO extension with bold arrow button in lower bar of the VS code to work the same way as the command above?
Currently, I see in tasks.json:
Not sure about being able to modify the build button’s actions, but you can definitely following the example here to create a command shortcu for pio run -t nobuild -t upload and have it appear as a custom target in the project task window in VSCode.
Thanks, Maximillian.
Reading more docs hints that the “upload” button runs “pio run” with target “-t upload”. I wonder if it’s possible to add another target “-t nobuild” to the same task?
Merry Christmas!