From f68ef2e8009a78004b0701e1c7369acfa2df46ad Mon Sep 17 00:00:00 2001 From: Gergely Bencsik Date: Mon, 9 Mar 2026 16:12:55 +0100 Subject: [PATCH] OTA progress stub --- include/mios/ota.h | 7 +++++++ src/net/service/svc_ota.c | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/include/mios/ota.h b/include/mios/ota.h index 801c669a..8bb73b70 100644 --- a/include/mios/ota.h +++ b/include/mios/ota.h @@ -36,6 +36,13 @@ struct stream *ota_get_stream(void); */ error_t ota_prohibit_upgrade(void); +/* + * Optionally implemented by application to receive OTA progress updates. + * Called once per flash sector (4 kB) during the write phase. + * current_bytes: bytes written so far, total_bytes: total image size. + */ +void ota_progress(uint32_t current_bytes, uint32_t total_bytes); + /* * Write out a binary stream to spiflash and generate upgrade headers, etc diff --git a/src/net/service/svc_ota.c b/src/net/service/svc_ota.c index 9e67ad57..2d9045f5 100644 --- a/src/net/service/svc_ota.c +++ b/src/net/service/svc_ota.c @@ -12,6 +12,12 @@ #include #include #include +#include + +__attribute__((weak)) void +ota_progress(uint32_t current_bytes, uint32_t total_bytes) +{ +} #include "net/pbuf.h" @@ -141,6 +147,7 @@ ota_perform(svc_ota_t *sa) return err; } erased_sector = sector; + ota_progress(current_byte, total_bytes); } void *buf = pbuf_data(pb, 0);