23 #define MQX_THREAD_NAME_LENGTH (255)
24 #define MQX_KERNEL_OFFSET_TDLIST (0x0108)
25 #define MQX_KERNEL_OFFSET_SYSTEM_TASK (0x0050)
26 #define MQX_KERNEL_OFFSET_ACTIVE_TASK (0x001C)
27 #define MQX_KERNEL_OFFSET_CAPABILITY (0x0000)
28 #define MQX_QUEUE_OFFSET_SIZE (0x0008)
29 #define MQX_TASK_OFFSET_STATE (0x0008)
30 #define MQX_TASK_OFFSET_ID (0x000c)
31 #define MQX_TASK_OFFSET_TEMPLATE (0x0068)
32 #define MQX_TASK_OFFSET_STACK (0x0014)
33 #define MQX_TASK_OFFSET_TDLIST (0x006C)
34 #define MQX_TASK_OFFSET_NEXT (0x0000)
35 #define MQX_TASK_TEMPLATE_OFFSET_NAME (0x0010)
36 #define MQX_TASK_OFFSET_ERROR_CODE (0x005C)
37 #define MQX_TASK_STATE_MASK (0xFFF)
63 { 0x0003,
"BLOCKED" },
64 { 0x0005,
"RCV_SPECIFIC_BLOCKED" },
65 { 0x0007,
"RCV_ANY_BLOCKED" },
67 { 0x000B,
"UNHANDLED_INT_BLOCKED" },
68 { 0x000D,
"SEND_BLOCKED" },
69 { 0x000F,
"BREAKPOINT_BLOCKED" },
70 { 0x0211,
"IO_BLOCKED" },
71 { 0x0021,
"SEM_BLOCKED" },
72 { 0x0223,
"MUTEX_BLOCKED" },
73 { 0x0025,
"EVENT_BLOCKED" },
74 { 0x0229,
"TASK_QUEUE_BLOCKED" },
75 { 0x042B,
"LWSEM_BLOCKED" },
76 { 0x042D,
"LWEVENT_BLOCKED" },
104 (address && address <= 0x3FFFFFFFu) ||
106 (address >= 0x6000000u && address <= 0x9FFFFFFFu)
112 LOG_ERROR(
"MQX RTOS - unknown architecture %s", targetname);
129 LOG_WARNING(
"MQX RTOS - target address 0x%" PRIx32
" is not allowed to read", address);
134 LOG_ERROR(
"MQX RTOS - reading target address 0x%" PRIx32
" failed", address);
160 const uint32_t base_address,
161 int32_t member_offset,
162 int32_t member_width,
163 const char *member_name,
169 rtos->
target, base_address + member_offset, member_width, result
172 LOG_WARNING(
"MQX RTOS - cannot read \"%s\" at address 0x%" PRIx32,
173 member_name, (uint32_t)(base_address + member_offset));
184 uint32_t kernel_data_symbol = 0;
185 uint32_t kernel_data_addr = 0;
186 uint32_t system_td_addr = 0;
187 uint32_t active_td_addr = 0;
188 uint32_t capability_value = 0;
196 "_mqx_kernel_data", &kernel_data_addr) !=
ERROR_OK)
200 if (kernel_data_addr == 0 || kernel_data_addr == (uint32_t)(-1))
204 "kernel_data->ADDRESSING_CAPABILITY", (
void *)&capability_value) !=
ERROR_OK)
209 if (capability_value != 8) {
210 LOG_WARNING(
"MQX RTOS - value of '_mqx_kernel_data->ADDRESSING_CAPABILITY' contains invalid value");
215 "kernel_data->ACTIVE_PTR", (
void *)&active_td_addr) !=
ERROR_OK)
220 if (active_td_addr == system_td_addr) {
269 uint32_t task_queue_addr = 0;
270 uint32_t kernel_data_addr = 0;
271 uint16_t task_queue_size = 0;
272 uint32_t active_td_addr = 0;
291 "_mqx_kernel_data", &kernel_data_addr) !=
ERROR_OK)
298 "kernel_data->TD_LIST.SIZE", &task_queue_size) !=
ERROR_OK)
303 "kernel_data->ACTIVE_PTR", (
void *)&active_td_addr) !=
ERROR_OK)
319 uint32_t i = 0, taskpool_addr = task_queue_addr;
324 uint32_t task_addr = 0, task_template = 0, task_state = 0;
325 uint32_t task_name_addr = 0, task_id = 0, task_errno = 0;
326 uint32_t state_index = 0;
327 uint32_t extra_info_length = 0;
328 char *state_name =
"Unknown";
332 "td_struct_ptr->NEXT", &taskpool_addr) !=
ERROR_OK)
339 "td_struct_ptr->TEMPLATE_LIST_PTR", &task_template) !=
ERROR_OK)
344 "td_struct_ptr->TEMPLATE_LIST_PTR->NAME", &task_name_addr) !=
ERROR_OK)
349 "*td_struct_ptr->TEMPLATE_LIST_PTR->NAME", task_name) !=
ERROR_OK)
358 "td_struct_ptr->TASK_ID", &task_id) !=
ERROR_OK)
363 "td_struct_ptr->TASK_ERROR_CODE", &task_errno) !=
ERROR_OK)
368 "td_struct_ptr->STATE", &task_state) !=
ERROR_OK)
395 extra_info_length += strlen((
void *)state_name) + 7 + 13 + 8 + 15 + 8;
400 "State: %s, Address: 0x%" PRIx32
", Error Code: %" PRIu32,
401 state_name, task_addr, task_errno
404 if (active_td_addr == task_addr)
420 int64_t stack_ptr = 0;
421 uint32_t my_task_addr = 0;
422 uint32_t task_queue_addr = 0;
423 uint32_t task_queue_size = 0;
424 uint32_t kernel_data_addr = 0;
426 if (thread_id == 0) {
427 LOG_ERROR(
"MQX RTOS - invalid threadid: 0x%X", (
int)thread_id);
438 "_mqx_kernel_data", &kernel_data_addr) !=
ERROR_OK)
445 "kernel_data->TD_LIST.SIZE", &task_queue_size) !=
ERROR_OK)
450 uint32_t i = 0, taskpool_addr = task_queue_addr;
454 uint32_t tmp_address = 0, task_addr = 0;
455 uint32_t task_id = 0;
457 tmp_address = taskpool_addr;
459 "td_struct_ptr->NEXT", &taskpool_addr) !=
ERROR_OK)
466 "td_struct_ptr->TASK_ID", &task_id) !=
ERROR_OK)
470 if (task_id == thread_id) {
471 my_task_addr = task_addr;
476 LOG_ERROR(
"MQX_RTOS - threadid %" PRId64
" does not match any task", thread_id);
481 "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[]
struct rtos_type mqx_rtos
#define MQX_TASK_OFFSET_STACK
#define MQX_TASK_OFFSET_TDLIST
#define MQX_KERNEL_OFFSET_ACTIVE_TASK
static bool mqx_detect_rtos(struct target *target)
#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.
const char * name
Name of this type of target.
struct target_type * type
int target_read_buffer(struct target *target, target_addr_t address, uint32_t size, uint8_t *buffer)
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.