Skip to content

Memory Sampling support when sbasize is zero. #1270

@RaamyPi

Description

@RaamyPi

From the RISC-V Debug Specification (ratified February 2025), in the definition of the sbcs register, the sbasize field is defined (Page 44, Table on top) as:

sbasize : Width of system bus addresses in bits. (0 indicates there is no bus access support.)

But these lines in riscv-013.c, where sbasize is examined to return status about implementation support for memory sampling, do not include the case when sbasize is zero.

if (sbasize > 64) {
LOG_TARGET_ERROR(target, "Memory sampling is only implemented for sbasize <= 64.");
return ERROR_NOT_IMPLEMENTED;
}

This behaviour was observed when trying MemorySample tests from the RISC-V Debug Test suite on a design with only Program Buffer support.

The following patch fixes the issue:

if (sbasize == 0 || sbasize > 64)

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions