1
0
Fork 0
forked from nuttx/nuttx-update

sched/tcbinfo: Fix the compile warning

Update tcbinfo struct

armv8-m/arm_tcbinfo.c:109:3: warning: excess elements in struct initializer
  109 |   TCB_REG_OFF(REG_S31),
      |   ^~~~~~~~~~~
armv8-m/arm_tcbinfo.c:109:3: note: (near initialization for 'g_tcbinfo')
armv8-m/arm_tcbinfo.c:110:3: warning: excess elements in struct initializer
  110 |   0,
      |   ^
armv8-m/arm_tcbinfo.c:110:3: note: (near initialization for 'g_tcbinfo')
armv8-m/arm_tcbinfo.c:111:3: warning: excess elements in struct initializer
  111 |   TCB_REG_OFF(REG_FPSCR),
      |   ^~~~~~~~~~~
armv8-m/arm_tcbinfo.c:111:3: note: (near initialization for 'g_tcbinfo')
armv8-m/arm_tcbinfo.c:112:3: warning: excess elements in struct initializer
  112 |   0,
      |   ^
armv8-m/arm_tcbinfo.c:112:3: note: (near initialization for 'g_tcbinfo')
armv8-m/arm_tcbinfo.c:37:1: warning: missing braces around initializer [-Wmissing-braces]
   37 | {

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Signed-off-by: zhuyanlin <zhuyanlin1@xiaomi.com>
This commit is contained in:
Xiang Xiao 2021-12-27 11:09:38 +08:00 committed by Xiang Xiao
parent dad4a7f8f7
commit f903a55102
9 changed files with 157 additions and 110 deletions

View file

@ -30,20 +30,11 @@
#include <arch/irq.h>
/****************************************************************************
* Public Data
* Private Data
****************************************************************************/
const struct tcbinfo_s g_tcbinfo =
static const uint16_t g_reg_offs[] =
{
TCB_PID_OFF,
TCB_STATE_OFF,
TCB_PRI_OFF,
#if CONFIG_TASK_NAME_SIZE > 0
TCB_NAME_OFF,
#endif
XCPTCONTEXT_REGS,
TCB_REG_OFF(REG_R0),
TCB_REG_OFF(REG_R1),
TCB_REG_OFF(REG_R2),
@ -63,6 +54,22 @@ const struct tcbinfo_s g_tcbinfo =
TCB_REG_OFF(REG_CPSR),
};
/****************************************************************************
* Public Data
****************************************************************************/
const struct tcbinfo_s g_tcbinfo =
{
TCB_PID_OFF,
TCB_STATE_OFF,
TCB_PRI_OFF,
TCB_NAME_OFF,
XCPTCONTEXT_REGS,
{
.p = g_reg_offs,
},
};
#endif
/****************************************************************************

View file

@ -30,20 +30,11 @@
#include <arch/irq.h>
/****************************************************************************
* Public Data
* Private Data
****************************************************************************/
const struct tcbinfo_s g_tcbinfo =
static const uint16_t g_reg_offs[] =
{
TCB_PID_OFF,
TCB_STATE_OFF,
TCB_PRI_OFF,
#if CONFIG_TASK_NAME_SIZE > 0
TCB_NAME_OFF,
#endif
XCPTCONTEXT_REGS,
TCB_REG_OFF(REG_R0),
TCB_REG_OFF(REG_R1),
TCB_REG_OFF(REG_R2),
@ -62,12 +53,28 @@ const struct tcbinfo_s g_tcbinfo =
TCB_REG_OFF(REG_R15),
TCB_REG_OFF(REG_XPSR),
0,
0, /* msp */
TCB_REG_OFF(REG_R13),
TCB_REG_OFF(REG_PRIMASK),
0,
0,
0,
0, /* basepri */
0, /* faultmask */
0, /* control */
};
/****************************************************************************
* Public Data
****************************************************************************/
const struct tcbinfo_s g_tcbinfo =
{
TCB_PID_OFF,
TCB_STATE_OFF,
TCB_PRI_OFF,
TCB_NAME_OFF,
XCPTCONTEXT_REGS,
{
.p = g_reg_offs,
},
};
#endif

View file

@ -30,20 +30,11 @@
#include <arch/irq.h>
/****************************************************************************
* Public Data
* Private Data
****************************************************************************/
const struct tcbinfo_s g_tcbinfo =
static const uint16_t g_reg_offs[] =
{
TCB_PID_OFF,
TCB_STATE_OFF,
TCB_PRI_OFF,
#if CONFIG_TASK_NAME_SIZE > 0
TCB_NAME_OFF,
#endif
XCPTCONTEXT_REGS,
TCB_REG_OFF(REG_R0),
TCB_REG_OFF(REG_R1),
TCB_REG_OFF(REG_R2),
@ -101,12 +92,26 @@ const struct tcbinfo_s g_tcbinfo =
#endif
#ifdef CONFIG_ARCH_FPU
0,
TCB_REG_OFF(REG_FPSCR),
0,
#endif
};
/****************************************************************************
* Public Data
****************************************************************************/
const struct tcbinfo_s g_tcbinfo =
{
TCB_PID_OFF,
TCB_STATE_OFF,
TCB_PRI_OFF,
TCB_NAME_OFF,
XCPTCONTEXT_REGS,
{
.p = g_reg_offs,
},
};
#endif
/****************************************************************************

View file

@ -30,20 +30,11 @@
#include <arch/irq.h>
/****************************************************************************
* Public Data
* Private Data
****************************************************************************/
const struct tcbinfo_s g_tcbinfo =
static const uint16_t g_reg_offs[] =
{
TCB_PID_OFF,
TCB_STATE_OFF,
TCB_PRI_OFF,
#if CONFIG_TASK_NAME_SIZE > 0
TCB_NAME_OFF,
#endif
XCPTCONTEXT_REGS,
TCB_REG_OFF(REG_R0),
TCB_REG_OFF(REG_R1),
TCB_REG_OFF(REG_R2),
@ -62,17 +53,17 @@ const struct tcbinfo_s g_tcbinfo =
TCB_REG_OFF(REG_R15),
TCB_REG_OFF(REG_XPSR),
0,
0, /* msp */
TCB_REG_OFF(REG_R13),
#ifdef CONFIG_ARMV7M_USEBASEPRI
0,
0, /* primask */
TCB_REG_OFF(REG_BASEPRI),
#else
TCB_REG_OFF(REG_PRIMASK),
0,
0, /* basepri */
#endif
0,
0,
0, /* faultmask */
0, /* control */
#ifdef CONFIG_ARCH_FPU
TCB_REG_OFF(REG_S0),
@ -107,12 +98,26 @@ const struct tcbinfo_s g_tcbinfo =
TCB_REG_OFF(REG_S29),
TCB_REG_OFF(REG_S30),
TCB_REG_OFF(REG_S31),
0,
TCB_REG_OFF(REG_FPSCR),
0,
#endif
};
/****************************************************************************
* Public Data
****************************************************************************/
const struct tcbinfo_s g_tcbinfo =
{
TCB_PID_OFF,
TCB_STATE_OFF,
TCB_PRI_OFF,
TCB_NAME_OFF,
XCPTCONTEXT_REGS,
{
.p = g_reg_offs,
},
};
#endif
/****************************************************************************

View file

@ -30,20 +30,11 @@
#include <arch/irq.h>
/****************************************************************************
* Public Data
* Private Data
****************************************************************************/
const struct tcbinfo_s g_tcbinfo =
static const uint16_t g_reg_offs[] =
{
TCB_PID_OFF,
TCB_STATE_OFF,
TCB_PRI_OFF,
#if CONFIG_TASK_NAME_SIZE > 0
TCB_NAME_OFF,
#endif
XCPTCONTEXT_REGS,
TCB_REG_OFF(REG_R0),
TCB_REG_OFF(REG_R1),
TCB_REG_OFF(REG_R2),
@ -101,12 +92,26 @@ const struct tcbinfo_s g_tcbinfo =
#endif
#ifdef CONFIG_ARCH_FPU
0,
TCB_REG_OFF(REG_FPSCR),
0,
#endif
};
/****************************************************************************
* Public Data
****************************************************************************/
const struct tcbinfo_s g_tcbinfo =
{
TCB_PID_OFF,
TCB_STATE_OFF,
TCB_PRI_OFF,
TCB_NAME_OFF,
XCPTCONTEXT_REGS,
{
.p = g_reg_offs,
},
};
#endif
/****************************************************************************

View file

@ -30,20 +30,11 @@
#include <arch/irq.h>
/****************************************************************************
* Public Data
* Private Data
****************************************************************************/
const struct tcbinfo_s g_tcbinfo =
static const uint16_t g_reg_offs[] =
{
TCB_PID_OFF,
TCB_STATE_OFF,
TCB_PRI_OFF,
#if CONFIG_TASK_NAME_SIZE > 0
TCB_NAME_OFF,
#endif
XCPTCONTEXT_REGS,
TCB_REG_OFF(REG_R0),
TCB_REG_OFF(REG_R1),
TCB_REG_OFF(REG_R2),
@ -62,17 +53,17 @@ const struct tcbinfo_s g_tcbinfo =
TCB_REG_OFF(REG_R15),
TCB_REG_OFF(REG_XPSR),
0,
0, /* msp */
TCB_REG_OFF(REG_R13),
#ifdef CONFIG_ARMV8M_USEBASEPRI
0,
0, /* primask */
TCB_REG_OFF(REG_BASEPRI),
#else
TCB_REG_OFF(REG_PRIMASK),
0,
0, /* basepri */
#endif
0,
0,
0, /* faultmask */
0, /* control */
#ifdef CONFIG_ARCH_FPU
TCB_REG_OFF(REG_S0),
@ -107,12 +98,26 @@ const struct tcbinfo_s g_tcbinfo =
TCB_REG_OFF(REG_S29),
TCB_REG_OFF(REG_S30),
TCB_REG_OFF(REG_S31),
0,
TCB_REG_OFF(REG_FPSCR),
0,
#endif
};
/****************************************************************************
* Public Data
****************************************************************************/
const struct tcbinfo_s g_tcbinfo =
{
TCB_PID_OFF,
TCB_STATE_OFF,
TCB_PRI_OFF,
TCB_NAME_OFF,
XCPTCONTEXT_REGS,
{
.p = g_reg_offs,
},
};
#endif
/****************************************************************************

View file

@ -30,21 +30,12 @@
#include <arch/irq.h>
/****************************************************************************
* Public Data
* Private Data
****************************************************************************/
const struct tcbinfo_s g_tcbinfo =
static const uint16_t g_reg_offs[] =
{
TCB_PID_OFF,
TCB_STATE_OFF,
TCB_PRI_OFF,
#if CONFIG_TASK_NAME_SIZE > 0
TCB_NAME_OFF,
#endif
XCPTCONTEXT_REGS,
0,
0, /* x0 */
TCB_REG_OFF(REG_X1_NDX),
TCB_REG_OFF(REG_X2_NDX),
TCB_REG_OFF(REG_X3_NDX),
@ -111,12 +102,28 @@ const struct tcbinfo_s g_tcbinfo =
TCB_REG_OFF(REG_F29_NDX),
TCB_REG_OFF(REG_F30_NDX),
TCB_REG_OFF(REG_F31_NDX),
0,
0,
0, /* fflags */
0, /* frm */
TCB_REG_OFF(REG_FCSR_NDX),
#endif
};
/****************************************************************************
* Public Data
****************************************************************************/
const struct tcbinfo_s g_tcbinfo =
{
TCB_PID_OFF,
TCB_STATE_OFF,
TCB_PRI_OFF,
TCB_NAME_OFF,
XCPTCONTEXT_REGS,
{
.p = g_reg_offs,
},
};
#endif
/****************************************************************************

View file

@ -247,7 +247,7 @@ static void elf_emit_note_info(FAR struct elf_dumpinfo_s *cinfo)
for (j = 0; j < ARRAY_SIZE(status.pr_regs); j++)
{
status.pr_regs[j] = *(uintptr_t *)((uint8_t *)tcb +
g_tcbinfo.reg_offs[j]);
g_tcbinfo.reg_off.p[j]);
}
elf_emit(cinfo, &status, sizeof(status));

View file

@ -186,13 +186,15 @@
#endif
#ifdef CONFIG_DEBUG_TCBINFO
# define TCB_PID_OFF (offsetof(struct tcb_s, pid))
# define TCB_STATE_OFF (offsetof(struct tcb_s, task_state))
# define TCB_PRI_OFF (offsetof(struct tcb_s, sched_priority))
# define TCB_PID_OFF offsetof(struct tcb_s, pid)
# define TCB_STATE_OFF offsetof(struct tcb_s, task_state)
# define TCB_PRI_OFF offsetof(struct tcb_s, sched_priority)
#if CONFIG_TASK_NAME_SIZE > 0
# define TCB_NAME_OFF (offsetof(struct tcb_s, name))
# define TCB_NAME_OFF offsetof(struct tcb_s, name)
#else
# define TCB_NAME_OFF 0
#endif
# define TCB_REG_OFF(reg) (offsetof(struct tcb_s, xcp.regs[reg]))
# define TCB_REG_OFF(reg) offsetof(struct tcb_s, xcp.regs[reg])
#endif
/****************************************************************************
@ -772,7 +774,7 @@ struct tcbinfo_s
uint16_t name_off; /* Offset of tcb.name */
uint16_t reg_num; /* Num of regs in tcbinfo.reg_offs */
/* Offsets of xcp.regs, order in GDB org.gnu.gdb.xxx feature.
/* Offset pointer of xcp.regs, order in GDB org.gnu.gdb.xxx feature.
* Please refer:
* https://sourceware.org/gdb/current/onlinedocs/gdb/ARM-Features.html
* https://sourceware.org/gdb/current/onlinedocs/gdb/RISC_002dV-Features
@ -780,7 +782,11 @@ struct tcbinfo_s
* value 0: This regsiter was not priovided by NuttX
*/
uint16_t reg_offs[XCPTCONTEXT_REGS];
union
{
uint8_t u[8];
FAR uint16_t *p;
} reg_off;
};
#endif