aboutsummaryrefslogtreecommitdiff
path: root/src/target/arm720t.c
diff options
context:
space:
mode:
authorTomas Vanek <vanekt@fbl.cz>2023-07-20 14:52:54 +0200
committerTomas Vanek <vanekt@fbl.cz>2023-07-29 05:17:44 +0000
commita5108240f9e12633fea400f92d96cc75e03c86ca (patch)
treead263d29852d7646998e34bd14ecc914e361f72a /src/target/arm720t.c
parent7023deb06a8cac77fe50d341c9e34b80d4fc68fd (diff)
downloadriscv-openocd-a5108240f9e12633fea400f92d96cc75e03c86ca.zip
riscv-openocd-a5108240f9e12633fea400f92d96cc75e03c86ca.tar.gz
riscv-openocd-a5108240f9e12633fea400f92d96cc75e03c86ca.tar.bz2
target: fix messages and return values of failed op because not halted
Lot of messages was logged as LOG_WARNING, but the operation failed immediately. Sometimes no error message was logged at all. Add missing messages, change warnings to errors. Sometimes ERROR_TARGET_INVALID was returned. Some command handlers returned ERROR_OK! Always return ERROR_TARGET_NOT_HALTED. While on it use LOG_TARGET_ERROR() whenever possible. Prefix command_print() message with 'Error:' to get closer to LOG_TARGET_ERROR() variant. Error message was not added to get() and set() methods of struct xxx_reg_type - the return value is properly checked and a message is logged by the caller in case of ERROR_TARGET_NOT_HALTED. Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Change-Id: I2fe4187c6025f0038956ab387edbf3f461c69398 Reviewed-on: https://review.openocd.org/c/openocd/+/7819 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Diffstat (limited to 'src/target/arm720t.c')
-rw-r--r--src/target/arm720t.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/target/arm720t.c b/src/target/arm720t.c
index c330dff..beab632 100644
--- a/src/target/arm720t.c
+++ b/src/target/arm720t.c
@@ -241,8 +241,8 @@ static int arm720t_arch_state(struct target *target)
static int arm720_mmu(struct target *target, int *enabled)
{
if (target->state != TARGET_HALTED) {
- LOG_ERROR("%s: target not halted", __func__);
- return ERROR_TARGET_INVALID;
+ LOG_TARGET_ERROR(target, "not halted");
+ return ERROR_TARGET_NOT_HALTED;
}
*enabled = target_to_arm720(target)->armv4_5_mmu.mmu_enabled;