This is an automated email from Gerrit.

"Tomas Vanek <[email protected]>" just uploaded a new patch set to Gerrit, which 
you can find at https://review.openocd.org/c/openocd/+/9142

-- gerrit

commit 557a34c8eeb26e76c8a1c3566ec9d3e5ba24fce5
Author: Sriram Shanmuga <[email protected]>
Date:   Mon Jul 7 18:17:04 2025 +0300

    target/riscv: improve error messaging in case `sbasize` is zero
    
    Imported from
    https://github.com/riscv-collab/riscv-openocd/pull/1274
    
    From: Sriram Shanmuga <[email protected]>
    
    RISC-V Debug Specification v1.0 [3.14.22. System Bus Access Control and
    Status (`sbcs`, at 0x38)] states in `sbasize` field description:
    > Width of system bus addresses in bits. (0 indicates there is no bus
    access support.)
    
    Before the patch, the error message did not include the information
    about `sbcs.sbasize` being zero wich made it quite undescriptive:
    ```
    [riscv.cpu] Turning off memory sampling because it failed.
    
    ```
    
    Fixes #1270
    
    Change-Id: I5402dd57dc9a81f65ee4c67d24e11c366006427c
    Signed-off-by: Sriram Shanmuga <[email protected]>
    Signed-off-by: Evgeniy Naydanov <[email protected]>

diff --git a/src/target/riscv/riscv-013.c b/src/target/riscv/riscv-013.c
index 1f34cd1a30..1bb123d6c7 100644
--- a/src/target/riscv/riscv-013.c
+++ b/src/target/riscv/riscv-013.c
@@ -2610,8 +2610,8 @@ static int sample_memory_bus_v1(struct target *target,
 {
        RISCV013_INFO(info);
        unsigned int sbasize = get_field(info->sbcs, DM_SBCS_SBASIZE);
-       if (sbasize > 64) {
-               LOG_TARGET_ERROR(target, "Memory sampling is only implemented 
for sbasize <= 64.");
+       if (sbasize == 0 || sbasize > 64) {
+               LOG_TARGET_ERROR(target, "Memory sampling is only implemented 
for non-zero sbasize <= 64.");
                return ERROR_NOT_IMPLEMENTED;
        }
 

-- 

Reply via email to