Can Platformio upload a firmware.hex file only? (uploading sketch to Arduino via Raspberry)

No luck with google and reading manuals, so here the question:

Platformio takes Sketch.ino and library files - all placed on the Rasberry, to compile the firmware.hex file, and then upload to an Arduino (platformio run --target upload). That works fine.
(and the the ‘clean’ command)

However I prefer to :
a. compile the large Arduino sketch (and a dozen large libraries) in my PC and create the firmware.hex file there,
b. then only send the hexfile to the remote Rasberry via Internet.
c. use SSH commands to let platformio upload the firmware.hex file, without local compiling.

Hello,

you can upload HEX files to your arduino with AVRDude. You could install it on your PI and write some scripts to get your idea working.

Here’s an example how you cna install AVRdude on your Pi: Installation | Program an AVR or Arduino Using Raspberry Pi GPIO | Adafruit Learning System

Regards, Alex

You need PlatformIO Remote. Just start Remote Agent on RPi and work with your project on PC or using Cloud IDE. No need to open SSH port or to be located in the same network. You can program your RPi from anywhere in the world.

Thanks for both suggestions, I will try out both.

The platformio plus option, is less attractive, as it requires internet as far as I understand.

In the countryside (in Chile) Internet is often a problem, relying on 3G modems, so one still has to go with PC to the field, connect to the router and upload arduino sketches via raspberries.

So a simple target /upload command on pio, that just takes the hex file and upload it, would still be nice.

Using avrdude requires more detailed knowhow and understanding of a load of parameters, which is an option, but Pio is suppossed to simplify these manual procedures. Maybe stuff for the pio team to consider.

Hi latin944,

I’m quite sure you can with Arduino, as I can do this for ESP8266.

You can build the project without uploading, and then copy the binaries (in my case it’s a .bin) and upload to device. Look at buildfs and uploadfs in Redirecting...

How to upload bin file, just upload to nodemcu
should I rename my file to fimware.bin?
and what code should i type?
i have compile the ino file on Arduino IDE and i need to upload the bin file separately
i have tried platformio run --target upload and it still do compiling
thanks before

What is your board? Could you share project platformio.ini?

I see the post I started is still of interest, but not solved…

For arduinos I create the .hex file with the standard arduino interface on my pc, then rename the fiile to firmware.hex, then upload it with another - non platformio - program to the arduino.

For the simple reason that I work in the field and work offline, and as far as I know, Platformio requires an active internet connection

@ivan Hope this can be solved one day!

You can connect via SSH to your local RPi and run PIO there via Redirecting....

here my platform.ini looks l

[env:nodemcu]
platform = espressif8266
board = nodemcu
framework = arduino
upload_port = 192.168.43.6

Do you mean?

Can PlatformIO upload bin/hex file to the board without rebuild from source code?
My PlatformIO on VSCode always re-build (or just re-link) the source code every time when I try to flash the firmware to the board.
I have the same problem like this on Arduino too.
The firmware has been compile completely into a bin file.
I just want to flash this bin firmware file to the board.
Can anybody give me some command line example?
The following are target board and firmware:
platform = espressif8266
framework = arduino
board = esp01_1m
board_flash_mode = dout
build_flags = -Wl,-Tesp8266.flash.1m0.ld -DMQTT_MAX_PACKET_SIZE=1000
lib_deps = PubSubClient, NeoPixelBus, IRremoteESP8266, ArduinoJSON
extra_scripts = pio/strip-floats.py

Thanks,

PlatformIO should rebuild project only if you change source file or modify dependent library.

Hello Latin944,

could you solve your OTA ?

I’m as well in a chilean countryside with very slow internet. I’m working on ESP32/ESP8266 and I want to trigger the upload via a MQTT message.

I struggled with this in the same manner. My raspberry is in the basement, connected to my arduino’s controlling lighting and heating.

The raspberry (even on the NFS share) is painfully slow to compile my code, takes around 3 mins.
When i compile on my laptop, and try to uload only on the RPI, it still compiles from scratch… Very annoying.

I have done some uploading in the past with avrdude, but also bricked a (clone) arduino to the point I had to use ISCP pins to revive it, so I’m not a fan of finding out the correct avrdude options.

What helped for me, is to compile/upload once with verbose mode enabled, and the complete avrdude syntax appears in the console (platformio run -t upload -v).

I just copied the line and saved it as a script. And now I compile the code on my laptop, and upload it from the RPI.

Also; the serial console from platformio is painfully slow to start, and I prefer to run the native python serial for debugging (miniterm.py).

HTH,
/steven