Skip to content

Add dcsr cetrig control #1255

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: riscv
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/linux-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ name: Linux Build
jobs:
# 32-bit, clang
build32:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
env:
CFLAGS: -m32
CC: clang
Expand Down
7 changes: 7 additions & 0 deletions doc/openocd.texi
Original file line number Diff line number Diff line change
Expand Up @@ -11437,6 +11437,13 @@ action pairs.
@end itemize
@end itemize

@itemize
@item @code{-cetrig} @option{disable}|@option{enable} -- sets the @code{cetrig}
field for dcsr. Defaults to @option{disable}.

@item @code{cget} return a @code{cetrig} state.
@end itemize

@subsection RISC-V Debug Configuration Commands

@deffn {Command} {riscv dump_sample_buf} [base64]
Expand Down
76 changes: 63 additions & 13 deletions src/target/riscv/debug_defines.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/*
* This file is auto-generated by running 'make debug_defines' in
* https://github.com/riscv/riscv-debug-spec/ (40b9a05)
*/
/* SPDX-License-Identifier: BSD-2-Clause OR CC-BY-4.0 */
/* This file was auto-generated by running 'make debug_defines' in https://github.com/riscv/riscv-debug-spec/ (22a7576) */

#include "debug_defines.h"
#include <stddef.h>
Expand Down Expand Up @@ -222,6 +220,17 @@ static const char *csr_dcsr_debugver_values[16] = {
[4] = "1_0",
[15] = "custom"
};
static const char *csr_dcsr_extcause_values[8] = {
[0] = "critical_error"
};
static const char *csr_dcsr_cetrig_values[2] = {
[0] = "disabled",
[1] = "enabled"
};
static const char *csr_dcsr_pelp_values[2] = {
[0] = "NO_LP_EXPECTED",
[1] = "LP_EXPECTED"
};
static const char *csr_dcsr_ebreakvs_values[2] = {
[0] = "exception",
[1] = "debug_mode"
Expand Down Expand Up @@ -260,7 +269,8 @@ static const char *csr_dcsr_cause_values[8] = {
[3] = "haltreq",
[4] = "step",
[5] = "resethaltreq",
[6] = "group"
[6] = "group",
[7] = "other"
};
static const char *csr_dcsr_mprven_values[2] = {
[0] = "disabled",
Expand Down Expand Up @@ -350,6 +360,20 @@ static riscv_debug_reg_field_list_t csr_dcsr_get_debugver(riscv_debug_reg_ctx_t
return result;
}

static riscv_debug_reg_field_list_t csr_dcsr_get_extcause(riscv_debug_reg_ctx_t context)
{
riscv_debug_reg_field_list_t result = {
.field = {
.name = "extcause",
.lsb = 0x18,
.msb = 0x1a,
.values = csr_dcsr_extcause_values
},
.get_next = csr_dcsr_get_debugver
};
return result;
}

static riscv_debug_reg_field_list_t csr_dcsr_get_step(riscv_debug_reg_ctx_t context)
{
riscv_debug_reg_field_list_t result = {
Expand All @@ -359,7 +383,35 @@ static riscv_debug_reg_field_list_t csr_dcsr_get_step(riscv_debug_reg_ctx_t cont
.msb = 2,
.values = NULL
},
.get_next = csr_dcsr_get_debugver
.get_next = csr_dcsr_get_extcause
};
return result;
}

static riscv_debug_reg_field_list_t csr_dcsr_get_cetrig(riscv_debug_reg_ctx_t context)
{
riscv_debug_reg_field_list_t result = {
.field = {
.name = "cetrig",
.lsb = 0x13,
.msb = 0x13,
.values = csr_dcsr_cetrig_values
},
.get_next = csr_dcsr_get_step
};
return result;
}

static riscv_debug_reg_field_list_t csr_dcsr_get_pelp(riscv_debug_reg_ctx_t context)
{
riscv_debug_reg_field_list_t result = {
.field = {
.name = "pelp",
.lsb = 0x12,
.msb = 0x12,
.values = csr_dcsr_pelp_values
},
.get_next = csr_dcsr_get_cetrig
};
return result;
}
Expand All @@ -373,7 +425,7 @@ static riscv_debug_reg_field_list_t csr_dcsr_get_ebreakvs(riscv_debug_reg_ctx_t
.msb = 0x11,
.values = csr_dcsr_ebreakvs_values
},
.get_next = csr_dcsr_get_step
.get_next = csr_dcsr_get_pelp
};
return result;
}
Expand Down Expand Up @@ -692,12 +744,11 @@ static riscv_debug_reg_field_list_t csr_tcontrol_get_mte(riscv_debug_reg_ctx_t c

static riscv_debug_reg_field_list_t csr_scontext_get_data(riscv_debug_reg_ctx_t context)
{
assert(context.XLEN.is_set);
riscv_debug_reg_field_list_t result = {
.field = {
.name = "data",
.lsb = 0,
.msb = (context.XLEN.value + -1),
.msb = 0x1f,
.values = NULL
},
.get_next = NULL
Expand All @@ -707,12 +758,11 @@ static riscv_debug_reg_field_list_t csr_scontext_get_data(riscv_debug_reg_ctx_t

static riscv_debug_reg_field_list_t csr_mcontext_get_hcontext(riscv_debug_reg_ctx_t context)
{
assert(context.XLEN.is_set);
riscv_debug_reg_field_list_t result = {
.field = {
.name = "hcontext",
.lsb = 0,
.msb = (context.XLEN.value + -1),
.msb = 0xd,
.values = NULL
},
.get_next = NULL
Expand Down Expand Up @@ -1974,7 +2024,7 @@ static riscv_debug_reg_field_list_t csr_textra64_get_sbytemask(riscv_debug_reg_c
.field = {
.name = "sbytemask",
.lsb = 0x24,
.msb = 0x28,
.msb = 0x27,
.values = NULL
},
.get_next = csr_textra64_get_mhselect
Expand All @@ -1988,7 +2038,7 @@ static riscv_debug_reg_field_list_t csr_textra64_get_svalue(riscv_debug_reg_ctx_
.field = {
.name = "svalue",
.lsb = 2,
.msb = 0x23,
.msb = 0x21,
.values = NULL
},
.get_next = csr_textra64_get_sbytemask
Expand Down
Loading
Loading