Files
earlephilhower_arduino-pico/libraries/PicoOTA/examples/OTAfromFile/OTAfromFile.ino
T
Earle F. Philhower, III f6973fc64d Add RISC-V support, GCC 14 move (#2491)
* Adds RISC-V compilation option to the IDE and Platform.IO.
* Build RP2350-RISCV libpico, libbearssl
* Fix RP2350 BearSSL library (was copied from RP2040, now built for M33)
* New GCC 14.2 toolchain is required (12.4 RISC-V support is borked)
* Newlib locking fixed prototypes
* Manually force all runtime init code into RP2350 binaries
* Add RISC-V to CI
* Remove RP2350 BOOT2.S files, binaries (not used)
* Clean up minor GCC 14.x warnings
* Add RP2350-RISCV OTA build, link
* Add RISC-V FreeRTOS files (configuration still not running, but builds)
* Add basic documentation
2024-09-29 15:10:36 -07:00

42 lines
1.2 KiB
Arduino

// This example overwrites itself with a serial blinker sketch using OTA
// In general, you will get a file from the Internet, over a serial port, etc.
// and not include it in a header like we do here for simplicity.
//
// You need to have at least 256K of filesystem configured in
// Tools->Flash Size
//
// Released to the public domain August 2022 by Earle F. Philhower, III
#include <PicoOTA.h>
#include <LittleFS.h>
#include "blink_100_1000_rp2040.h"
#include "blink_500_500_rp2350.h"
#include "blink_250_250_rp2350-riscv.h"
void setup() {
Serial.begin(115200);
delay(5000);
Serial.printf("Writing OTA image of blinker...");
LittleFS.begin();
File f = LittleFS.open("blink.bin", "w");
if (sizeof(blink) != f.write(blink, sizeof(blink))) {
Serial.printf("Unable to write OTA binary. Is the filesystem size set?\n");
return;
}
f.close();
Serial.printf("done\n\n");
Serial.printf("Programming OTA commands...");
picoOTA.begin();
picoOTA.addFile("blink.bin");
picoOTA.commit();
LittleFS.end();
Serial.printf("done\n\n");
Serial.printf("Rebooting in 5 seconds, should begin blinker instead of this app...\n");
delay(5000);
rp2040.reboot();
}
void loop() {
}