Add UART OTA upload with A/B partition support.

Firmware buffers 200-byte chunks into 4 KiB blocks for esp_ota_write; goTool
uploads with per-block ACK flow control and larger UART buffers to avoid stalls.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-05-19 00:39:59 +02:00
co-authored by Cursor
parent 1ad527119d
commit 59ca269407
20 changed files with 806 additions and 101 deletions
+4 -4
View File
@@ -32,9 +32,9 @@ static bool uart_enqueue_packet(const uart_packet_t *packet) {
memcpy(msg.payload, &packet->payload[1], msg.len);
}
if (xQueueSend(uart_cmd_queue, &msg, 0) != pdPASS) {
if (xQueueSend(uart_cmd_queue, &msg, pdMS_TO_TICKS(500)) != pdPASS) {
free(msg.payload);
ESP_LOGW(TAG, "command queue full");
ESP_LOGW(TAG, "command queue full (cmd 0x%02x)", (unsigned)msg.msg_id);
return false;
}
return true;
@@ -52,7 +52,7 @@ void init_uart(QueueHandle_t cmd_queue) {
.flow_ctrl = UART_HW_FLOWCTRL_DISABLE,
};
err = uart_driver_install(UART_NUM, UART_BUF_SIZE * 2, 0, 0, NULL, 0);
err = uart_driver_install(UART_NUM, UART_BUF_SIZE * 2, UART_BUF_SIZE, 0, NULL, 0);
if (err != ESP_OK) {
ESP_LOGE(TAG, "uart_driver_install failed: %s", esp_err_to_name(err));
return;
@@ -69,7 +69,7 @@ void init_uart(QueueHandle_t cmd_queue) {
return;
}
if (xTaskCreate(uart_read_task, "uart_rx", 4096, NULL, 1, NULL) != pdPASS) {
if (xTaskCreate(uart_read_task, "uart_rx", 4096, NULL, 5, NULL) != pdPASS) {
ESP_LOGE(TAG, "failed to create uart_read_task");
}
}