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


#1

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.


#2

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: https://learn.adafruit.com/program-an-avr-or-arduino-using-raspberry-pi-gpio-pins/installation

Regards, Alex


#3

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.


#4

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.


#5

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 http://docs.platformio.org/en/stable/userguide/cmd_run.html#cmdoption-platformio-run--target


#6

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


#7

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


#8

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!


#9

You can connect via SSH to your local RPi and run PIO there via http://docs.platformio.org/en/latest/userguide/cmd_run.html.


#10

here my platform.ini looks l

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


#11

Do you mean?


#12

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,


#13

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


#14

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.