rtos/nuttx: move stacking info to the new nuttx stackings file
Other OSes have separate files to keep stack register offsets. Adding them for NuttX as well will provide a clearer way to expand. Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com> Change-Id: I1428fefefa199a95431f2073c0279dd7028ad8da Reviewed-on: https://review.openocd.org/c/openocd/+/7250 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
This commit is contained in:
parent
41231db3f0
commit
463df95215
|
@ -10,6 +10,7 @@ noinst_LTLIBRARIES += %D%/librtos.la
|
|||
%D%/rtos_mqx_stackings.c \
|
||||
%D%/rtos_ucos_iii_stackings.c \
|
||||
%D%/rtos_riot_stackings.c \
|
||||
%D%/rtos_nuttx_stackings.c \
|
||||
%D%/FreeRTOS.c \
|
||||
%D%/ThreadX.c \
|
||||
%D%/eCos.c \
|
||||
|
@ -32,4 +33,5 @@ noinst_LTLIBRARIES += %D%/librtos.la
|
|||
%D%/rtos_mqx_stackings.h \
|
||||
%D%/rtos_riot_stackings.h \
|
||||
%D%/rtos_ucos_iii_stackings.h \
|
||||
%D%/rtos_nuttx_stackings.h \
|
||||
%D%/nuttx_header.h
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include "server/gdb_server.h"
|
||||
|
||||
#include "nuttx_header.h"
|
||||
|
||||
#include "rtos_nuttx_stackings.h"
|
||||
|
||||
int rtos_thread_packet(struct connection *connection, const char *packet, int packet_size);
|
||||
|
||||
|
@ -85,62 +85,6 @@ static char *task_state_str[] = {
|
|||
#endif /* CONFIG_PAGING */
|
||||
};
|
||||
|
||||
/* see arch/arm/include/armv7-m/irq_cmnvector.h */
|
||||
static const struct stack_register_offset nuttx_stack_offsets_cortex_m[] = {
|
||||
{ ARMV7M_R0, 0x28, 32 }, /* r0 */
|
||||
{ ARMV7M_R1, 0x2c, 32 }, /* r1 */
|
||||
{ ARMV7M_R2, 0x30, 32 }, /* r2 */
|
||||
{ ARMV7M_R3, 0x34, 32 }, /* r3 */
|
||||
{ ARMV7M_R4, 0x08, 32 }, /* r4 */
|
||||
{ ARMV7M_R5, 0x0c, 32 }, /* r5 */
|
||||
{ ARMV7M_R6, 0x10, 32 }, /* r6 */
|
||||
{ ARMV7M_R7, 0x14, 32 }, /* r7 */
|
||||
{ ARMV7M_R8, 0x18, 32 }, /* r8 */
|
||||
{ ARMV7M_R9, 0x1c, 32 }, /* r9 */
|
||||
{ ARMV7M_R10, 0x20, 32 }, /* r10 */
|
||||
{ ARMV7M_R11, 0x24, 32 }, /* r11 */
|
||||
{ ARMV7M_R12, 0x38, 32 }, /* r12 */
|
||||
{ ARMV7M_R13, 0, 32 }, /* sp */
|
||||
{ ARMV7M_R14, 0x3c, 32 }, /* lr */
|
||||
{ ARMV7M_PC, 0x40, 32 }, /* pc */
|
||||
{ ARMV7M_XPSR, 0x44, 32 }, /* xPSR */
|
||||
};
|
||||
|
||||
|
||||
static const struct rtos_register_stacking nuttx_stacking_cortex_m = {
|
||||
.stack_registers_size = 0x48,
|
||||
.stack_growth_direction = -1,
|
||||
.num_output_registers = 17,
|
||||
.register_offsets = nuttx_stack_offsets_cortex_m
|
||||
};
|
||||
|
||||
static const struct stack_register_offset nuttx_stack_offsets_cortex_m_fpu[] = {
|
||||
{ ARMV7M_R0, 0x6c, 32 }, /* r0 */
|
||||
{ ARMV7M_R1, 0x70, 32 }, /* r1 */
|
||||
{ ARMV7M_R2, 0x74, 32 }, /* r2 */
|
||||
{ ARMV7M_R3, 0x78, 32 }, /* r3 */
|
||||
{ ARMV7M_R4, 0x08, 32 }, /* r4 */
|
||||
{ ARMV7M_R5, 0x0c, 32 }, /* r5 */
|
||||
{ ARMV7M_R6, 0x10, 32 }, /* r6 */
|
||||
{ ARMV7M_R7, 0x14, 32 }, /* r7 */
|
||||
{ ARMV7M_R8, 0x18, 32 }, /* r8 */
|
||||
{ ARMV7M_R9, 0x1c, 32 }, /* r9 */
|
||||
{ ARMV7M_R10, 0x20, 32 }, /* r10 */
|
||||
{ ARMV7M_R11, 0x24, 32 }, /* r11 */
|
||||
{ ARMV7M_R12, 0x7c, 32 }, /* r12 */
|
||||
{ ARMV7M_R13, 0, 32 }, /* sp */
|
||||
{ ARMV7M_R14, 0x80, 32 }, /* lr */
|
||||
{ ARMV7M_PC, 0x84, 32 }, /* pc */
|
||||
{ ARMV7M_XPSR, 0x88, 32 }, /* xPSR */
|
||||
};
|
||||
|
||||
static const struct rtos_register_stacking nuttx_stacking_cortex_m_fpu = {
|
||||
.stack_registers_size = 0x8c,
|
||||
.stack_growth_direction = -1,
|
||||
.num_output_registers = 17,
|
||||
.register_offsets = nuttx_stack_offsets_cortex_m_fpu
|
||||
};
|
||||
|
||||
static int pid_offset = PID;
|
||||
static int state_offset = STATE;
|
||||
static int name_offset = NAME;
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "rtos.h"
|
||||
#include "target/armv7m.h"
|
||||
#include "rtos_nuttx_stackings.h"
|
||||
|
||||
/* see arch/arm/include/armv7-m/irq_cmnvector.h */
|
||||
static const struct stack_register_offset nuttx_stack_offsets_cortex_m[] = {
|
||||
{ ARMV7M_R0, 0x28, 32 }, /* r0 */
|
||||
{ ARMV7M_R1, 0x2c, 32 }, /* r1 */
|
||||
{ ARMV7M_R2, 0x30, 32 }, /* r2 */
|
||||
{ ARMV7M_R3, 0x34, 32 }, /* r3 */
|
||||
{ ARMV7M_R4, 0x08, 32 }, /* r4 */
|
||||
{ ARMV7M_R5, 0x0c, 32 }, /* r5 */
|
||||
{ ARMV7M_R6, 0x10, 32 }, /* r6 */
|
||||
{ ARMV7M_R7, 0x14, 32 }, /* r7 */
|
||||
{ ARMV7M_R8, 0x18, 32 }, /* r8 */
|
||||
{ ARMV7M_R9, 0x1c, 32 }, /* r9 */
|
||||
{ ARMV7M_R10, 0x20, 32 }, /* r10 */
|
||||
{ ARMV7M_R11, 0x24, 32 }, /* r11 */
|
||||
{ ARMV7M_R12, 0x38, 32 }, /* r12 */
|
||||
{ ARMV7M_R13, 0, 32 }, /* sp */
|
||||
{ ARMV7M_R14, 0x3c, 32 }, /* lr */
|
||||
{ ARMV7M_PC, 0x40, 32 }, /* pc */
|
||||
{ ARMV7M_XPSR, 0x44, 32 }, /* xPSR */
|
||||
};
|
||||
|
||||
const struct rtos_register_stacking nuttx_stacking_cortex_m = {
|
||||
.stack_registers_size = 0x48,
|
||||
.stack_growth_direction = -1,
|
||||
.num_output_registers = 17,
|
||||
.register_offsets = nuttx_stack_offsets_cortex_m,
|
||||
};
|
||||
|
||||
static const struct stack_register_offset nuttx_stack_offsets_cortex_m_fpu[] = {
|
||||
{ ARMV7M_R0, 0x6c, 32 }, /* r0 */
|
||||
{ ARMV7M_R1, 0x70, 32 }, /* r1 */
|
||||
{ ARMV7M_R2, 0x74, 32 }, /* r2 */
|
||||
{ ARMV7M_R3, 0x78, 32 }, /* r3 */
|
||||
{ ARMV7M_R4, 0x08, 32 }, /* r4 */
|
||||
{ ARMV7M_R5, 0x0c, 32 }, /* r5 */
|
||||
{ ARMV7M_R6, 0x10, 32 }, /* r6 */
|
||||
{ ARMV7M_R7, 0x14, 32 }, /* r7 */
|
||||
{ ARMV7M_R8, 0x18, 32 }, /* r8 */
|
||||
{ ARMV7M_R9, 0x1c, 32 }, /* r9 */
|
||||
{ ARMV7M_R10, 0x20, 32 }, /* r10 */
|
||||
{ ARMV7M_R11, 0x24, 32 }, /* r11 */
|
||||
{ ARMV7M_R12, 0x7c, 32 }, /* r12 */
|
||||
{ ARMV7M_R13, 0, 32 }, /* sp */
|
||||
{ ARMV7M_R14, 0x80, 32 }, /* lr */
|
||||
{ ARMV7M_PC, 0x84, 32 }, /* pc */
|
||||
{ ARMV7M_XPSR, 0x88, 32 }, /* xPSR */
|
||||
};
|
||||
|
||||
const struct rtos_register_stacking nuttx_stacking_cortex_m_fpu = {
|
||||
.stack_registers_size = 0x8c,
|
||||
.stack_growth_direction = -1,
|
||||
.num_output_registers = 17,
|
||||
.register_offsets = nuttx_stack_offsets_cortex_m_fpu,
|
||||
};
|
|
@ -0,0 +1,11 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#ifndef INCLUDED_RTOS_NUTTX_STACKINGS_H
|
||||
#define INCLUDED_RTOS_NUTTX_STACKINGS_H
|
||||
|
||||
#include "rtos.h"
|
||||
|
||||
extern const struct rtos_register_stacking nuttx_stacking_cortex_m;
|
||||
extern const struct rtos_register_stacking nuttx_stacking_cortex_m_fpu;
|
||||
|
||||
#endif /* INCLUDED_RTOS_NUTTX_STACKINGS_H */
|
Loading…
Reference in New Issue