Skip to content

Info: PlatformIO, Arduino Mega, build & upload OTA #29

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
pantata opened this issue Jun 8, 2020 · 9 comments
Closed

Info: PlatformIO, Arduino Mega, build & upload OTA #29

pantata opened this issue Jun 8, 2020 · 9 comments

Comments

@pantata
Copy link

pantata commented Jun 8, 2020

Tested for macOS.

  1. add to platformio.ini
 extra_scripts = post:extra_scripts.py
 upload_protocol = custom
 upload_flags =
   http://arduino:password@ip_address:65280/sketch
  1. write extra_scripts.py next to platform.ini
Import("env", "projenv")

env.Replace(    
    UPLOADCMD="curl --request POST --data-binary @\"$BUILD_DIR\"${PROGNAME}.bin $UPLOADERFLAGS"
)

env.AddPostAction(
    "$BUILD_DIR/${PROGNAME}.elf",
    env.VerboseAction(" ".join([
        "$OBJCOPY", "-O", "binary",
        "\"$BUILD_DIR\"/${PROGNAME}.elf", "\"$BUILD_DIR\"${PROGNAME}.bin"
    ]), "Building $BUILD_DIR/${PROGNAME}.bin")
)

LS.

@JAndrassy
Copy link
Owner

platform.io doesn't process platform.local.txt copied from extras folder next to platform.txt?

@pantata
Copy link
Author

pantata commented Jun 8, 2020 via email

@JAndrassy
Copy link
Owner

JAndrassy commented Jun 9, 2020

nieco ako
packages/arduino/tools/arduinoOTA/1.3.0/bin

@pantata
Copy link
Author

pantata commented Jun 9, 2020

Neni tam. A jak se divam do kodu build scriptu main.py a arduino.py, tak mi pripada, ze to konfigurace desek a programatoru bere z vlastnich json souboru a ne z boards.txt.

V kazdem pripade, to co jsem postnul nahore funguje, jeste to asi pujde zjednodusit pomoci UPLOAD_COMMAND primo v platformio.ini projektu (vyzkousim vecer).

@JAndrassy
Copy link
Owner

to summarize in english, platformio doesn't use the platform.txt file of Arduino boards packages

@maxgerhardt
Copy link

For reference: I did build a reference PlatformIO + ESP32 + Ethernet (W5500) + OTA demo here: https://github.com/maxgerhardt/pio-esp32-ethernet-ota

For ESP32 it also seems that the Ethernet library needs some extra fixes (ref) in the latest version, which I have included my version.

Also @JAndrassy, where's the magical arduinoOTA binary?

https://github.com/jandrassy/ArduinoOTA/blob/ffb0d462d8e961ed52920fa8775cda3e0d3078c7/extras/esp32/platform.local.txt#L4

I coudln't find it in https://github.com/espressif/arduino-esp32/.

Calling into curl is not the best way yet to add PlatformIO integration, since we cannot assume that to be installed (especially not on Windows). A general Python script would be better. I guess a script using python-requests could be built that simply executes the POST request like CURL does?

@JAndrassy
Copy link
Owner

JAndrassy commented Jun 29, 2020

Also @JAndrassy, where's the magical arduinoOTA binary?

https://github.com/jandrassy/ArduinoOTA/blob/ffb0d462d8e961ed52920fa8775cda3e0d3078c7/extras/esp32/platform.local.txt#L4

I coudln't find it in https://github.com/espressif/arduino-esp32/.

in ArduinoIDE and in Eclipse the upload tool is installed with Arduino's AVR and SAMD boards packages. the AVR boards package is bundled with IDE so the tool is always there.

@JAndrassy
Copy link
Owner

this library was on my request removed from PlatformIO library register

@pscott-ams
Copy link

For reference: I did build a reference PlatformIO + ESP32 + Ethernet (W5500) + OTA demo here: https://github.com/maxgerhardt/pio-esp32-ethernet-ota

@maxgerhardt I've posted an issue on your github page about not being able to connect to the IP/port when trying to upload with OTA. Could you take a look at it please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants