Leer la tabla de particiones de los ESP32 ya desplegados antes de activar OTA
Traducido del English por IA ·
Tenemos 31 placas ESP32-WROOM-32 en remolques refrigerados que envían temperaturas a Hermetry por MQTT. El firmware es nuestro, compilado con Arduino core 2.x. Nos gustaría empezar a usar las actualizaciones de firmware de Hermetry en lugar de desplazarnos al depósito con un portátil.Problema: las primeras 12 placas fueron flasheadas por un contratista y nadie anotó qué esquema de particiones eligió. Nuestra compilación actual ocupa unos 1,4 MB. Si algunas placas se flashearon con una única partición de aplicación grande, OTA no tendrá dónde escribir, y prefiero saberlo antes de asignar nada y ver cómo la mitad de la flota pasa a Failed.¿Hay alguna forma de leer la tabla de particiones de una placa en funcionamiento sin volver a flashearla? Idealmente de forma remota, ya que los remolques están repartidos en tres depósitos.
We have 31 ESP32-WROOM-32 boards in refrigerated trailers reporting temperatures to Hermetry over MQTT. Firmware is ours, built with Arduino core 2.x. We’d like to start using Hermetry’s firmware updates instead of driving to the depot with a laptop.
Problem: the first 12 boards were flashed by a contractor and nobody wrote down which partition scheme he picked. Our current build is about 1.4 MB. If some boards were flashed with a single big app partition, OTA has nowhere to write to and I’d rather know that before I assign anything and watch half the fleet go to Failed.
Is there a way to read the partition table of a running board without reflashing it? Ideally remotely, since the trailers are spread over three depots.
Traducido del English por IA ·
¿esptool read_flash en 0x8000?
esptool read_flash at 0x8000?
Traducido del English por IA ·
Eso necesita USB, sin embargo. Los trailers están fuera la mayor parte de la semana.
That needs USB though. The trailers are out most of the week.
Traducido del English por IA ·
No es tu pregunta, pero ya que estás en ello: registra una clave de firma y deja desactivada la opción «Permitir imágenes sin firma» en ese perfil. Las imágenes sin firma son solo para dispositivos de prueba, y los remolques en la carretera no son dispositivos de prueba.
Not your question, but while you’re at it: register a signing key and keep «Allow unsigned images» off on that profile. Unsigned is meant for test devices only, and trailers on the road aren’t test devices.
Traducido del English por IA ·
Tuve exactamente esta situación con placas de contadores que instaló un contratista. Puedes preguntarle al firmware que está corriendo: la API de particiones de ESP-IDF funciona bien desde el core de Arduino. Sube un build a las placas a las que puedas acceder (las de tu propio lote), o espera a que las demás estén en el depósito; reportará la tabla como atributos de cliente una vez después de conectarse:
#include "esp_partition.h"
void reportPartitions() {
String json = "{";
esp_partition_iterator_t it =
esp_partition_find(ESP_PARTITION_TYPE_ANY, ESP_PARTITION_SUBTYPE_ANY, NULL);
bool first = true;
while (it != NULL) {
const esp_partition_t *p = esp_partition_get(it);
if (!first) json += ",";
json += ""part." + String(p->label) + "":"" +
String(p->address, HEX) + "/" + String(p->size) + """;
first = false;
it = esp_partition_next(it);
}
esp_partition_iterator_release(it);
json += "}";
mqtt.publish("v1/attributes", json.c_str());
}
Luego, en la pestaña Attributes, ámbito Client, verás part.app0, part.app1, part.otadata y demás por placa. Lo que quieres ver son dos slots de aplicación (ota_0 y ota_1, llamados app0/app1 en las tablas de Arduino) más otadata, cada uno al menos tan grande como tu imagen. Si ves un solo app0 de 3 MB y ningún app1, es el esquema «Huge APP», no es posible OTA.Para las placas a las que no puedes enviar un build nuevo, el método de emily funciona en el depósito:
esptool.py --port /dev/ttyUSB0 read_flash 0x8000 0xc00 pt.bin
python gen_esp32part.py pt.bin
Las placas con el esquema equivocado necesitan un reflasheo único por USB con una tabla de dos slots. Después, OTA funciona para siempre.
Had this exact situation with meter boards a contractor did. You can ask the running firmware: the partition API in ESP-IDF works fine from the Arduino core. Push one build to the boards you can reach (the ones from your own batch), or wait until the others are at the depot, that reports the table as client attributes once after connecting:
#include "esp_partition.h"
void reportPartitions() {
String json = "{";
esp_partition_iterator_t it =
esp_partition_find(ESP_PARTITION_TYPE_ANY, ESP_PARTITION_SUBTYPE_ANY, NULL);
bool first = true;
while (it != NULL) {
const esp_partition_t *p = esp_partition_get(it);
if (!first) json += ",";
json += ""part." + String(p->label) + "":"" +
String(p->address, HEX) + "/" + String(p->size) + """;
first = false;
it = esp_partition_next(it);
}
esp_partition_iterator_release(it);
json += "}";
mqtt.publish("v1/attributes", json.c_str());
}
Then the Attributes tab, Client scope, shows part.app0, part.app1, part.otadata and so on per board. What you want to see is two app slots (ota_0 and ota_1, called app0/app1 in the Arduino tables) plus otadata, each at least as big as your image. If you see one app0 of 3 MB and no app1, that’s the «Huge APP» scheme, no OTA possible.
For the boards you can’t get a new build on, emily’s way works at the depot:
esptool.py --port /dev/ttyUSB0 read_flash 0x8000 0xc00 pt.bin
python gen_esp32part.py pt.bin
Boards with the wrong scheme need one USB reflash with a two-slot table. After that OTA works for good.
Traducido del English por IA ·
Hecho. 9 de los 12 del contratista devolvieron una única app0 de 3 MB, así que en esos no hay OTA sin una visita. Los otros 3 y todos los nuestros tienen app0/app1 de 1,25 MB cada una, lo cual es justo para nuestra compilación de 1,4 MB, así que estoy cambiando nuestra tabla a la versión mínima con SPIFFS y slots de 1,9 MB antes de seguir. Menos mal que lo comprobamos primero.
Done. 9 of the contractor’s 12 came back with a single 3 MB app0, so no OTA on those without a visit. The other 3 and all of ours have app0/app1 at 1.25 MB each, which is tight against our 1.4 MB build, so I’m switching our table to the minimal SPIFFS one with 1.9 MB slots before we go further. Good thing we checked first.
Traducido del English por IA ·
Como la persona que aprueba las visitas al depósito: por favor, revisa esto antes de que se flashee el próximo lote.
As the one who signs off on the depot visits: please check this before the next batch gets flashed.
- Debes estar registrado para responder a este debate.
Únete a la conversación
Inicia sesión para preguntar y responder, dar me gusta a las publicaciones útiles y marcar la respuesta que resolvió tu problema. Cada aportación suma puntos y niveles.

