1
0
mirror of https://git.code.sf.net/p/openocd/code synced 2024-11-25 04:06:24 +00:00
openocd/contrib/rtos-helpers/uCOS-III-openocd.c
Antonio Borneo d7ee0e422e contrib/rtos-helpers/uCOS-III-openocd: change license to Apache-2.0
This file is intended to be included in any user's project that
plans to use OpenOCD awareness for uCOS-III.
It is supposed to be distributed under a license compatible with
the uCOS-III code, that is Apache-2.0 license.

Distribute it under Apache License 2.0.

Change-Id: I51ecd469c8ccdd23a069d21e89b7d90886691395
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7996
Tested-by: jenkins
2024-01-21 21:27:11 +00:00

44 lines
1.6 KiB
C

// SPDX-License-Identifier: Apache-2.0
/*
* The original version of this file did not reported any license nor
* copyright, but the author clearly stated that:
* "This file should be linked along with the [uC/OS-III user's] project
* to enable RTOS support for uC/OS-III."
* Such statement implies the willing to have this file's license compatible
* with the license Apache 2.0 of uC/OS-III.
*/
/*
* 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 necessary 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);