OpenOCD
eCos.c File Reference
Include dependency graph for eCos.c:

Go to the source code of this file.

Data Structures

struct  ecos_params
 
struct  ecos_thread_state
 
struct  symbols
 

Macros

#define ECOS_CORTEXM_BASE_NUMREGS   (ARMV7M_NUM_CORE_REGS)
 
#define ECOS_MAX_THREAD_COUNT   (4095)
 
#define ECOS_NUM_PARAMS   ARRAY_SIZE(ecos_params_list)
 
#define ECOS_THREAD_NAME_STR_SIZE   (200)
 
#define ECOSSYM(_n, _o, _t)   { .name = _n, .optional = (_o), .target_names = _t }
 
#define XMLENTRY(_c, _s)   { .xc = (_c), .rs = (_s), .rlen = (sizeof(_s) - 1) }
 

Enumerations

enum  ecos_reglist_cortexm {
  ECOS_REGLIST_R0 = 0 , ECOS_REGLIST_R1 , ECOS_REGLIST_R2 , ECOS_REGLIST_R3 ,
  ECOS_REGLIST_R4 , ECOS_REGLIST_R5 , ECOS_REGLIST_R6 , ECOS_REGLIST_R7 ,
  ECOS_REGLIST_R8 , ECOS_REGLIST_R9 , ECOS_REGLIST_R10 , ECOS_REGLIST_R11 ,
  ECOS_REGLIST_R12 , ECOS_REGLIST_R13 , ECOS_REGLIST_R14 , ECOS_REGLIST_PC ,
  ECOS_REGLIST_XPSR , ECOS_REGLIST_BASEPRI , ECOS_REGLIST_FPSCR , ECOS_REGLIST_D0 ,
  ECOS_REGLIST_D1 , ECOS_REGLIST_D2 , ECOS_REGLIST_D3 , ECOS_REGLIST_D4 ,
  ECOS_REGLIST_D5 , ECOS_REGLIST_D6 , ECOS_REGLIST_D7 , ECOS_REGLIST_D8 ,
  ECOS_REGLIST_D9 , ECOS_REGLIST_D10 , ECOS_REGLIST_D11 , ECOS_REGLIST_D12 ,
  ECOS_REGLIST_D13 , ECOS_REGLIST_D14 , ECOS_REGLIST_D15
}
 
enum  ecos_symbol_values {
  ECOS_VAL_THREAD_LIST = 0 , ECOS_VAL_CURRENT_THREAD_PTR , ECOS_VAL_COMMON_THREAD_NEXT_OFF , ECOS_VAL_COMMON_THREAD_NEXT_SIZE ,
  ECOS_VAL_COMMON_THREAD_STATE_OFF , ECOS_VAL_COMMON_THREAD_STATE_SIZE , ECOS_VAL_COMMON_THREAD_SLEEP_OFF , ECOS_VAL_COMMON_THREAD_SLEEP_SIZE ,
  ECOS_VAL_COMMON_THREAD_WAKE_OFF , ECOS_VAL_COMMON_THREAD_WAKE_SIZE , ECOS_VAL_COMMON_THREAD_ID_OFF , ECOS_VAL_COMMON_THREAD_ID_SIZE ,
  ECOS_VAL_COMMON_THREAD_NAME_OFF , ECOS_VAL_COMMON_THREAD_NAME_SIZE , ECOS_VAL_COMMON_THREAD_PRI_OFF , ECOS_VAL_COMMON_THREAD_PRI_SIZE ,
  ECOS_VAL_COMMON_THREAD_STACK_OFF , ECOS_VAL_COMMON_THREAD_STACK_SIZE , ECOS_VAL_CORTEXM_THREAD_SAVED , ECOS_VAL_CORTEXM_CTX_THREAD_SIZE ,
  ECOS_VAL_CORTEXM_CTX_TYPE_OFF , ECOS_VAL_CORTEXM_CTX_TYPE_SIZE , ECOS_VAL_CORTEXM_CTX_BASEPRI_OFF , ECOS_VAL_CORTEXM_CTX_BASEPRI_SIZE ,
  ECOS_VAL_CORTEXM_CTX_SP_OFF , ECOS_VAL_CORTEXM_CTX_SP_SIZE , ECOS_VAL_CORTEXM_CTX_REG_OFF , ECOS_VAL_CORTEXM_CTX_REG_SIZE ,
  ECOS_VAL_CORTEXM_CTX_PC_OFF , ECOS_VAL_CORTEXM_CTX_PC_SIZE , ECOS_VAL_CORTEXM_VAL_EXCEPTION , ECOS_VAL_CORTEXM_VAL_THREAD ,
  ECOS_VAL_CORTEXM_VAL_INTERRUPT , ECOS_VAL_CORTEXM_VAL_FPU , ECOS_VAL_CORTEXM_CTX_FPSCR_OFF , ECOS_VAL_CORTEXM_CTX_FPSCR_SIZE ,
  ECOS_VAL_CORTEXM_CTX_S_OFF , ECOS_VAL_CORTEXM_CTX_S_SIZE , ECOS_VAL_ARM_REGSIZE , ECOS_VAL_ARM_CTX_R0_OFF ,
  ECOS_VAL_ARM_CTX_R1_OFF , ECOS_VAL_ARM_CTX_R2_OFF , ECOS_VAL_ARM_CTX_R3_OFF , ECOS_VAL_ARM_CTX_R4_OFF ,
  ECOS_VAL_ARM_CTX_R5_OFF , ECOS_VAL_ARM_CTX_R6_OFF , ECOS_VAL_ARM_CTX_R7_OFF , ECOS_VAL_ARM_CTX_R8_OFF ,
  ECOS_VAL_ARM_CTX_R9_OFF , ECOS_VAL_ARM_CTX_R10_OFF , ECOS_VAL_ARM_CTX_FP_OFF , ECOS_VAL_ARM_CTX_IP_OFF ,
  ECOS_VAL_ARM_CTX_SP_OFF , ECOS_VAL_ARM_CTX_LR_OFF , ECOS_VAL_ARM_CTX_PC_OFF , ECOS_VAL_ARM_CTX_CPSR_OFF ,
  ECOS_VAL_ARM_FPUSIZE , ECOS_VAL_ARM_CTX_FPSCR_OFF , ECOS_VAL_ARM_SCOUNT , ECOS_VAL_ARM_CTX_SVEC_OFF ,
  ECOS_VAL_ARM_VFPCOUNT , ECOS_VAL_ARM_CTX_VFPVEC_OFF
}
 
enum  ecos_thread_state_flags {
  RUNNING = 0 , SLEEPING = BIT(0) , COUNTSLEEP = BIT(1) , SUSPENDED = BIT(2) ,
  CREATING = BIT(3) , EXITED = BIT(4) , SLEEPSET = (SLEEPING | COUNTSLEEP)
}
 

Functions

static int ecos_check_app_info (struct rtos *rtos, struct ecos_params *param)
 
static int ecos_create (struct target *target)
 
static bool ecos_detect_rtos (struct target *target)
 
static bool ecos_escape_string (const char *raw, char *out, size_t limit)
 Escape any XML reserved characters in a string. More...
 
static int ecos_get_symbol_list_to_lookup (struct symbol_table_elem *symbol_list[])
 
static int ecos_get_thread_reg_list (struct rtos *rtos, int64_t thread_id, struct rtos_reg **reg_list, int *num_regs)
 
static int ecos_packet_hook (struct connection *connection, const char *packet, int packet_size)
 
static int ecos_stack_layout_arm (struct rtos *rtos, struct ecos_params *param, int64_t stack_ptr, const struct rtos_register_stacking **si)
 
static int ecos_stack_layout_cortexm (struct rtos *rtos, struct ecos_params *param, int64_t stack_ptr, const struct rtos_register_stacking **si)
 
static int ecos_update_threads (struct rtos *rtos)
 
static symbol_address_t ecos_value (struct rtos *rtos, unsigned int idx)
 

Variables

static struct ecos_params ecos_params_list []
 
const struct rtos_type ecos_rtos
 
static const struct symbols ecos_symbol_list []
 
static const struct ecos_thread_state ecos_thread_reasons []
 
static struct stack_register_offset rtos_ecos_regoff_arm []
 
static struct stack_register_offset rtos_ecos_regoff_cortexm []
 
static struct rtos_register_stacking rtos_ecos_stacking
 
static const char *const target_arm []
 
static const char *const target_cortex_m []
 
struct {
   size_t   rlen
 
   const char *   rs
 
   char   xc
 
xmlchars []
 

Macro Definition Documentation

◆ ECOS_CORTEXM_BASE_NUMREGS

#define ECOS_CORTEXM_BASE_NUMREGS   (ARMV7M_NUM_CORE_REGS)

Definition at line 229 of file eCos.c.

◆ ECOS_MAX_THREAD_COUNT

#define ECOS_MAX_THREAD_COUNT   (4095)

Definition at line 66 of file eCos.c.

◆ ECOS_NUM_PARAMS

#define ECOS_NUM_PARAMS   ARRAY_SIZE(ecos_params_list)

Definition at line 182 of file eCos.c.

◆ ECOS_THREAD_NAME_STR_SIZE

#define ECOS_THREAD_NAME_STR_SIZE   (200)

◆ ECOSSYM

#define ECOSSYM (   _n,
  _o,
  _t 
)    { .name = _n, .optional = (_o), .target_names = _t }

Definition at line 374 of file eCos.c.

◆ XMLENTRY

#define XMLENTRY (   _c,
  _s 
)    { .xc = (_c), .rs = (_s), .rlen = (sizeof(_s) - 1) }

Definition at line 476 of file eCos.c.

Enumeration Type Documentation

◆ ecos_reglist_cortexm

Enumerator
ECOS_REGLIST_R0 
ECOS_REGLIST_R1 
ECOS_REGLIST_R2 
ECOS_REGLIST_R3 
ECOS_REGLIST_R4 
ECOS_REGLIST_R5 
ECOS_REGLIST_R6 
ECOS_REGLIST_R7 
ECOS_REGLIST_R8 
ECOS_REGLIST_R9 
ECOS_REGLIST_R10 
ECOS_REGLIST_R11 
ECOS_REGLIST_R12 
ECOS_REGLIST_R13 
ECOS_REGLIST_R14 
ECOS_REGLIST_PC 
ECOS_REGLIST_XPSR 
ECOS_REGLIST_BASEPRI 
ECOS_REGLIST_FPSCR 
ECOS_REGLIST_D0 
ECOS_REGLIST_D1 
ECOS_REGLIST_D2 
ECOS_REGLIST_D3 
ECOS_REGLIST_D4 
ECOS_REGLIST_D5 
ECOS_REGLIST_D6 
ECOS_REGLIST_D7 
ECOS_REGLIST_D8 
ECOS_REGLIST_D9 
ECOS_REGLIST_D10 
ECOS_REGLIST_D11 
ECOS_REGLIST_D12 
ECOS_REGLIST_D13 
ECOS_REGLIST_D14 
ECOS_REGLIST_D15 

Definition at line 191 of file eCos.c.

◆ ecos_symbol_values

Enumerator
ECOS_VAL_THREAD_LIST 
ECOS_VAL_CURRENT_THREAD_PTR 
ECOS_VAL_COMMON_THREAD_NEXT_OFF 
ECOS_VAL_COMMON_THREAD_NEXT_SIZE 
ECOS_VAL_COMMON_THREAD_STATE_OFF 
ECOS_VAL_COMMON_THREAD_STATE_SIZE 
ECOS_VAL_COMMON_THREAD_SLEEP_OFF 
ECOS_VAL_COMMON_THREAD_SLEEP_SIZE 
ECOS_VAL_COMMON_THREAD_WAKE_OFF 
ECOS_VAL_COMMON_THREAD_WAKE_SIZE 
ECOS_VAL_COMMON_THREAD_ID_OFF 
ECOS_VAL_COMMON_THREAD_ID_SIZE 
ECOS_VAL_COMMON_THREAD_NAME_OFF 
ECOS_VAL_COMMON_THREAD_NAME_SIZE 
ECOS_VAL_COMMON_THREAD_PRI_OFF 
ECOS_VAL_COMMON_THREAD_PRI_SIZE 
ECOS_VAL_COMMON_THREAD_STACK_OFF 
ECOS_VAL_COMMON_THREAD_STACK_SIZE 
ECOS_VAL_CORTEXM_THREAD_SAVED 
ECOS_VAL_CORTEXM_CTX_THREAD_SIZE 
ECOS_VAL_CORTEXM_CTX_TYPE_OFF 
ECOS_VAL_CORTEXM_CTX_TYPE_SIZE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VFPCOUNT 
ECOS_VAL_ARM_CTX_VFPVEC_OFF 

Definition at line 303 of file eCos.c.

◆ ecos_thread_state_flags

Enumerator
RUNNING 
SLEEPING 
COUNTSLEEP 
SUSPENDED 
CREATING 
EXITED 
SLEEPSET 

Definition at line 74 of file eCos.c.

Function Documentation

◆ ecos_check_app_info()

◆ ecos_create()

◆ ecos_detect_rtos()

static bool ecos_detect_rtos ( struct target target)
static

Definition at line 1153 of file eCos.c.

References symbol_table_elem::address, ECOS_VAL_THREAD_LIST, target::rtos, and rtos::symbols.

◆ ecos_escape_string()

static bool ecos_escape_string ( const char *  raw,
char *  out,
size_t  limit 
)
static

Escape any XML reserved characters in a string.

Definition at line 491 of file eCos.c.

References LOG_ERROR, rs, and xmlchars.

Referenced by ecos_update_threads().

◆ ecos_get_symbol_list_to_lookup()

static int ecos_get_symbol_list_to_lookup ( struct symbol_table_elem symbol_list[])
static

Definition at line 1132 of file eCos.c.

References ARRAY_SIZE, ecos_symbol_list, symbols::name, and symbols::optional.

◆ ecos_get_thread_reg_list()

◆ ecos_packet_hook()

static int ecos_packet_hook ( struct connection connection,
const char *  packet,
int  packet_size 
)
static

◆ ecos_stack_layout_arm()

◆ ecos_stack_layout_cortexm()

◆ ecos_update_threads()

◆ ecos_value()

static symbol_address_t ecos_value ( struct rtos rtos,
unsigned int  idx 
)
static

Variable Documentation

◆ ecos_params_list

struct ecos_params ecos_params_list[]
static
Initial value:
= {
{
.target_names = target_cortex_m,
.pointer_width = 4,
.uid_width = 2,
.state_width = 4,
.thread_stack_offset = 0x0c,
.thread_name_offset = 0x9c,
.thread_state_offset = 0x3c,
.thread_next_offset = 0xa0,
.thread_uniqueid_offset = 0x4c,
.target_stack_layout = ecos_stack_layout_cortexm,
.stacking_info = NULL
},
{
.target_names = target_arm,
.pointer_width = 0,
.uid_width = 0,
.state_width = 0,
.thread_stack_offset = 0,
.thread_name_offset = 0,
.thread_state_offset = 0,
.thread_next_offset = 0,
.thread_uniqueid_offset = 0,
.target_stack_layout = ecos_stack_layout_arm,
.stacking_info = NULL
}
}
static const char *const target_cortex_m[]
Definition: eCos.c:96
static int ecos_stack_layout_cortexm(struct rtos *rtos, struct ecos_params *param, int64_t stack_ptr, const struct rtos_register_stacking **si)
Definition: eCos.c:587
static int ecos_stack_layout_arm(struct rtos *rtos, struct ecos_params *param, int64_t stack_ptr, const struct rtos_register_stacking **si)
Definition: eCos.c:659
static const char *const target_arm[]
Definition: eCos.c:102
#define NULL
Definition: usb.h:16

Definition at line 102 of file eCos.c.

Referenced by ecos_create().

◆ ecos_rtos

const struct rtos_type ecos_rtos
Initial value:
= {
.name = "eCos",
.detect_rtos = ecos_detect_rtos,
.create = ecos_create,
.update_threads = ecos_update_threads,
.get_thread_reg_list = ecos_get_thread_reg_list,
.get_symbol_list_to_lookup = ecos_get_symbol_list_to_lookup,
}
static bool ecos_detect_rtos(struct target *target)
Definition: eCos.c:1153
static int ecos_update_threads(struct rtos *rtos)
Definition: eCos.c:704
static int ecos_get_symbol_list_to_lookup(struct symbol_table_elem *symbol_list[])
Definition: eCos.c:1132
static int ecos_create(struct target *target)
Definition: eCos.c:1186
static int ecos_get_thread_reg_list(struct rtos *rtos, int64_t thread_id, struct rtos_reg **reg_list, int *num_regs)
Definition: eCos.c:1031

Definition at line 102 of file eCos.c.

◆ ecos_symbol_list

const struct symbols ecos_symbol_list[]
static

Definition at line 102 of file eCos.c.

Referenced by ecos_check_app_info(), ecos_get_symbol_list_to_lookup(), and ecos_value().

◆ ecos_thread_reasons

const struct ecos_thread_state ecos_thread_reasons[]
static
Initial value:
= {
{ 0, "NONE" },
{ 1, "WAIT" },
{ 2, "DELAY" },
{ 3, "TIMEOUT" },
{ 4, "BREAK" },
{ 5, "DESTRUCT" },
{ 6, "EXIT" },
{ 7, "DONE" }
}

Definition at line 55 of file eCos.c.

Referenced by ecos_update_threads().

◆ rlen

size_t rlen

Definition at line 481 of file eCos.c.

Referenced by tcl_input().

◆ rs

◆ rtos_ecos_regoff_arm

struct stack_register_offset rtos_ecos_regoff_arm[]
static
Initial value:
= {
{ 0, -1, 32 },
{ 1, -1, 32 },
{ 2, -1, 32 },
{ 3, -1, 32 },
{ 4, -1, 32 },
{ 5, -1, 32 },
{ 6, -1, 32 },
{ 7, -1, 32 },
{ 8, -1, 32 },
{ 9, -1, 32 },
{ 10, -1, 32 },
{ 11, -1, 32 },
{ 12, -1, 32 },
{ 13, -1, 32 },
{ 14, -1, 32 },
{ 15, -1, 32 },
{ 16, -1, 32 },
}

Definition at line 102 of file eCos.c.

Referenced by ecos_stack_layout_arm().

◆ rtos_ecos_regoff_cortexm

struct stack_register_offset rtos_ecos_regoff_cortexm[]
static

Definition at line 102 of file eCos.c.

Referenced by ecos_stack_layout_cortexm().

◆ rtos_ecos_stacking

struct rtos_register_stacking rtos_ecos_stacking
static
Initial value:
= {
.stack_registers_size = 0,
.stack_growth_direction = -1,
.num_output_registers = 0,
.calculate_process_stack = NULL,
.register_offsets = NULL
}

Definition at line 102 of file eCos.c.

Referenced by ecos_stack_layout_arm(), and ecos_stack_layout_cortexm().

◆ target_arm

const char* const target_arm[]
static
Initial value:
= {
"cortex_a",
"arm7tdmi",
"arm720t",
"arm9tdmi",
"arm920t",
"arm926ejs",
"arm946e",
"arm966e",
"arm11",
}

Definition at line 102 of file eCos.c.

◆ target_cortex_m

const char* const target_cortex_m[]
static
Initial value:
= {
"cortex_m",
"hla_target",
}

Definition at line 96 of file eCos.c.

◆ xc

char xc

Definition at line 479 of file eCos.c.

◆ 

const { ... } xmlchars[]
Initial value:
= {
XMLENTRY('<', "&lt;"),
XMLENTRY('&', "&amp;"),
XMLENTRY('>', "&gt;"),
XMLENTRY('\'', "&apos;"),
}
#define XMLENTRY(_c, _s)
Definition: eCos.c:476

Referenced by ecos_escape_string().