22 #define ST_DEAD BIT(0)
23 #define ST_WAIT BIT(1)
28 #define ST_FLAG BIT(6)
29 #define ST_FLAG_ALL BIT(7)
30 #define ST_MBOX BIT(8)
32 #define ST_SUSPEND BIT(10)
34 #define ST_TT_YIELD BIT(12)
35 #define ST_CREATE BIT(13)
77 {
"os_state",
false },
78 {
"__off_os_state2chain",
false },
79 {
"__off_os_state2current",
false },
80 {
"__off_task2chain",
false },
81 {
"__off_task2magic",
false },
82 {
"__off_task2stack",
false },
83 {
"__off_task2state",
false },
84 {
"__off_task2name",
false },
85 {
"__val_task_magic",
false },
91 void *new_ptr = malloc(new_size);
94 memcpy(new_ptr, ptr,
MIN(old_size, new_size));
108 if (!new_thread_details) {
109 LOG_ERROR(
"Error growing memory to %d threads", new_thread_count);
121 LOG_ERROR(
"Could not read task name pointer from target");
127 LOG_ERROR(
"Error reading task name from target");
130 tmp_str[
sizeof(tmp_str) - 1] =
'\0';
131 LOG_DEBUG(
"task name at 0x%" PRIx32
", value \"%s\"",
name, tmp_str);
133 if (tmp_str[0] !=
'\0')
142 LOG_ERROR(
"Could not read task state from target");
148 char state_str[64] =
"";
150 strcat(state_str,
"TT|");
151 if (task == current_task) {
152 strcat(state_str,
"RUN");
155 strcat(state_str,
"YIELD");
157 strcat(state_str,
"DEAD");
159 strcat(state_str,
"WAIT");
161 strcat(state_str,
"SUSP");
163 strcat(state_str,
"READY");
166 strcat(state_str,
"|SEM");
168 strcat(state_str,
"|MTX");
170 strcat(state_str,
"|SIG");
172 strcat(state_str,
"|DLY");
174 strcat(state_str,
"|FLAG");
176 strcat(state_str,
"_ALL");
178 strcat(state_str,
"|MBOX");
180 strcat(state_str,
"|STP");
185 if (task == current_task)
196 LOG_ERROR(
"Could not read task magic from target");
200 LOG_ERROR(
"Invalid task found (magic=0x%" PRIx32
")", magic);
219 uint32_t current_task;
227 LOG_DEBUG(
"current task is 0x%" PRIx32, current_task);
237 LOG_DEBUG(
"chain start at 0x%" PRIx32, chain);
239 uint32_t next = chain;
243 LOG_ERROR(
"Could not read rt-kernel data structure from target");
246 LOG_DEBUG(
"next entry at 0x%" PRIx32, next);
252 LOG_DEBUG(
"found task at 0x%" PRIx32, task);
262 LOG_ERROR(
"Could not add task to rtos system");
270 struct rtos_reg **reg_list,
int *num_regs)
272 uint32_t stack_ptr = 0;
288 LOG_ERROR(
"Error reading stack pointer from rtkernel thread");
291 LOG_DEBUG(
"stack pointer at 0x%" PRIx64
", value 0x%" PRIx32,
299 bool cm4_fpu_enabled =
false;
308 LOG_ERROR(
"Could not read CPACR register to check FPU state");
313 if (cpacr & 0x00F00000) {
315 cm4_fpu_enabled =
true;
320 if (!cm4_fpu_enabled) {
329 LOG_OUTPUT(
"Error reading stack frame from rtkernel thread\r\n");
333 if ((lr_svc & 0x10) == 0) {
371 LOG_ERROR(
"Could not find target in rt-kernel compatibility list");
static struct armv7m_common * target_to_armv7m(struct target *target)
static bool is_armv7m(const struct armv7m_common *armv7m)
The JTAG interface can be implemented with a software or hardware fifo.
#define LOG_OUTPUT(expr ...)
#define LOG_ERROR(expr ...)
#define LOG_DEBUG(expr ...)
static int rtkernel_get_symbol_list_to_lookup(struct symbol_table_elem *symbol_list[])
static void * realloc_preserve(void *ptr, size_t old_size, size_t new_size)
static int rtkernel_verify_task(struct rtos *rtos, uint32_t task)
static bool rtkernel_detect_rtos(struct target *target)
@ sym___off_os_state2chain
@ sym___off_os_state2current
static int rtkernel_update_threads(struct rtos *rtos)
static const struct symbols rtkernel_symbol_list[]
static int rtkernel_add_task(struct rtos *rtos, uint32_t task, uint32_t current_task)
static int rtkernel_get_thread_reg_list(struct rtos *rtos, int64_t thread_id, struct rtos_reg **reg_list, int *num_regs)
static const struct rtkernel_params rtkernel_params_list[]
static int rtkernel_create(struct target *target)
const struct rtos_type rtkernel_rtos
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_standard_cortex_m3_stacking
const struct rtos_register_stacking rtos_standard_cortex_m4f_fpu_stacking
const struct rtos_register_stacking rtos_standard_cortex_m4f_stacking
const struct rtos_register_stacking * stacking_info_cm4f_fpu
const struct rtos_register_stacking * stacking_info_cm4f
const struct rtos_register_stacking * stacking_info_cm3
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)
int target_read_u16(struct target *target, target_addr_t address, uint16_t *value)
int target_read_u32(struct target *target, target_addr_t address, uint32_t *value)
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.