diff options
author | Matthijs Kooijman <matthijs@stdin.nl> | 2023-04-27 18:34:44 +0200 |
---|---|---|
committer | Tomas Vanek <vanekt@fbl.cz> | 2023-05-25 16:25:44 +0000 |
commit | a5d34202c6880bc9b8d0b326628ba1f2e5b061ff (patch) | |
tree | 817dda2d207e32e6d11f9ef6e1091561f28a3aea /src/flash | |
parent | 3733cf196153f56be3a790311aeb95e3c15c56f3 (diff) | |
download | riscv-openocd-a5d34202c6880bc9b8d0b326628ba1f2e5b061ff.zip riscv-openocd-a5d34202c6880bc9b8d0b326628ba1f2e5b061ff.tar.gz riscv-openocd-a5d34202c6880bc9b8d0b326628ba1f2e5b061ff.tar.bz2 |
flash/nor/stm32f2x: Show error message when unprotecting OTP
Trying to disable OTP write protection by running e.g. `flash protect
1 0 1 off` would already be rejected with an error code, but that would
result in a generic "failed setting protection for blocks 0 to 1"
message. Now a more specific error message is also printed, telling the
user why it failed.
Change-Id: I6d4974eb0bcd23a0a6cf68ff955d9e59b8b1b06a
Signed-off-by: Matthijs Kooijman <matthijs@stdin.nl>
Reviewed-on: https://review.openocd.org/c/openocd/+/7615
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Diffstat (limited to 'src/flash')
-rw-r--r-- | src/flash/nor/stm32f2x.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/flash/nor/stm32f2x.c b/src/flash/nor/stm32f2x.c index fd538d0..dcaf260 100644 --- a/src/flash/nor/stm32f2x.c +++ b/src/flash/nor/stm32f2x.c @@ -659,8 +659,10 @@ static int stm32x_protect(struct flash_bank *bank, int set, unsigned int first, } if (stm32x_is_otp(bank)) { - if (!set) + if (!set) { + LOG_ERROR("OTP protection can only be enabled"); return ERROR_COMMAND_ARGUMENT_INVALID; + } return stm32x_otp_protect(bank, first, last); } |