From fb6804c5af83d11f2943bba073f3c17bad22947a Mon Sep 17 00:00:00 2001 From: dragonmux Date: Sat, 16 Dec 2023 03:07:48 +0000 Subject: [PATCH] cortexar: Improved the diagnostics in `cortexar_mem_write()` and switched them to `DEBUG_PROTO` --- src/target/cortexar.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/target/cortexar.c b/src/target/cortexar.c index 9526d03ed33..6fac48774fb 100644 --- a/src/target/cortexar.c +++ b/src/target/cortexar.c @@ -1061,7 +1061,19 @@ static void cortexar_mem_write( target_s *const target, const target_addr_t dest, const void *const src, const size_t len) { cortexar_priv_s *const priv = (cortexar_priv_s *)target->priv; - DEBUG_TARGET("%s: Writing %zu bytes @0x%" PRIx32 "\n", __func__, len, dest); + DEBUG_PROTO("%s: Writing %zu bytes @0x%" PRIx32 ":", __func__, len, dest); +#ifndef DEBUG_PROTO_IS_NOOP + const uint8_t *const data = (const uint8_t *)src; +#endif + for (size_t offset = 0; offset < len; ++offset) { + if (offset == 16U) + break; + DEBUG_PROTO(" %02x", data[offset]); + } + if (len > 16U) + DEBUG_PROTO(" ..."); + DEBUG_PROTO("\n"); + /* Cache DFSR and DFAR in case we wind up triggering a data fault */ const uint32_t fault_status = cortexar_coproc_read(target, CORTEXAR_DFSR); const uint32_t fault_addr = cortexar_coproc_read(target, CORTEXAR_DFAR);