|
From: openocd-gerrit <ope...@us...> - 2026-10-16 07:36:54
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Main OpenOCD repository".
The branch, master has been updated
via 24651a5fce9eb5c9db6eeea3cd846b18041a5fc9 (commit)
from 66188cd58e767ec3e23efc31ec207c0e5ed4a84a (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 24651a5fce9eb5c9db6eeea3cd846b18041a5fc9
Author: Tomas Vanek <va...@fb...>
Date: Wed Sep 9 08:50:49 2026 +0200
flash/nor: allow driver erase method to be NULL
We need ability to test for unsupported erase
before the erase method is called.
Also drop the erase stub returning ERROR_FLASH_OPER_UNSUPPORTED
from nrf54 flash driver.
Change-Id: Iccc63decabea5a7bfdfefc0dd87ff8b3515c4f6a
Signed-off-by: Tomas Vanek <va...@fb...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9972
Tested-by: jenkins
Reviewed-by: zapb <de...@za...>
Reviewed-by: Tomas Vanek <tom...@gm...>
diff --git a/src/flash/nor/core.c b/src/flash/nor/core.c
index c6de2f66a..bec542c42 100644
--- a/src/flash/nor/core.c
+++ b/src/flash/nor/core.c
@@ -29,6 +29,11 @@ static struct flash_bank *flash_banks;
int flash_driver_erase(struct flash_bank *bank, unsigned int first,
unsigned int last)
{
+ if (!bank->driver->erase) {
+ // do not log error here to allow silently skip auto-erase
+ return ERROR_FLASH_OPER_UNSUPPORTED;
+ }
+
return bank->driver->erase(bank, first, last);
}
diff --git a/src/flash/nor/driver.h b/src/flash/nor/driver.h
index 16c3756f3..f98d5dd9b 100644
--- a/src/flash/nor/driver.h
+++ b/src/flash/nor/driver.h
@@ -88,6 +88,9 @@ struct flash_driver {
* called, the flash driver should erase the specified sectors
* using whatever means are at its disposal.
*
+ * If the memory is a non-volatile RAM or other type which
+ * does not need to be erased before write, set method to NULL.
+ *
* @param bank The bank of flash to be erased.
* @param first The number of the first sector to erase, typically 0.
* @param last The number of the last sector to erase, typically N-1.
diff --git a/src/flash/nor/nrf54.c b/src/flash/nor/nrf54.c
index 3b90784a3..bb3ef4e3b 100644
--- a/src/flash/nor/nrf54.c
+++ b/src/flash/nor/nrf54.c
@@ -325,12 +325,6 @@ error:
return ERROR_OK;
}
-static int nrf54_erase(struct flash_bank *bank, unsigned int first,
- unsigned int last)
-{
- return ERROR_FLASH_OPER_UNSUPPORTED;
-}
-
FLASH_BANK_COMMAND_HANDLER(nrf54_flash_bank_command)
{
if (bank->base != NRF54_RRAM_BASE_ADDR) {
@@ -366,7 +360,6 @@ const struct flash_driver nrf54_flash = {
.commands = nrf54_command_handlers,
.flash_bank_command = nrf54_flash_bank_command,
.info = nrf54_info,
- .erase = nrf54_erase,
.write = nrf54_write,
.read = default_flash_read,
.probe = nrf54_probe,
diff --git a/src/flash/nor/virtual.c b/src/flash/nor/virtual.c
index 0c2f1b913..2e1c23476 100644
--- a/src/flash/nor/virtual.c
+++ b/src/flash/nor/virtual.c
@@ -101,6 +101,9 @@ static int virtual_erase(struct flash_bank *bank, unsigned int first,
if (!master_bank)
return ERROR_FLASH_OPERATION_FAILED;
+ if (!master_bank->driver->erase)
+ return ERROR_FLASH_OPER_UNSUPPORTED;
+
/* call master handler */
return master_bank->driver->erase(master_bank, first, last);
}
-----------------------------------------------------------------------
Summary of changes:
src/flash/nor/core.c | 5 +++++
src/flash/nor/driver.h | 3 +++
src/flash/nor/nrf54.c | 7 -------
src/flash/nor/virtual.c | 3 +++
4 files changed, 11 insertions(+), 7 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|