22 #define MQX_THREAD_NAME_LENGTH (255)
23 #define MQX_KERNEL_OFFSET_TDLIST (0x0108)
24 #define MQX_KERNEL_OFFSET_SYSTEM_TASK (0x0050)
25 #define MQX_KERNEL_OFFSET_ACTIVE_TASK (0x001C)
26 #define MQX_KERNEL_OFFSET_CAPABILITY (0x0000)
27 #define MQX_QUEUE_OFFSET_SIZE (0x0008)
28 #define MQX_TASK_OFFSET_STATE (0x0008)
29 #define MQX_TASK_OFFSET_ID (0x000c)
30 #define MQX_TASK_OFFSET_TEMPLATE (0x0068)
31 #define MQX_TASK_OFFSET_STACK (0x0014)
32 #define MQX_TASK_OFFSET_TDLIST (0x006C)
33 #define MQX_TASK_OFFSET_NEXT (0x0000)
34 #define MQX_TASK_TEMPLATE_OFFSET_NAME (0x0010)
35 #define MQX_TASK_OFFSET_ERROR_CODE (0x005C)
36 #define MQX_TASK_STATE_MASK (0xFFF)
62 { 0x0003,
"BLOCKED" },
63 { 0x0005,
"RCV_SPECIFIC_BLOCKED" },
64 { 0x0007,
"RCV_ANY_BLOCKED" },
66 { 0x000B,
"UNHANDLED_INT_BLOCKED" },
67 { 0x000D,
"SEND_BLOCKED" },
68 { 0x000F,
"BREAKPOINT_BLOCKED" },
69 { 0x0211,
"IO_BLOCKED" },
70 { 0x0021,
"SEM_BLOCKED" },
71 { 0x0223,
"MUTEX_BLOCKED" },
72 { 0x0025,
"EVENT_BLOCKED" },
73 { 0x0229,
"TASK_QUEUE_BLOCKED" },
74 { 0x042B,
"LWSEM_BLOCKED" },
75 { 0x042D,
"LWEVENT_BLOCKED" },
103 (address && address <= 0x3FFFFFFFu) ||
105 (address >= 0x6000000u && address <= 0x9FFFFFFFu)
111 LOG_ERROR(
"MQX RTOS - unknown architecture %s", targetname);
128 LOG_WARNING(
"MQX RTOS - target address 0x%" PRIx32
" is not allowed to read", address);
133 LOG_ERROR(
"MQX RTOS - reading target address 0x%" PRIx32
" failed", address);
159 const uint32_t base_address,
160 int32_t member_offset,
161 int32_t member_width,
162 const char *member_name,
168 rtos->
target, base_address + member_offset, member_width, result
171 LOG_WARNING(
"MQX RTOS - cannot read \"%s\" at address 0x%" PRIx32,
172 member_name, (uint32_t)(base_address + member_offset));
183 uint32_t kernel_data_symbol = 0;
184 uint32_t kernel_data_addr = 0;
185 uint32_t system_td_addr = 0;
186 uint32_t active_td_addr = 0;
187 uint32_t capability_value = 0;
195 "_mqx_kernel_data", &kernel_data_addr) !=
ERROR_OK)
199 if (kernel_data_addr == 0 || kernel_data_addr == (uint32_t)(-1))
203 "kernel_data->ADDRESSING_CAPABILITY", (
void *)&capability_value) !=
ERROR_OK)
208 if (capability_value != 8) {
209 LOG_WARNING(
"MQX RTOS - value of '_mqx_kernel_data->ADDRESSING_CAPABILITY' contains invalid value");
214 "kernel_data->ACTIVE_PTR", (
void *)&active_td_addr) !=
ERROR_OK)
219 if (active_td_addr == system_td_addr) {
268 uint32_t task_queue_addr = 0;
269 uint32_t kernel_data_addr = 0;
270 uint16_t task_queue_size = 0;
271 uint32_t active_td_addr = 0;
290 "_mqx_kernel_data", &kernel_data_addr) !=
ERROR_OK)
297 "kernel_data->TD_LIST.SIZE", &task_queue_size) !=
ERROR_OK)
302 "kernel_data->ACTIVE_PTR", (
void *)&active_td_addr) !=
ERROR_OK)
318 uint32_t i = 0, taskpool_addr = task_queue_addr;
323 uint32_t task_addr = 0, task_template = 0, task_state = 0;
324 uint32_t task_name_addr = 0, task_id = 0, task_errno = 0;
325 uint32_t state_index = 0;
326 uint32_t extra_info_length = 0;
327 char *state_name =
"Unknown";
331 "td_struct_ptr->NEXT", &taskpool_addr) !=
ERROR_OK)
338 "td_struct_ptr->TEMPLATE_LIST_PTR", &task_template) !=
ERROR_OK)
343 "td_struct_ptr->TEMPLATE_LIST_PTR->NAME", &task_name_addr) !=
ERROR_OK)
348 "*td_struct_ptr->TEMPLATE_LIST_PTR->NAME", task_name) !=
ERROR_OK)
357 "td_struct_ptr->TASK_ID", &task_id) !=
ERROR_OK)
362 "td_struct_ptr->TASK_ERROR_CODE", &task_errno) !=
ERROR_OK)
367 "td_struct_ptr->STATE", &task_state) !=
ERROR_OK)
394 extra_info_length += strlen((
void *)state_name) + 7 + 13 + 8 + 15 + 8;
399 "State: %s, Address: 0x%" PRIx32
", Error Code: %" PRIu32,
400 state_name, task_addr, task_errno
403 if (active_td_addr == task_addr)
419 int64_t stack_ptr = 0;
420 uint32_t my_task_addr = 0;
421 uint32_t task_queue_addr = 0;
422 uint32_t task_queue_size = 0;
423 uint32_t kernel_data_addr = 0;
425 if (thread_id == 0) {
426 LOG_ERROR(
"MQX RTOS - invalid threadid: 0x%X", (
int)thread_id);
437 "_mqx_kernel_data", &kernel_data_addr) !=
ERROR_OK)
444 "kernel_data->TD_LIST.SIZE", &task_queue_size) !=
ERROR_OK)
449 uint32_t i = 0, taskpool_addr = task_queue_addr;
453 uint32_t tmp_address = 0, task_addr = 0;
454 uint32_t task_id = 0;
456 tmp_address = taskpool_addr;
458 "td_struct_ptr->NEXT", &taskpool_addr) !=
ERROR_OK)
465 "td_struct_ptr->TASK_ID", &task_id) !=
ERROR_OK)
469 if (task_id == thread_id) {
470 my_task_addr = task_addr;
475 LOG_ERROR(
"MQX_RTOS - threadid %" PRId64
" does not match any task", thread_id);
480 "task->STACK_PTR", &stack_ptr) !=
ERROR_OK)
The JTAG interface can be implemented with a software or hardware fifo.
#define LOG_WARNING(expr ...)
#define LOG_ERROR(expr ...)
static int mqx_target_read_buffer(struct target *target, uint32_t address, uint32_t size, uint8_t *buffer)
#define MQX_KERNEL_OFFSET_SYSTEM_TASK
#define MQX_TASK_OFFSET_STATE
static int mqx_get_thread_reg_list(struct rtos *rtos, int64_t thread_id, struct rtos_reg **reg_list, int *num_regs)
#define MQX_TASK_OFFSET_ERROR_CODE
#define MQX_KERNEL_OFFSET_CAPABILITY
#define MQX_TASK_OFFSET_NEXT
#define MQX_THREAD_NAME_LENGTH
static int mqx_is_scheduler_running(struct rtos *rtos)
static int mqx_get_symbol_list_to_lookup(struct symbol_table_elem *symbol_list[])
static int mqx_get_symbol(struct rtos *rtos, enum mqx_symbols symbol, void *result)
#define MQX_TASK_TEMPLATE_OFFSET_NAME
static const struct mqx_params mqx_params_list[]
#define MQX_TASK_OFFSET_ID
@ MQX_VAL_MQX_INIT_STRUCT
@ MQX_VAL_MQX_KERNEL_DATA
static int mqx_get_member(struct rtos *rtos, const uint32_t base_address, int32_t member_offset, int32_t member_width, const char *member_name, void *result)
#define MQX_TASK_OFFSET_TEMPLATE
#define MQX_TASK_STATE_MASK
static int mqx_valid_address_check(struct rtos *rtos, uint32_t address)
static const struct mqx_state mqx_states[]
static int mqx_update_threads(struct rtos *rtos)
static int mqx_create(struct target *target)
#define MQX_KERNEL_OFFSET_TDLIST
static const char *const mqx_symbol_list[]
#define MQX_TASK_OFFSET_STACK
#define MQX_TASK_OFFSET_TDLIST
#define MQX_KERNEL_OFFSET_ACTIVE_TASK
static bool mqx_detect_rtos(struct target *target)
const struct rtos_type mqx_rtos
#define MQX_QUEUE_OFFSET_SIZE
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_mqx_arm_v7m_stacking
size_t size
Size of the control block search area.
const struct rtos_register_stacking * stacking_info
enum mqx_arch target_arch
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.
int target_read_buffer(struct target *target, target_addr_t address, uint32_t size, uint8_t *buffer)
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.