aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorSteven Stallion <stallion@squareup.com>2016-07-15 22:01:00 -0500
committerPaul Fertser <fercerpav@gmail.com>2016-12-08 12:29:35 +0000
commit1eae39b40d5338e96194ad3c83949718a857a2a2 (patch)
treeff2be9ba5afebdac70a69754db6ba49c908e3709 /contrib
parent29964c79846ea419e113dc90c0d74f1a7e16e70a (diff)
rtos: add support for uC/OS-III
This patch introduces RTOS support for uC/OS-III. Currently, only FPU-less ARM Cortex-M targets are supported. Due to the configurability of the RTOS, an OpenOCD-specific file must be linked along with the project to determine the correct offsets within the OS_TCB structure. In addition to the above, a crash was fixed in rtos_get_gdb_reg_list such that RTOS support could be used between resets without restarting OpenOCD and support for the Hg packet was cleaned up. Change-Id: Ide004a689e6b886185df665c00fb644629eb31d1 Signed-off-by: Steven Stallion <stallion@squareup.com> Reviewed-on: http://openocd.zylin.com/3556 Tested-by: jenkins Reviewed-by: Paul Fertser <fercerpav@gmail.com>
Diffstat (limited to 'contrib')
-rw-r--r--contrib/rtos-helpers/uCOS-III-openocd.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/contrib/rtos-helpers/uCOS-III-openocd.c b/contrib/rtos-helpers/uCOS-III-openocd.c
new file mode 100644
index 00000000..9037334f
--- /dev/null
+++ b/contrib/rtos-helpers/uCOS-III-openocd.c
@@ -0,0 +1,32 @@
+/*
+ * uC/OS-III does not provide a fixed layout for OS_TCB, which makes it
+ * impossible to determine the appropriate offsets within the structure
+ * unaided. A priori knowledge of offsets based on os_dbg.c is tied to a
+ * specific release and thusly, brittle. The constants defined below
+ * provide the neccessary information OpenOCD needs to provide support
+ * in the most robust manner possible.
+ *
+ * This file should be linked along with the project to enable RTOS
+ * support for uC/OS-III.
+ */
+
+#include <os.h>
+
+#if OS_CFG_DBG_EN == 0
+#error "OS_CFG_DBG_EN is required to enable RTOS support for OpenOCD"
+#endif
+
+#define OFFSET_OF(type, member) ((CPU_SIZE_T)&(((type *)0)->member))
+
+#ifdef __GNUC__
+#define USED __attribute__((used))
+#else
+#define USED
+#endif
+
+const CPU_SIZE_T USED openocd_OS_TCB_StkPtr_offset = OFFSET_OF(OS_TCB, StkPtr);
+const CPU_SIZE_T USED openocd_OS_TCB_NamePtr_offset = OFFSET_OF(OS_TCB, NamePtr);
+const CPU_SIZE_T USED openocd_OS_TCB_TaskState_offset = OFFSET_OF(OS_TCB, TaskState);
+const CPU_SIZE_T USED openocd_OS_TCB_Prio_offset = OFFSET_OF(OS_TCB, Prio);
+const CPU_SIZE_T USED openocd_OS_TCB_DbgPrevPtr_offset = OFFSET_OF(OS_TCB, DbgPrevPtr);
+const CPU_SIZE_T USED openocd_OS_TCB_DbgNextPtr_offset = OFFSET_OF(OS_TCB, DbgNextPtr);