20 #ifndef UCOS_III_MAX_STRLEN
21 #define UCOS_III_MAX_STRLEN 64
24 #ifndef UCOS_III_MAX_THREADS
25 #define UCOS_III_MAX_THREADS 256
51 .pointer_width =
sizeof(uint32_t),
56 .target_name =
"esirisc",
57 .pointer_width =
sizeof(uint32_t),
70 "openocd_OS_TCB_StkPtr_offset",
71 "openocd_OS_TCB_NamePtr_offset",
72 "openocd_OS_TCB_TaskState_offset",
73 "openocd_OS_TCB_Prio_offset",
74 "openocd_OS_TCB_DbgPrevPtr_offset",
75 "openocd_OS_TCB_DbgNextPtr_offset",
102 "Pend Timeout Suspended",
111 for (thread_index = 0; thread_index <
params->num_threads; thread_index++)
112 if (
params->threads[thread_index] == thread_address)
116 LOG_WARNING(
"uCOS-III: too many threads; increase UCOS_III_MAX_THREADS");
120 params->threads[thread_index] = thread_address;
134 if (thread_index >=
params->num_threads) {
135 LOG_ERROR(
"uCOS-III: failed to find thread address");
139 *thread_address =
params->threads[thread_index];
155 (
void *)&thread_list_address);
157 LOG_ERROR(
"uCOS-III: failed to read thread list address");
163 *thread_address = thread_list_address;
166 thread_list_address +
params->thread_next_offset,
169 (
void *)&thread_list_address);
171 LOG_ERROR(
"uCOS-III: failed to read next thread address");
174 }
while (thread_list_address != 0);
183 if (
params->thread_offsets_updated)
186 const struct thread_offset_map {
189 } thread_offset_maps[] = {
216 for (
size_t i = 0; i <
ARRAY_SIZE(thread_offset_maps); i++) {
217 const struct thread_offset_map *thread_offset_map = &thread_offset_maps[i];
223 (
void *)thread_offset_map->thread_offset);
225 LOG_ERROR(
"uCOS-III: failed to read thread offset");
244 params->thread_offsets_updated =
false;
280 LOG_ERROR(
"uCOS-III: symbol list not loaded");
288 uint8_t rtos_running;
294 LOG_ERROR(
"uCOS-III: failed to read RTOS running");
298 if (rtos_running != 1 && rtos_running != 0) {
299 LOG_ERROR(
"uCOS-III: invalid RTOS running value");
321 LOG_ERROR(
"uCOS-III: failed to update thread offsets");
332 (
void *)¤t_thread_address);
334 LOG_ERROR(
"uCOS-III: failed to read current thread address");
343 LOG_ERROR(
"uCOS-III: failed to read thread count");
361 LOG_ERROR(
"uCOS-III: failed to find last thread address");
372 LOG_ERROR(
"uCOS-III: failed to find or create thread");
376 if (thread_address == current_thread_address)
388 (
void *)&thread_name_address);
390 LOG_ERROR(
"uCOS-III: failed to name address");
396 sizeof(thread_str_buffer),
397 (
void *)thread_str_buffer);
399 LOG_ERROR(
"uCOS-III: failed to read thread name");
403 thread_str_buffer[
sizeof(thread_str_buffer) - 1] =
'\0';
407 uint8_t thread_state;
408 uint8_t thread_priority;
414 LOG_ERROR(
"uCOS-III: failed to read thread state");
422 LOG_ERROR(
"uCOS-III: failed to read thread priority");
426 const char *thread_state_str;
431 thread_state_str =
"Unknown";
433 snprintf(thread_str_buffer,
sizeof(thread_str_buffer),
"State: %s, Priority: %d",
434 thread_state_str, thread_priority);
442 (
void *)&thread_address);
444 LOG_ERROR(
"uCOS-III: failed to read previous thread address");
453 struct rtos_reg **reg_list,
int *num_regs)
463 LOG_ERROR(
"uCOS-III: failed to find thread address");
471 thread_address +
params->thread_stack_offset,
474 (
void *)&stack_address);
476 LOG_ERROR(
"uCOS-III: failed to read stack address");
static struct esp_usb_jtag * priv
#define LOG_WARNING(expr ...)
#define LOG_ERROR(expr ...)
static const struct rtos_register_stacking * stacking_info
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 struct rtos_register_stacking * stacking_info
const unsigned char pointer_width
symbol_address_t thread_state_offset
symbol_address_t thread_prev_offset
symbol_address_t thread_stack_offset
const struct ucos_iii_params * params
bool thread_offsets_updated
symbol_address_t thread_name_offset
symbol_address_t thread_next_offset
symbol_address_t thread_priority_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)
const char * target_type_name(const struct target *target)
Get the target type name.
static const char * target_name(const 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)