@@ -38,6 +38,7 @@ typedef struct {
38
38
uint32_t entry;
39
39
uint32_t stack_size;
40
40
uint32_t max_stack;
41
+ const char *stack_name;
41
42
} thread_info_t ;
42
43
43
44
// Mutex to protect "buf"
@@ -60,6 +61,7 @@ static void enqeue_thread_info(osThreadId_t id);
60
61
static void deque_and_print_thread_info (void );
61
62
62
63
// sprintf uses a lot of stack so use these instead
64
+ static uint32_t print_str (char *buf, const char *value);
63
65
static uint32_t print_hex (char *buf, uint32_t value);
64
66
static uint32_t print_dec (char *buf, uint32_t value);
65
67
#endif
@@ -160,6 +162,7 @@ static void enqeue_thread_info(osThreadId_t id)
160
162
thread_info.entry = (uint32_t )id;
161
163
thread_info.stack_size = osThreadGetStackSize (id);
162
164
thread_info.max_stack = thread_info.stack_size - osThreadGetStackSpace (id);
165
+ thread_info.stack_name = osThreadGetName (id);
163
166
queue->push (thread_info);
164
167
}
165
168
@@ -170,6 +173,10 @@ static void deque_and_print_thread_info()
170
173
MBED_ASSERT (ret);
171
174
uint32_t pos = 0 ;
172
175
buf[pos++] = ' \" ' ;
176
+ pos += print_str (buf + pos, thread_info.stack_name );
177
+ buf[pos++] = ' \" ' ;
178
+ buf[pos++] = ' ,' ;
179
+ buf[pos++] = ' \" ' ;
173
180
pos += print_hex (buf + pos, thread_info.entry );
174
181
buf[pos++] = ' \" ' ;
175
182
buf[pos++] = ' ,' ;
@@ -180,6 +187,16 @@ static void deque_and_print_thread_info()
180
187
greentea_send_kv (" __thread_info" , buf);
181
188
}
182
189
190
+ static uint32_t print_str (char *buf, const char *value)
191
+ {
192
+ uint32_t pos = 0 ;
193
+ for (pos = 0 ; pos < strlen (value); pos++) {
194
+ buf[pos] = value[pos];
195
+ }
196
+ return pos;
197
+ }
198
+
199
+
183
200
static uint32_t print_hex (char *buf, uint32_t value)
184
201
{
185
202
uint32_t pos = 0 ;
0 commit comments