From 0a6a5fe36017b327e3d5d84b8b3ee72b30f28205 Mon Sep 17 00:00:00 2001 From: Daniele Lacamera Date: Thu, 20 Aug 2026 22:41:25 +0200 Subject: [PATCH] F-7381: fail SAMA5D3 NAND write/erase instead of reporting success ext_flash_write() and ext_flash_erase() discarded their arguments and returned 0, so any update flow that reaches this HAL was told an erase/program succeeded while the NAND contents were left untouched. NAND page program and block erase are not implemented for this target; report failure so callers that branch on the result can detect it instead of continuing with a write that never happened. The read-only boot path is unaffected. --- hal/sama5d3.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/hal/sama5d3.c b/hal/sama5d3.c index 613173c1..d572696a 100644 --- a/hal/sama5d3.c +++ b/hal/sama5d3.c @@ -708,20 +708,23 @@ static void dbgu_init(void) { int ext_flash_write(uintptr_t address, const uint8_t *data, int len) { - /* TODO */ + /* SAMA5D3 NAND page program is not implemented: this HAL only + * supports reading NAND. Report failure instead of pretending the + * data was programmed. */ (void)address; (void)data; (void)len; - return 0; + return -1; } int ext_flash_erase(uintptr_t address, int len) { - /* TODO */ + /* SAMA5D3 NAND block erase is not implemented: see ext_flash_write. */ (void)address; (void)len; - return 0; + + return -1; } /* SAMA5D3 NAND flash does not have an enable pin */