diff --git a/include/nuttx/sched.h b/include/nuttx/sched.h index 9c15efaf603..2d8395e0b02 100644 --- a/include/nuttx/sched.h +++ b/include/nuttx/sched.h @@ -781,11 +781,13 @@ begin_packed_struct struct tcbinfo_s * value 0: This regsiter was not priovided by NuttX */ + begin_packed_struct union { uint8_t u[8]; FAR const uint16_t *p; - } reg_off; + } + end_packed_struct reg_off; } end_packed_struct; #endif diff --git a/tools/.gitignore b/tools/.gitignore index abded4c6ce9..6d6b124ab86 100644 --- a/tools/.gitignore +++ b/tools/.gitignore @@ -19,3 +19,4 @@ /incdir /.k2h-body.dat /.k2h-apndx.dat +/jlink-nuttx.so diff --git a/tools/jlink-nuttx.c b/tools/jlink-nuttx.c index b7597dfad7f..11ecc76c7bb 100644 --- a/tools/jlink-nuttx.c +++ b/tools/jlink-nuttx.c @@ -59,6 +59,25 @@ #define PERROR g_plugin_priv.jops->erroroutf #define PLOG g_plugin_priv.jops->logoutf +/* GCC specific definitions */ + +#ifdef __GNUC__ + +/* The packed attribute informs GCC that the structure elements are packed, + * ignoring other alignment rules. + */ + +# define begin_packed_struct +# define end_packed_struct __attribute__ ((packed)) + +#else + +# warning "Unsupported compiler" +# define begin_packed_struct +# define end_packed_struct + +#endif + /**************************************************************************** * Private Types ****************************************************************************/ @@ -72,20 +91,22 @@ enum symbol_e NSYMBOLS }; -__attribute__ ((packed)) struct tcbinfo_s +begin_packed_struct struct tcbinfo_s { uint16_t pid_off; uint16_t state_off; uint16_t pri_off; uint16_t name_off; uint16_t reg_num; + begin_packed_struct union { uint8_t u[8]; uint16_t *p; - } reg_off; + } + end_packed_struct reg_off; uint16_t reg_offs[0]; -}; +} end_packed_struct; struct symbols_s { diff --git a/tools/nxstyle.c b/tools/nxstyle.c index f22a55a9c89..846780ea221 100644 --- a/tools/nxstyle.c +++ b/tools/nxstyle.c @@ -324,6 +324,24 @@ static const char *g_white_list[] = "__asan_loadN_noabort", "__asan_storeN_noabort", + /* Ref: + * tools/jlink-nuttx.c + */ + + "RTOS_Init", + "RTOS_GetVersion", + "RTOS_GetSymbols", + "RTOS_GetNumThreads", + "RTOS_GetCurrentThreadId", + "RTOS_GetThreadId", + "RTOS_GetThreadDisplay", + "RTOS_GetThreadReg", + "RTOS_GetThreadRegList", + "RTOS_GetThreadRegList", + "RTOS_SetThreadReg", + "RTOS_SetThreadRegList", + "RTOS_UpdateThreads", + NULL };