You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2022/01/27 09:36:34 UTC

[incubator-nuttx] branch master updated (dad4a7f -> 6578461)

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git.


    from dad4a7f  symtab_findbyvalue: just retun NULL for NULL symtab
     new f903a55  sched/tcbinfo: Fix the compile warning
     new 8f1c6ee  tools/jlink-nuttx: update tcbinfo follow nuttx arch tcbinfo_s
     new 6578461  tcbinfo: add packet align to struct tcbinfo

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 arch/arm/src/arm/arm_tcbinfo.c         | 29 +++++++++++++++---------
 arch/arm/src/armv6-m/arm_tcbinfo.c     | 37 +++++++++++++++++-------------
 arch/arm/src/armv7-a/arm_tcbinfo.c     | 31 ++++++++++++++-----------
 arch/arm/src/armv7-m/arm_tcbinfo.c     | 41 +++++++++++++++++++---------------
 arch/arm/src/armv7-r/arm_tcbinfo.c     | 31 ++++++++++++++-----------
 arch/arm/src/armv8-m/arm_tcbinfo.c     | 41 +++++++++++++++++++---------------
 arch/risc-v/src/common/riscv_tcbinfo.c | 35 +++++++++++++++++------------
 binfmt/libelf/libelf_coredump.c        |  2 +-
 include/nuttx/sched.h                  | 24 ++++++++++++--------
 tools/jlink-nuttx.c                    | 28 ++++++++++++++++++++---
 10 files changed, 184 insertions(+), 115 deletions(-)

[incubator-nuttx] 01/03: sched/tcbinfo: Fix the compile warning

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit f903a5510277b312469fd9aff7f744108ac71f1e
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Mon Dec 27 11:09:38 2021 +0800

    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 <xi...@xiaomi.com>
    Signed-off-by: zhuyanlin <zh...@xiaomi.com>
---
 arch/arm/src/arm/arm_tcbinfo.c         | 29 +++++++++++++++---------
 arch/arm/src/armv6-m/arm_tcbinfo.c     | 37 +++++++++++++++++-------------
 arch/arm/src/armv7-a/arm_tcbinfo.c     | 31 ++++++++++++++-----------
 arch/arm/src/armv7-m/arm_tcbinfo.c     | 41 +++++++++++++++++++---------------
 arch/arm/src/armv7-r/arm_tcbinfo.c     | 31 ++++++++++++++-----------
 arch/arm/src/armv8-m/arm_tcbinfo.c     | 41 +++++++++++++++++++---------------
 arch/risc-v/src/common/riscv_tcbinfo.c | 35 +++++++++++++++++------------
 binfmt/libelf/libelf_coredump.c        |  2 +-
 include/nuttx/sched.h                  | 20 +++++++++++------
 9 files changed, 157 insertions(+), 110 deletions(-)

diff --git a/arch/arm/src/arm/arm_tcbinfo.c b/arch/arm/src/arm/arm_tcbinfo.c
index 2438ded..ad350f5 100644
--- a/arch/arm/src/arm/arm_tcbinfo.c
+++ b/arch/arm/src/arm/arm_tcbinfo.c
@@ -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
 
 /****************************************************************************
diff --git a/arch/arm/src/armv6-m/arm_tcbinfo.c b/arch/arm/src/armv6-m/arm_tcbinfo.c
index 989fd35..c9f1b2a 100644
--- a/arch/arm/src/armv6-m/arm_tcbinfo.c
+++ b/arch/arm/src/armv6-m/arm_tcbinfo.c
@@ -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
diff --git a/arch/arm/src/armv7-a/arm_tcbinfo.c b/arch/arm/src/armv7-a/arm_tcbinfo.c
index 84de7bb..5abd5b5 100644
--- a/arch/arm/src/armv7-a/arm_tcbinfo.c
+++ b/arch/arm/src/armv7-a/arm_tcbinfo.c
@@ -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
 
 /****************************************************************************
diff --git a/arch/arm/src/armv7-m/arm_tcbinfo.c b/arch/arm/src/armv7-m/arm_tcbinfo.c
index d9e3321..d212591 100644
--- a/arch/arm/src/armv7-m/arm_tcbinfo.c
+++ b/arch/arm/src/armv7-m/arm_tcbinfo.c
@@ -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
 
 /****************************************************************************
diff --git a/arch/arm/src/armv7-r/arm_tcbinfo.c b/arch/arm/src/armv7-r/arm_tcbinfo.c
index 7124b6b..9caf2f5 100644
--- a/arch/arm/src/armv7-r/arm_tcbinfo.c
+++ b/arch/arm/src/armv7-r/arm_tcbinfo.c
@@ -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
 
 /****************************************************************************
diff --git a/arch/arm/src/armv8-m/arm_tcbinfo.c b/arch/arm/src/armv8-m/arm_tcbinfo.c
index f34eb0f..6ec9219 100644
--- a/arch/arm/src/armv8-m/arm_tcbinfo.c
+++ b/arch/arm/src/armv8-m/arm_tcbinfo.c
@@ -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
 
 /****************************************************************************
diff --git a/arch/risc-v/src/common/riscv_tcbinfo.c b/arch/risc-v/src/common/riscv_tcbinfo.c
index 5599587..bca8cff 100644
--- a/arch/risc-v/src/common/riscv_tcbinfo.c
+++ b/arch/risc-v/src/common/riscv_tcbinfo.c
@@ -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
 
 /****************************************************************************
diff --git a/binfmt/libelf/libelf_coredump.c b/binfmt/libelf/libelf_coredump.c
index 2771d2f..a012ce4 100644
--- a/binfmt/libelf/libelf_coredump.c
+++ b/binfmt/libelf/libelf_coredump.c
@@ -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));
diff --git a/include/nuttx/sched.h b/include/nuttx/sched.h
index bee03da..05d0de8 100644
--- a/include/nuttx/sched.h
+++ b/include/nuttx/sched.h
@@ -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
 

[incubator-nuttx] 02/03: tools/jlink-nuttx: update tcbinfo follow nuttx arch tcbinfo_s

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 8f1c6ee7bc1651c96789605305e6914e0047c7cf
Author: zhuyanlin <zh...@xiaomi.com>
AuthorDate: Tue Dec 28 15:34:34 2021 +0800

    tools/jlink-nuttx: update tcbinfo follow nuttx arch tcbinfo_s
    
    Signed-off-by: zhuyanlin <zh...@xiaomi.com>
---
 tools/jlink-nuttx.c | 26 ++++++++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)

diff --git a/tools/jlink-nuttx.c b/tools/jlink-nuttx.c
index ee20c94..245f759 100644
--- a/tools/jlink-nuttx.c
+++ b/tools/jlink-nuttx.c
@@ -79,6 +79,11 @@ struct tcbinfo_s
   uint16_t pri_off;
   uint16_t name_off;
   uint16_t reg_num;
+  union
+  {
+    uint8_t  u[8];
+    uint16_t *p;
+  } reg_off;
   uint16_t reg_offs[0];
 };
 
@@ -249,6 +254,7 @@ static int update_tcbinfo(struct plugin_priv_s *priv)
     {
       uint16_t reg_num;
       int ret;
+      uint32_t reg_off;
 
       ret = READU16(g_symbols[TCBINFO].address +
                     offsetof(struct tcbinfo_s, reg_num), &reg_num);
@@ -258,6 +264,14 @@ static int update_tcbinfo(struct plugin_priv_s *priv)
           return ret;
         }
 
+      ret = READU32(g_symbols[TCBINFO].address +
+                    offsetof(struct tcbinfo_s, reg_off), &reg_off);
+      if (ret != 0 || !reg_off)
+        {
+          PERROR("error in read regoffs address ret %d\n", ret);
+          return ret;
+        }
+
       priv->tcbinfo = ALLOC(sizeof(struct tcbinfo_s) +
                             reg_num * sizeof(uint16_t));
 
@@ -268,13 +282,21 @@ static int update_tcbinfo(struct plugin_priv_s *priv)
         }
 
       ret = READMEM(g_symbols[TCBINFO].address, (char *)priv->tcbinfo,
-                    sizeof(struct tcbinfo_s) + reg_num * sizeof(uint16_t));
-      if (ret != sizeof(struct tcbinfo_s) + reg_num * sizeof(uint16_t))
+                    sizeof(struct tcbinfo_s));
+      if (ret != sizeof(struct tcbinfo_s))
         {
           PERROR("error in read tcbinfo_s ret %d\n", ret);
           return ret;
         }
 
+      ret = READMEM(reg_off, (char *)&priv->tcbinfo->reg_offs[0],
+                    reg_num * sizeof(uint16_t));
+      if (ret != reg_num * sizeof(uint16_t))
+        {
+          PERROR("error in read tcbinfo_s reg_offs ret %d\n", ret);
+          return ret;
+        }
+
       PLOG("setup success! regs %d\n", priv->tcbinfo->reg_num);
     }
 

[incubator-nuttx] 03/03: tcbinfo: add packet align to struct tcbinfo

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 6578461cc8fa05014f5ce6b4b8ea1caf83fc14dd
Author: zhuyanlin <zh...@xiaomi.com>
AuthorDate: Thu Jan 13 20:31:51 2022 +0800

    tcbinfo: add packet align to struct tcbinfo
    
    Signed-off-by: zhuyanlin <zh...@xiaomi.com>
---
 include/nuttx/sched.h | 4 ++--
 tools/jlink-nuttx.c   | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/nuttx/sched.h b/include/nuttx/sched.h
index 05d0de8..710c2ef 100644
--- a/include/nuttx/sched.h
+++ b/include/nuttx/sched.h
@@ -766,7 +766,7 @@ struct pthread_tcb_s
  */
 
 #ifdef CONFIG_DEBUG_TCBINFO
-struct tcbinfo_s
+begin_packed_struct struct tcbinfo_s
 {
   uint16_t pid_off;                      /* Offset of tcb.pid               */
   uint16_t state_off;                    /* Offset of tcb.task_state        */
@@ -787,7 +787,7 @@ struct tcbinfo_s
     uint8_t       u[8];
     FAR uint16_t *p;
   } reg_off;
-};
+} end_packed_struct;
 #endif
 
 /* This is the callback type used by nxsched_foreach() */
diff --git a/tools/jlink-nuttx.c b/tools/jlink-nuttx.c
index 245f759..b7597df 100644
--- a/tools/jlink-nuttx.c
+++ b/tools/jlink-nuttx.c
@@ -72,7 +72,7 @@ enum symbol_e
   NSYMBOLS
 };
 
-struct tcbinfo_s
+__attribute__ ((packed)) struct tcbinfo_s
 {
   uint16_t pid_off;
   uint16_t state_off;