hla_target: allow non-intrusive profiling on cortex-m
[openocd.git] / contrib / rtos-helpers / uCOS-III-openocd.c
blob9037334f2dce3deccc03cbafff28e7f95c773a47
1 /*
2 * uC/OS-III does not provide a fixed layout for OS_TCB, which makes it
3 * impossible to determine the appropriate offsets within the structure
4 * unaided. A priori knowledge of offsets based on os_dbg.c is tied to a
5 * specific release and thusly, brittle. The constants defined below
6 * provide the neccessary information OpenOCD needs to provide support
7 * in the most robust manner possible.
9 * This file should be linked along with the project to enable RTOS
10 * support for uC/OS-III.
13 #include <os.h>
15 #if OS_CFG_DBG_EN == 0
16 #error "OS_CFG_DBG_EN is required to enable RTOS support for OpenOCD"
17 #endif
19 #define OFFSET_OF(type, member) ((CPU_SIZE_T)&(((type *)0)->member))
21 #ifdef __GNUC__
22 #define USED __attribute__((used))
23 #else
24 #define USED
25 #endif
27 const CPU_SIZE_T USED openocd_OS_TCB_StkPtr_offset = OFFSET_OF(OS_TCB, StkPtr);
28 const CPU_SIZE_T USED openocd_OS_TCB_NamePtr_offset = OFFSET_OF(OS_TCB, NamePtr);
29 const CPU_SIZE_T USED openocd_OS_TCB_TaskState_offset = OFFSET_OF(OS_TCB, TaskState);
30 const CPU_SIZE_T USED openocd_OS_TCB_Prio_offset = OFFSET_OF(OS_TCB, Prio);
31 const CPU_SIZE_T USED openocd_OS_TCB_DbgPrevPtr_offset = OFFSET_OF(OS_TCB, DbgPrevPtr);
32 const CPU_SIZE_T USED openocd_OS_TCB_DbgNextPtr_offset = OFFSET_OF(OS_TCB, DbgNextPtr);