1
0
Fork 0
forked from nuttx/nuttx-update

tools/jlink-nuttx: update tcbinfo follow nuttx arch tcbinfo_s

Signed-off-by: zhuyanlin <zhuyanlin1@xiaomi.com>
This commit is contained in:
zhuyanlin 2021-12-28 15:34:34 +08:00 committed by Xiang Xiao
parent f903a55102
commit 8f1c6ee7bc

View file

@ -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);
}