Flash via tcp to uart bridge

To upload firmware.hex to an Uno attached to “SERIALPORT” I can:
$ avrdude -DV -p atmega328p -P /dev/SERIALPORT -c arduino -b115200 -U flash:w:firmware.hex:i
For a while, I have been using an esp01 module at “IPADDRESS” flashed with the JeeLabs esp-link firmware to wirelessly program arduino mounted on my robot.
Avrdude very easily adapts to this workflow:
$ avrdude -DV -p atmega328p -P net:*IPADDRESS*:23 -c arduino -b115200 -U flash:w:firmware.hex:i
This works flawlessly.
As you can see all that has changed is the -P (port) parameter.

BUT

PLATFORMIO is so cool and I love the community around it, it’s the tool I want to be using for my projects, so I am sure it can incorporate the same thing (without complicated workarounds like pseudo ttys, socat etc), yet I can’t find any docs about it:
on a simple arduino platformio project why can’t I just set the upload_port to “net:IPADDRESS:port” to obtain the same result? It seems to me that PIO uses avrdude anyway, so why can’t the upload_port parameter be passed as is? I have been messing around for hours trying to hack this out myself, but I don’t seem to be very good at reading Python yet, the way PIO runs all of its scripts is still very obscure to me…

Thanks for reading, please help

  • Seb
1 Like

That is not easy what you have described. It requires direct access to the board that is not available when board is located behind NAT.

What do you need is called “PIO Remote”. This is a premium feature from https://pioplus.com. PIO Remote can be used for Cloud IDEs and any other Over-The-Air use cases.

It has not been released officially. If you would like to try the latest development version (a few developers use it), I can explain you how to try it totally for free.

What I am saying is avrdude supports this out of the box, why can’t PIO simply let avrdude do the uploading?

You need to have avrdude as a “server” on the other side with a keep-alive connection. Who will support that?

this firmware on my esp01 module must be doing exactly that?

This actually works, tested myself, just by pointing standard avrdude to the IP address!

If PIO uses avrdude to flash an Arduino uno anyway, why can’t I point it to the IP address in exactly the same way? (all my attempts give a “could not open port” error).
(I am only assuming PIO uses avrdude, am I wrong?)

IP address of what?

PIO uses avrdude only Atmel AVR development platform.

IP address of the esp01 module running the esp-link tcp-uart bridge connected to the same wifi network as the computer I execute avrdude from.

Any progress on this? In the same situation, should be a simple patch - anybody made one yet?

Workaround: edit boards file and add:
"disable_flushing": true,

tested with boards file: .platformio/platforms/atmelavr/boards/pro8MHzatmega328.json

I also proposed a patch here Support net: upload port by freynder · Pull Request #45 · platformio/platform-atmelavr · GitHub .