|
From: openocd-gerrit <ope...@us...> - 2026-09-16 19:50:07
|
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 2fe5eaefbd887f03ad30c9ba481ad25d9adf0f37 (commit)
from 339f088acdd706b3c6389755e677a47c1f15aa5b (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 2fe5eaefbd887f03ad30c9ba481ad25d9adf0f37
Author: Tomas Vanek <va...@fb...>
Date: Sat Sep 5 09:43:19 2026 +0200
flash/nor: make flash driver erase_check method optional
Currently more than 50 flash drivers define
.erase_check = default_flash_blank_check
Fall back to default_flash_blank_check() if the .erase_check
method is NULL
While on it fix unbalanced braces around else to make
checkpatch with checking extended to hunk context happy.
Change-Id: I9df7e18c249244795b204020f91f275dd859e6f5
Signed-off-by: Tomas Vanek <va...@fb...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9960
Tested-by: jenkins
Reviewed-by: Antonio Borneo <bor...@gm...>
diff --git a/src/flash/nor/driver.h b/src/flash/nor/driver.h
index 1d878c591..e77a46de1 100644
--- a/src/flash/nor/driver.h
+++ b/src/flash/nor/driver.h
@@ -179,6 +179,9 @@ struct flash_driver {
* checks and then set the @c flash_sector::is_erased field
* for each of the flash banks's sectors.
*
+ * If the flash does not need device specific erase_check
+ * set method to NULL and default_flash_blank_check() will be used.
+ *
* @param bank The bank to check
* @returns ERROR_OK if successful; otherwise, an error code.
*/
diff --git a/src/flash/nor/tcl.c b/src/flash/nor/tcl.c
index 5829d862b..0a0de8e24 100644
--- a/src/flash/nor/tcl.c
+++ b/src/flash/nor/tcl.c
@@ -187,10 +187,13 @@ COMMAND_HANDLER(handle_flash_erase_check_command)
if (retval != ERROR_OK)
return retval;
- retval = p->driver->erase_check(p);
- if (retval == ERROR_OK)
+ if (p->driver->erase_check)
+ retval = p->driver->erase_check(p);
+ else
+ retval = default_flash_blank_check(p);
+ if (retval == ERROR_OK) {
command_print(CMD, "successfully checked erase state");
- else {
+ } else {
command_print(CMD,
"Error: checking erase state of flash bank #%s at "
TARGET_ADDR_FMT,
diff --git a/src/flash/nor/virtual.c b/src/flash/nor/virtual.c
index 2c2be0520..0c2f1b913 100644
--- a/src/flash/nor/virtual.c
+++ b/src/flash/nor/virtual.c
@@ -175,8 +175,11 @@ static int virtual_blank_check(struct flash_bank *bank)
if (!master_bank)
return ERROR_FLASH_OPERATION_FAILED;
- /* call master handler */
- return master_bank->driver->erase_check(master_bank);
+ /* call master handler or default */
+ if (master_bank->driver->erase_check)
+ return master_bank->driver->erase_check(master_bank);
+
+ return default_flash_blank_check(master_bank);
}
static int virtual_flash_read(struct flash_bank *bank,
-----------------------------------------------------------------------
Summary of changes:
src/flash/nor/driver.h | 3 +++
src/flash/nor/tcl.c | 9 ++++++---
src/flash/nor/virtual.c | 7 +++++--
3 files changed, 14 insertions(+), 5 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|