Skip to content

Commit

Permalink
debug: arc: expose thread relinquish cause
Browse files Browse the repository at this point in the history
When a thread is preempted on ARC, caller-saved registers
are saved on the stack automatically (RIRQ) or manually
by the kernel ISR (FIRQ).
Exposing the thread's relinquish cause hints the debugger
that it can read more or less register values.

Signed-off-by: Bruno Mendes <[email protected]>
  • Loading branch information
bdmendes committed Aug 3, 2023
1 parent 6dc3a65 commit 33701e1
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
38 changes: 38 additions & 0 deletions scripts/west_commands/tests/nrf/generated_nrfutil_batch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"family": "NRF53_FAMILY",
"operations": [
{
"operation": {
"type": "recover"
},
"core": "NRFDL_DEVICE_CORE_NETWORK",
"operationId": "1"
},
{
"operation": {
"type": "recover"
},
"operationId": "2"
},
{
"operation": {
"type": "program",
"firmware": {
"file": "/home/mendesb/zephyrproject/zephyr/scripts/west_commands/tests/nrf/nrf5340_net_only.hex",
"format": "NRFDL_FW_INTEL_HEX"
},
"chip_erase_mode": "ERASE_ALL",
"verify": "VERIFY_READ"
},
"core": "NRFDL_DEVICE_CORE_NETWORK",
"operationId": "3"
},
{
"operation": {
"type": "reset",
"option": "RESET_SYSTEM"
},
"operationId": "4"
}
]
}
8 changes: 8 additions & 0 deletions subsys/debug/thread_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ enum {
THREAD_INFO_OFFSET_T_PREEMPT_FLOAT,
THREAD_INFO_OFFSET_T_COOP_FLOAT,
THREAD_INFO_OFFSET_T_ARM_EXC_RETURN,
THREAD_INFO_OFFSET_T_ARC_RELINQUISH_CAUSE,
};

#if CONFIG_MP_MAX_NUM_CPUS > 1
Expand Down Expand Up @@ -137,7 +138,14 @@ size_t _kernel_thread_info_offsets[] = {
#else
[THREAD_INFO_OFFSET_T_ARM_EXC_RETURN] = THREAD_INFO_UNIMPLEMENTED,
#endif /* CONFIG_ARM_STORE_EXC_RETURN */
#if defined(CONFIG_ARC)
[THREAD_INFO_OFFSET_T_ARC_RELINQUISH_CAUSE] = offsetof(struct _thread_arch,
relinquish_cause),
#else
[THREAD_INFO_OFFSET_T_ARC_RELINQUISH_CAUSE] = THREAD_INFO_UNIMPLEMENTED,
#endif /* CONFIG_ARC */
};

extern size_t __attribute__((alias("_kernel_thread_info_offsets")))
_kernel_openocd_offsets;

Expand Down

0 comments on commit 33701e1

Please sign in to comment.