21 #ifndef UCOS_III_MAX_STRLEN
22 #define UCOS_III_MAX_STRLEN 64
25 #ifndef UCOS_III_MAX_THREADS
26 #define UCOS_III_MAX_THREADS 256
83 "openocd_OS_TCB_StkPtr_offset",
84 "openocd_OS_TCB_NamePtr_offset",
85 "openocd_OS_TCB_TaskState_offset",
86 "openocd_OS_TCB_Prio_offset",
87 "openocd_OS_TCB_DbgPrevPtr_offset",
88 "openocd_OS_TCB_DbgNextPtr_offset",
115 "Pend Timeout Suspended",
124 for (thread_index = 0; thread_index < params->
num_threads; thread_index++)
125 if (params->
threads[thread_index] == thread_address)
129 LOG_WARNING(
"uCOS-III: too many threads; increase UCOS_III_MAX_THREADS");
133 params->
threads[thread_index] = thread_address;
148 LOG_ERROR(
"uCOS-III: failed to find thread address");
152 *thread_address = params->
threads[thread_index];
168 (
void *)&thread_list_address);
170 LOG_ERROR(
"uCOS-III: failed to read thread list address");
176 *thread_address = thread_list_address;
182 (
void *)&thread_list_address);
184 LOG_ERROR(
"uCOS-III: failed to read next thread address");
187 }
while (thread_list_address != 0);
199 const struct thread_offset_map {
202 } thread_offset_maps[] = {
229 for (
size_t i = 0; i <
ARRAY_SIZE(thread_offset_maps); i++) {
230 const struct thread_offset_map *thread_offset_map = &thread_offset_maps[i];
236 (
void *)thread_offset_map->thread_offset);
238 LOG_ERROR(
"uCOS-III: failed to read thread offset");
293 LOG_ERROR(
"uCOS-III: symbol list not loaded");
301 uint8_t rtos_running;
307 LOG_ERROR(
"uCOS-III: failed to read RTOS running");
311 if (rtos_running != 1 && rtos_running != 0) {
312 LOG_ERROR(
"uCOS-III: invalid RTOS running value");
334 LOG_ERROR(
"uCOS-III: failed to update thread offsets");
345 (
void *)¤t_thread_address);
347 LOG_ERROR(
"uCOS-III: failed to read current thread address");
356 LOG_ERROR(
"uCOS-III: failed to read thread count");
374 LOG_ERROR(
"uCOS-III: failed to find last thread address");
385 LOG_ERROR(
"uCOS-III: failed to find or create thread");
389 if (thread_address == current_thread_address)
401 (
void *)&thread_name_address);
403 LOG_ERROR(
"uCOS-III: failed to name address");
409 sizeof(thread_str_buffer),
410 (
void *)thread_str_buffer);
412 LOG_ERROR(
"uCOS-III: failed to read thread name");
416 thread_str_buffer[
sizeof(thread_str_buffer) - 1] =
'\0';
420 uint8_t thread_state;
421 uint8_t thread_priority;
427 LOG_ERROR(
"uCOS-III: failed to read thread state");
435 LOG_ERROR(
"uCOS-III: failed to read thread priority");
439 const char *thread_state_str;
444 thread_state_str =
"Unknown";
446 snprintf(thread_str_buffer,
sizeof(thread_str_buffer),
"State: %s, Priority: %d",
447 thread_state_str, thread_priority);
455 (
void *)&thread_address);
457 LOG_ERROR(
"uCOS-III: failed to read previous thread address");
466 struct rtos_reg **reg_list,
int *num_regs)
476 LOG_ERROR(
"uCOS-III: failed to find thread address");
487 (
void *)&stack_address);
489 LOG_ERROR(
"uCOS-III: failed to read stack address");
static struct esp_usb_jtag * priv
#define LOG_WARNING(expr ...)
#define LOG_ERROR(expr ...)
int rtos_generic_stack_read(struct target *target, const struct rtos_register_stacking *stacking, int64_t stack_ptr, struct rtos_reg **reg_list, int *num_regs)
void rtos_free_threadlist(struct rtos *rtos)
const struct rtos_register_stacking rtos_ucos_iii_cortex_m_stacking
const struct rtos_register_stacking rtos_ucos_iii_esi_risc_stacking
struct thread_detail * thread_details
struct symbol_table_elem * symbols
void * rtos_specific_params
threadid_t current_thread
Table should be terminated by an element with NULL in symbol_name.
const char * name
Name of this type of target.
struct target_type * type
symbol_address_t thread_name_offset
symbol_address_t thread_priority_offset
symbol_address_t threads[]
symbol_address_t thread_stack_offset
symbol_address_t thread_state_offset
symbol_address_t thread_next_offset
const struct rtos_register_stacking * stacking_info
const unsigned char pointer_width
bool thread_offsets_updated
symbol_address_t thread_prev_offset
int target_read_buffer(struct target *target, target_addr_t address, uint32_t size, uint8_t *buffer)
int target_read_u8(struct target *target, target_addr_t address, uint8_t *value)
int target_read_u16(struct target *target, target_addr_t address, uint16_t *value)
int target_read_memory(struct target *target, target_addr_t address, uint32_t size, uint32_t count, uint8_t *buffer)
Read count items of size bytes from the memory of target at the address given.
int target_register_reset_callback(int(*callback)(struct target *target, enum target_reset_mode reset_mode, void *priv), void *priv)
static const char * target_name(struct target *target)
Returns the instance-specific name of the specified target.
#define ARRAY_SIZE(x)
Compute the number of elements of a variable length array.
static int ucos_iii_reset_handler(struct target *target, enum target_reset_mode reset_mode, void *priv)
static int ucos_iii_update_threads(struct rtos *rtos)
@ UCOS_III_VAL_OS_TCB_CUR_PTR
@ UCOS_III_VAL_OS_TCB_PRIO_OFFSET
@ UCOS_III_VAL_OS_TASK_QTY
@ UCOS_III_VAL_OS_RUNNING
@ UCOS_III_VAL_OS_TCB_NAME_PTR_OFFSET
@ UCOS_III_VAL_OS_TCB_DBG_PREV_PTR_OFFSET
@ UCOS_III_VAL_OS_TCB_TASK_STATE_OFFSET
@ UCOS_III_VAL_OS_TASK_DBG_LIST_PTR
@ UCOS_III_VAL_OS_TCB_STK_PTR_OFFSET
@ UCOS_III_VAL_OS_TCB_DBG_NEXT_PTR_OFFSET
static const char *const ucos_iii_thread_state_list[]
static const struct ucos_iii_params ucos_iii_params_list[]
#define UCOS_III_MAX_STRLEN
static int ucos_iii_create(struct target *target)
static const char *const ucos_iii_symbol_list[]
static int ucos_iii_find_or_create_thread(struct rtos *rtos, symbol_address_t thread_address, threadid_t *threadid)
static int ucos_iii_get_symbol_list_to_lookup(struct symbol_table_elem *symbol_list[])
static int ucos_iii_find_thread_address(struct rtos *rtos, threadid_t threadid, symbol_address_t *thread_address)
static int ucos_iii_get_thread_reg_list(struct rtos *rtos, threadid_t threadid, struct rtos_reg **reg_list, int *num_regs)
const struct rtos_type ucos_iii_rtos
#define UCOS_III_MAX_THREADS
static bool ucos_iii_detect_rtos(struct target *target)
static int ucos_iii_update_thread_offsets(struct rtos *rtos)
static int ucos_iii_find_last_thread_address(struct rtos *rtos, symbol_address_t *thread_address)