23 #define ST_DEAD BIT(0)
24 #define ST_WAIT BIT(1)
29 #define ST_FLAG BIT(6)
30 #define ST_FLAG_ALL BIT(7)
31 #define ST_MBOX BIT(8)
33 #define ST_SUSPEND BIT(10)
35 #define ST_TT_YIELD BIT(12)
36 #define ST_CREATE BIT(13)
78 {
"os_state",
false },
79 {
"__off_os_state2chain",
false },
80 {
"__off_os_state2current",
false },
81 {
"__off_task2chain",
false },
82 {
"__off_task2magic",
false },
83 {
"__off_task2stack",
false },
84 {
"__off_task2state",
false },
85 {
"__off_task2name",
false },
86 {
"__val_task_magic",
false },
92 void *new_ptr = malloc(new_size);
95 memcpy(new_ptr, ptr,
MIN(old_size, new_size));
109 if (!new_thread_details) {
110 LOG_ERROR(
"Error growing memory to %d threads", new_thread_count);
122 LOG_ERROR(
"Could not read task name pointer from target");
128 LOG_ERROR(
"Error reading task name from target");
131 tmp_str[
sizeof(tmp_str) - 1] =
'\0';
132 LOG_DEBUG(
"task name at 0x%" PRIx32
", value \"%s\"",
name, tmp_str);
134 if (tmp_str[0] !=
'\0')
143 LOG_ERROR(
"Could not read task state from target");
149 char state_str[64] =
"";
151 strcat(state_str,
"TT|");
152 if (task == current_task) {
153 strcat(state_str,
"RUN");
156 strcat(state_str,
"YIELD");
158 strcat(state_str,
"DEAD");
160 strcat(state_str,
"WAIT");
162 strcat(state_str,
"SUSP");
164 strcat(state_str,
"READY");
167 strcat(state_str,
"|SEM");
169 strcat(state_str,
"|MTX");
171 strcat(state_str,
"|SIG");
173 strcat(state_str,
"|DLY");
175 strcat(state_str,
"|FLAG");
177 strcat(state_str,
"_ALL");
179 strcat(state_str,
"|MBOX");
181 strcat(state_str,
"|STP");
186 if (task == current_task)
197 LOG_ERROR(
"Could not read task magic from target");
201 LOG_ERROR(
"Invalid task found (magic=0x%" PRIx32
")", magic);
220 uint32_t current_task;
228 LOG_DEBUG(
"current task is 0x%" PRIx32, current_task);
238 LOG_DEBUG(
"chain start at 0x%" PRIx32, chain);
240 uint32_t next = chain;
244 LOG_ERROR(
"Could not read rt-kernel data structure from target");
247 LOG_DEBUG(
"next entry at 0x%" PRIx32, next);
253 LOG_DEBUG(
"found task at 0x%" PRIx32, task);
263 LOG_ERROR(
"Could not add task to rtos system");
271 struct rtos_reg **reg_list,
int *num_regs)
273 uint32_t stack_ptr = 0;
289 LOG_ERROR(
"Error reading stack pointer from rtkernel thread");
292 LOG_DEBUG(
"stack pointer at 0x%" PRIx64
", value 0x%" PRIx32,
300 bool cm4_fpu_enabled =
false;
309 LOG_ERROR(
"Could not read CPACR register to check FPU state");
314 if (cpacr & 0x00F00000) {
316 cm4_fpu_enabled =
true;
321 if (!cm4_fpu_enabled) {
330 LOG_OUTPUT(
"Error reading stack frame from rtkernel thread\r\n");
334 if ((lr_svc & 0x10) == 0) {
372 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.
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)
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)
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.