OpenOCD
rtos_nuttx_stackings.c
Go to the documentation of this file.
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 
3 #ifdef HAVE_CONFIG_H
4 #include "config.h"
5 #endif
6 
7 #include "rtos.h"
8 #include "target/armv7m.h"
9 #include "rtos_nuttx_stackings.h"
11 #include <target/riscv/riscv.h>
12 #include <helper/bits.h>
13 
14 /* The cortex_m target uses nuttx_tcbinfo_stack_read which uses a symbol
15  * provided by Nuttx to read the registers from memory and place them directly
16  * in the order we need. This is because the register offsets change with
17  * different versions of Nuttx, FPU vs non-FPU and ARMv7 vs ARMv8.
18  * This allows a single function to work with many versions.
19  */
21  { ARMV7M_R0, 0, 32 }, /* r0 */
22  { ARMV7M_R1, 4, 32 }, /* r1 */
23  { ARMV7M_R2, 8, 32 }, /* r2 */
24  { ARMV7M_R3, 12, 32 }, /* r3 */
25  { ARMV7M_R4, 16, 32 }, /* r4 */
26  { ARMV7M_R5, 20, 32 }, /* r5 */
27  { ARMV7M_R6, 24, 32 }, /* r6 */
28  { ARMV7M_R7, 28, 32 }, /* r7 */
29  { ARMV7M_R8, 32, 32 }, /* r8 */
30  { ARMV7M_R9, 36, 32 }, /* r9 */
31  { ARMV7M_R10, 40, 32 }, /* r10 */
32  { ARMV7M_R11, 44, 32 }, /* r11 */
33  { ARMV7M_R12, 48, 32 }, /* r12 */
34  { ARMV7M_R13, 52, 32 }, /* sp */
35  { ARMV7M_R14, 56, 32 }, /* lr */
36  { ARMV7M_PC, 60, 32 }, /* pc */
37  { ARMV7M_XPSR, 64, 32 }, /* xPSR */
38 };
39 
40 /* The Nuttx stack frame for most architectures has some registers placed
41  * by hardware and some by software. The hardware register order and number does not change
42  * but the software registers may change with different versions of Nuttx.
43  * For example with ARMv7, nuttx-12.3.0 added a new register which changed all
44  * the offsets. We can either create separate offset tables for each version of Nuttx
45  * which will break again in the future, or read the offsets from the TCB info.
46  * Nuttx provides a symbol (g_reg_offs) which holds all the offsets for each stored register.
47  * This offset table is stored in GDB org.gnu.gdb.xxx feature order.
48  * The same order we need.
49  * Please refer:
50  * https://sourceware.org/gdb/current/onlinedocs/gdb/ARM-Features.html
51  * https://sourceware.org/gdb/current/onlinedocs/gdb/RISC_002dV-Features.html
52  */
54  int64_t stack_ptr, const struct rtos_register_stacking *stacking,
55  uint8_t *stack_data)
56 {
57  struct rtos *rtos = target->rtos;
59 
60  for (int i = 0; i < stacking->num_output_registers; ++i) {
61  uint16_t stack_reg_offset;
62  int ret = target_read_u16(rtos->target, xcpreg_off + 2 * i, &stack_reg_offset);
63  if (ret != ERROR_OK) {
64  LOG_ERROR("Failed to read stack_reg_offset: ret = %d", ret);
65  return ret;
66  }
67  if (stack_reg_offset != UINT16_MAX && stacking->register_offsets[i].offset >= 0) {
69  stack_ptr + stack_reg_offset,
70  stacking->register_offsets[i].width_bits / 8,
71  &stack_data[stacking->register_offsets[i].offset]);
72  if (ret != ERROR_OK) {
73  LOG_ERROR("Failed to read register: ret = %d", ret);
74  return ret;
75  }
76  }
77  }
78 
79  /* Offset match nuttx_stack_offsets_cortex_m */
80  const int XPSR_OFFSET = 64;
81  const int SP_OFFSET = 52;
82  /* Nuttx stack frames (produced in exception_common) store the SP of the ISR minus
83  * the hardware stack frame size. This SP may include an additional 4 byte alignment
84  * depending in xPSR[9]. The Nuttx stack frame stores post alignment since the
85  * hardware will add/remove automatically on both enter/exit.
86  * We need to adjust the SP to get the real SP of the stack.
87  * See Arm Reference manual "Stack alignment on exception entry"
88  */
89  uint32_t xpsr = target_buffer_get_u32(target, &stack_data[XPSR_OFFSET]);
90  if (xpsr & BIT(9)) {
91  uint32_t sp = target_buffer_get_u32(target, &stack_data[SP_OFFSET]);
92  target_buffer_set_u32(target, &stack_data[SP_OFFSET], sp - 4 * stacking->stack_growth_direction);
93  }
94 
95  return ERROR_OK;
96 }
97 
99  /* nuttx_tcbinfo_stack_read transforms the stack into just output registers */
101  .stack_growth_direction = -1,
102  .num_output_registers = ARRAY_SIZE(nuttx_stack_offsets_cortex_m),
103  .read_stack = nuttx_cortex_m_tcbinfo_stack_read,
104  .calculate_process_stack = NULL, /* Stack alignment done in nuttx_cortex_m_tcbinfo_stack_read */
105  .register_offsets = nuttx_stack_offsets_cortex_m,
106 };
107 
108 static const struct stack_register_offset nuttx_stack_offsets_riscv[] = {
109  { GDB_REGNO_ZERO, -1, 32 },
110  { GDB_REGNO_RA, 0x04, 32 },
111  { GDB_REGNO_SP, 0x08, 32 },
112  { GDB_REGNO_GP, 0x0c, 32 },
113  { GDB_REGNO_TP, 0x10, 32 },
114  { GDB_REGNO_T0, 0x14, 32 },
115  { GDB_REGNO_T1, 0x18, 32 },
116  { GDB_REGNO_T2, 0x1c, 32 },
117  { GDB_REGNO_FP, 0x20, 32 },
118  { GDB_REGNO_S1, 0x24, 32 },
119  { GDB_REGNO_A0, 0x28, 32 },
120  { GDB_REGNO_A1, 0x2c, 32 },
121  { GDB_REGNO_A2, 0x30, 32 },
122  { GDB_REGNO_A3, 0x34, 32 },
123  { GDB_REGNO_A4, 0x38, 32 },
124  { GDB_REGNO_A5, 0x3c, 32 },
125  { GDB_REGNO_A6, 0x40, 32 },
126  { GDB_REGNO_A7, 0x44, 32 },
127  { GDB_REGNO_S2, 0x48, 32 },
128  { GDB_REGNO_S3, 0x4c, 32 },
129  { GDB_REGNO_S4, 0x50, 32 },
130  { GDB_REGNO_S5, 0x54, 32 },
131  { GDB_REGNO_S6, 0x58, 32 },
132  { GDB_REGNO_S7, 0x5c, 32 },
133  { GDB_REGNO_S8, 0x60, 32 },
134  { GDB_REGNO_S9, 0x64, 32 },
135  { GDB_REGNO_S10, 0x68, 32 },
136  { GDB_REGNO_S11, 0x6c, 32 },
137  { GDB_REGNO_T3, 0x70, 32 },
138  { GDB_REGNO_T4, 0x74, 32 },
139  { GDB_REGNO_T5, 0x78, 32 },
140  { GDB_REGNO_T6, 0x7c, 32 },
141  { GDB_REGNO_PC, 0x00, 32 },
142 };
143 
145  .stack_registers_size = 33 * 4,
146  .stack_growth_direction = -1,
147  .num_output_registers = 33,
148  .calculate_process_stack = rtos_generic_stack_align8,
149  .register_offsets = nuttx_stack_offsets_riscv,
150 };
151 
153  int64_t stack_ptr, const struct rtos_register_stacking *stacking,
154  uint8_t *stack_data)
155 {
156  int retval = target_read_buffer(target, stack_ptr, stacking->stack_registers_size, stack_data);
157  if (retval != ERROR_OK)
158  return retval;
159 
160  stack_data[4] &= ~0x10; /* Clear exception bit in PS */
161 
162  return ERROR_OK;
163 }
164 
165 static const struct stack_register_offset nuttx_stack_offsets_esp32[] = {
166  { 0, 0x00, 32 }, /* PC */
167  { 1, 0x08, 32 }, /* A0 */
168  { 2, 0x0c, 32 }, /* A1 */
169  { 3, 0x10, 32 }, /* A2 */
170  { 4, 0x14, 32 }, /* A3 */
171  { 5, 0x18, 32 }, /* A4 */
172  { 6, 0x1c, 32 }, /* A5 */
173  { 7, 0x20, 32 }, /* A6 */
174  { 8, 0x24, 32 }, /* A7 */
175  { 9, 0x28, 32 }, /* A8 */
176  { 10, 0x2c, 32 }, /* A9 */
177  { 11, 0x30, 32 }, /* A10 */
178  { 12, 0x34, 32 }, /* A11 */
179  { 13, 0x38, 32 }, /* A12 */
180  { 14, 0x3c, 32 }, /* A13 */
181  { 15, 0x40, 32 }, /* A14 */
182  { 16, 0x44, 32 }, /* A15 */
183  /* A16-A63 aren't in the stack frame because they've been flushed to the stack earlier */
184  { 17, -1, 32 }, /* A16 */
185  { 18, -1, 32 }, /* A17 */
186  { 19, -1, 32 }, /* A18 */
187  { 20, -1, 32 }, /* A19 */
188  { 21, -1, 32 }, /* A20 */
189  { 22, -1, 32 }, /* A21 */
190  { 23, -1, 32 }, /* A22 */
191  { 24, -1, 32 }, /* A23 */
192  { 25, -1, 32 }, /* A24 */
193  { 26, -1, 32 }, /* A25 */
194  { 27, -1, 32 }, /* A26 */
195  { 28, -1, 32 }, /* A27 */
196  { 29, -1, 32 }, /* A28 */
197  { 30, -1, 32 }, /* A29 */
198  { 31, -1, 32 }, /* A30 */
199  { 32, -1, 32 }, /* A31 */
200  { 33, -1, 32 }, /* A32 */
201  { 34, -1, 32 }, /* A33 */
202  { 35, -1, 32 }, /* A34 */
203  { 36, -1, 32 }, /* A35 */
204  { 37, -1, 32 }, /* A36 */
205  { 38, -1, 32 }, /* A37 */
206  { 39, -1, 32 }, /* A38 */
207  { 40, -1, 32 }, /* A39 */
208  { 41, -1, 32 }, /* A40 */
209  { 42, -1, 32 }, /* A41 */
210  { 43, -1, 32 }, /* A42 */
211  { 44, -1, 32 }, /* A43 */
212  { 45, -1, 32 }, /* A44 */
213  { 46, -1, 32 }, /* A45 */
214  { 47, -1, 32 }, /* A46 */
215  { 48, -1, 32 }, /* A47 */
216  { 49, -1, 32 }, /* A48 */
217  { 50, -1, 32 }, /* A49 */
218  { 51, -1, 32 }, /* A50 */
219  { 52, -1, 32 }, /* A51 */
220  { 53, -1, 32 }, /* A52 */
221  { 54, -1, 32 }, /* A53 */
222  { 55, -1, 32 }, /* A54 */
223  { 56, -1, 32 }, /* A55 */
224  { 57, -1, 32 }, /* A56 */
225  { 58, -1, 32 }, /* A57 */
226  { 59, -1, 32 }, /* A58 */
227  { 60, -1, 32 }, /* A59 */
228  { 61, -1, 32 }, /* A60 */
229  { 62, -1, 32 }, /* A61 */
230  { 63, -1, 32 }, /* A62 */
231  { 64, -1, 32 }, /* A63 */
232  { 65, 0x58, 32 }, /* lbeg */
233  { 66, 0x5c, 32 }, /* lend */
234  { 67, 0x60, 32 }, /* lcount */
235  { 68, 0x48, 32 }, /* SAR */
236  { 69, -1, 32 }, /* windowbase */
237  { 70, -1, 32 }, /* windowstart */
238  { 71, -1, 32 }, /* configid0 */
239  { 72, -1, 32 }, /* configid1 */
240  { 73, 0x04, 32 }, /* PS */
241  { 74, -1, 32 }, /* threadptr */
242  { 75, -1, 32 }, /* br */
243  { 76, 0x54, 32 }, /* scompare1 */
244  { 77, -1, 32 }, /* acclo */
245  { 78, -1, 32 }, /* acchi */
246  { 79, -1, 32 }, /* m0 */
247  { 80, -1, 32 }, /* m1 */
248  { 81, -1, 32 }, /* m2 */
249  { 82, -1, 32 }, /* m3 */
250  { 83, -1, 32 }, /* expstate */
251  { 84, -1, 32 }, /* f64r_lo */
252  { 85, -1, 32 }, /* f64r_hi */
253  { 86, -1, 32 }, /* f64s */
254  { 87, -1, 32 }, /* f0 */
255  { 88, -1, 32 }, /* f1 */
256  { 89, -1, 32 }, /* f2 */
257  { 90, -1, 32 }, /* f3 */
258  { 91, -1, 32 }, /* f4 */
259  { 92, -1, 32 }, /* f5 */
260  { 93, -1, 32 }, /* f6 */
261  { 94, -1, 32 }, /* f7 */
262  { 95, -1, 32 }, /* f8 */
263  { 96, -1, 32 }, /* f9 */
264  { 97, -1, 32 }, /* f10 */
265  { 98, -1, 32 }, /* f11 */
266  { 99, -1, 32 }, /* f12 */
267  { 100, -1, 32 }, /* f13 */
268  { 101, -1, 32 }, /* f14 */
269  { 102, -1, 32 }, /* f15 */
270  { 103, -1, 32 }, /* fcr */
271  { 104, -1, 32 }, /* fsr */
272 };
273 
275  .stack_registers_size = 26 * 4,
276  .stack_growth_direction = -1,
277  .num_output_registers = ARRAY_SIZE(nuttx_stack_offsets_esp32),
278  .calculate_process_stack = rtos_generic_stack_align8,
279  .register_offsets = nuttx_stack_offsets_esp32,
280  .read_stack = nuttx_esp_xtensa_stack_read,
281 };
282 
283 static const struct stack_register_offset nuttx_stack_offsets_esp32s2[] = {
284  { 0, 0x00, 32 }, /* PC */
285  { 1, 0x08, 32 }, /* A0 */
286  { 2, 0x0c, 32 }, /* A1 */
287  { 3, 0x10, 32 }, /* A2 */
288  { 4, 0x14, 32 }, /* A3 */
289  { 5, 0x18, 32 }, /* A4 */
290  { 6, 0x1c, 32 }, /* A5 */
291  { 7, 0x20, 32 }, /* A6 */
292  { 8, 0x24, 32 }, /* A7 */
293  { 9, 0x28, 32 }, /* A8 */
294  { 10, 0x2c, 32 }, /* A9 */
295  { 11, 0x30, 32 }, /* A10 */
296  { 12, 0x34, 32 }, /* A11 */
297  { 13, 0x38, 32 }, /* A12 */
298  { 14, 0x3c, 32 }, /* A13 */
299  { 15, 0x40, 32 }, /* A14 */
300  { 16, 0x44, 32 }, /* A15 */
301  /* A16-A63 aren't in the stack frame because they've been flushed to the stack earlier */
302  { 17, -1, 32 }, /* A16 */
303  { 18, -1, 32 }, /* A17 */
304  { 19, -1, 32 }, /* A18 */
305  { 20, -1, 32 }, /* A19 */
306  { 21, -1, 32 }, /* A20 */
307  { 22, -1, 32 }, /* A21 */
308  { 23, -1, 32 }, /* A22 */
309  { 24, -1, 32 }, /* A23 */
310  { 25, -1, 32 }, /* A24 */
311  { 26, -1, 32 }, /* A25 */
312  { 27, -1, 32 }, /* A26 */
313  { 28, -1, 32 }, /* A27 */
314  { 29, -1, 32 }, /* A28 */
315  { 30, -1, 32 }, /* A29 */
316  { 31, -1, 32 }, /* A30 */
317  { 32, -1, 32 }, /* A31 */
318  { 33, -1, 32 }, /* A32 */
319  { 34, -1, 32 }, /* A33 */
320  { 35, -1, 32 }, /* A34 */
321  { 36, -1, 32 }, /* A35 */
322  { 37, -1, 32 }, /* A36 */
323  { 38, -1, 32 }, /* A37 */
324  { 39, -1, 32 }, /* A38 */
325  { 40, -1, 32 }, /* A39 */
326  { 41, -1, 32 }, /* A40 */
327  { 42, -1, 32 }, /* A41 */
328  { 43, -1, 32 }, /* A42 */
329  { 44, -1, 32 }, /* A43 */
330  { 45, -1, 32 }, /* A44 */
331  { 46, -1, 32 }, /* A45 */
332  { 47, -1, 32 }, /* A46 */
333  { 48, -1, 32 }, /* A47 */
334  { 49, -1, 32 }, /* A48 */
335  { 50, -1, 32 }, /* A49 */
336  { 51, -1, 32 }, /* A50 */
337  { 52, -1, 32 }, /* A51 */
338  { 53, -1, 32 }, /* A52 */
339  { 54, -1, 32 }, /* A53 */
340  { 55, -1, 32 }, /* A54 */
341  { 56, -1, 32 }, /* A55 */
342  { 57, -1, 32 }, /* A56 */
343  { 58, -1, 32 }, /* A57 */
344  { 59, -1, 32 }, /* A58 */
345  { 60, -1, 32 }, /* A59 */
346  { 61, -1, 32 }, /* A60 */
347  { 62, -1, 32 }, /* A61 */
348  { 63, -1, 32 }, /* A62 */
349  { 64, -1, 32 }, /* A63 */
350  { 65, 0x48, 32 }, /* SAR */
351  { 66, -1, 32 }, /* windowbase */
352  { 67, -1, 32 }, /* windowstart */
353  { 68, -1, 32 }, /* configid0 */
354  { 69, -1, 32 }, /* configid1 */
355  { 70, 0x04, 32 }, /* PS */
356  { 71, -1, 32 }, /* threadptr */
357  { 72, -1, 32 }, /* gpio_out */
358 };
359 
361  .stack_registers_size = 25 * 4,
362  .stack_growth_direction = -1,
363  .num_output_registers = ARRAY_SIZE(nuttx_stack_offsets_esp32s2),
364  .calculate_process_stack = rtos_generic_stack_align8,
365  .register_offsets = nuttx_stack_offsets_esp32s2,
366  .read_stack = nuttx_esp_xtensa_stack_read,
367 };
368 
369 static const struct stack_register_offset nuttx_stack_offsets_esp32s3[] = {
370  { 0, 0x00, 32 }, /* PC */
371  { 1, 0x08, 32 }, /* A0 */
372  { 2, 0x0c, 32 }, /* A1 */
373  { 3, 0x10, 32 }, /* A2 */
374  { 4, 0x14, 32 }, /* A3 */
375  { 5, 0x18, 32 }, /* A4 */
376  { 6, 0x1c, 32 }, /* A5 */
377  { 7, 0x20, 32 }, /* A6 */
378  { 8, 0x24, 32 }, /* A7 */
379  { 9, 0x28, 32 }, /* A8 */
380  { 10, 0x2c, 32 }, /* A9 */
381  { 11, 0x30, 32 }, /* A10 */
382  { 12, 0x34, 32 }, /* A11 */
383  { 13, 0x38, 32 }, /* A12 */
384  { 14, 0x3c, 32 }, /* A13 */
385  { 15, 0x40, 32 }, /* A14 */
386  { 16, 0x44, 32 }, /* A15 */
387  /* A16-A63 aren't in the stack frame because they've been flushed to the stack earlier */
388  { 17, -1, 32 }, /* A16 */
389  { 18, -1, 32 }, /* A17 */
390  { 19, -1, 32 }, /* A18 */
391  { 20, -1, 32 }, /* A19 */
392  { 21, -1, 32 }, /* A20 */
393  { 22, -1, 32 }, /* A21 */
394  { 23, -1, 32 }, /* A22 */
395  { 24, -1, 32 }, /* A23 */
396  { 25, -1, 32 }, /* A24 */
397  { 26, -1, 32 }, /* A25 */
398  { 27, -1, 32 }, /* A26 */
399  { 28, -1, 32 }, /* A27 */
400  { 29, -1, 32 }, /* A28 */
401  { 30, -1, 32 }, /* A29 */
402  { 31, -1, 32 }, /* A30 */
403  { 32, -1, 32 }, /* A31 */
404  { 33, -1, 32 }, /* A32 */
405  { 34, -1, 32 }, /* A33 */
406  { 35, -1, 32 }, /* A34 */
407  { 36, -1, 32 }, /* A35 */
408  { 37, -1, 32 }, /* A36 */
409  { 38, -1, 32 }, /* A37 */
410  { 39, -1, 32 }, /* A38 */
411  { 40, -1, 32 }, /* A39 */
412  { 41, -1, 32 }, /* A40 */
413  { 42, -1, 32 }, /* A41 */
414  { 43, -1, 32 }, /* A42 */
415  { 44, -1, 32 }, /* A43 */
416  { 45, -1, 32 }, /* A44 */
417  { 46, -1, 32 }, /* A45 */
418  { 47, -1, 32 }, /* A46 */
419  { 48, -1, 32 }, /* A47 */
420  { 49, -1, 32 }, /* A48 */
421  { 50, -1, 32 }, /* A49 */
422  { 51, -1, 32 }, /* A50 */
423  { 52, -1, 32 }, /* A51 */
424  { 53, -1, 32 }, /* A52 */
425  { 54, -1, 32 }, /* A53 */
426  { 55, -1, 32 }, /* A54 */
427  { 56, -1, 32 }, /* A55 */
428  { 57, -1, 32 }, /* A56 */
429  { 58, -1, 32 }, /* A57 */
430  { 59, -1, 32 }, /* A58 */
431  { 60, -1, 32 }, /* A59 */
432  { 61, -1, 32 }, /* A60 */
433  { 62, -1, 32 }, /* A61 */
434  { 63, -1, 32 }, /* A62 */
435  { 64, -1, 32 }, /* A63 */
436  { 65, 0x58, 32 }, /* lbeg */
437  { 66, 0x5c, 32 }, /* lend */
438  { 67, 0x60, 32 }, /* lcount */
439  { 68, 0x48, 32 }, /* SAR */
440  { 69, -1, 32 }, /* windowbase */
441  { 70, -1, 32 }, /* windowstart */
442  { 71, -1, 32 }, /* configid0 */
443  { 72, -1, 32 }, /* configid1 */
444  { 73, 0x04, 32 }, /* PS */
445  { 74, -1, 32 }, /* threadptr */
446  { 75, -1, 32 }, /* br */
447  { 76, 0x54, 32 }, /* scompare1 */
448  { 77, -1, 32 }, /* acclo */
449  { 78, -1, 32 }, /* acchi */
450  { 79, -1, 32 }, /* m0 */
451  { 80, -1, 32 }, /* m1 */
452  { 81, -1, 32 }, /* m2 */
453  { 82, -1, 32 }, /* m3 */
454  { 83, -1, 32 }, /* gpio_out */
455  { 84, -1, 32 }, /* f0 */
456  { 85, -1, 32 }, /* f1 */
457  { 86, -1, 32 }, /* f2 */
458  { 87, -1, 32 }, /* f3 */
459  { 88, -1, 32 }, /* f4 */
460  { 89, -1, 32 }, /* f5 */
461  { 90, -1, 32 }, /* f6 */
462  { 91, -1, 32 }, /* f7 */
463  { 92, -1, 32 }, /* f8 */
464  { 93, -1, 32 }, /* f9 */
465  { 94, -1, 32 }, /* f10 */
466  { 95, -1, 32 }, /* f11 */
467  { 96, -1, 32 }, /* f12 */
468  { 97, -1, 32 }, /* f13 */
469  { 98, -1, 32 }, /* f14 */
470  { 99, -1, 32 }, /* f15 */
471  { 100, -1, 32 }, /* fcr */
472  { 101, -1, 32 }, /* fsr */
473  { 102, -1, 32 }, /* accx_0 */
474  { 103, -1, 32 }, /* accx_1 */
475  { 104, -1, 32 }, /* qacc_h_0 */
476  { 105, -1, 32 }, /* qacc_h_1 */
477  { 106, -1, 32 }, /* qacc_h_2 */
478  { 107, -1, 32 }, /* qacc_h_3 */
479  { 108, -1, 32 }, /* qacc_h_4 */
480  { 109, -1, 32 }, /* qacc_l_0 */
481  { 110, -1, 32 }, /* qacc_l_1 */
482  { 111, -1, 32 }, /* qacc_l_2 */
483  { 112, -1, 32 }, /* qacc_l_3 */
484  { 113, -1, 32 }, /* qacc_l_4 */
485  { 114, -1, 32 }, /* sar_byte */
486  { 115, -1, 32 }, /* fft_bit_width */
487  { 116, -1, 32 }, /* ua_state_0 */
488  { 117, -1, 32 }, /* ua_state_1 */
489  { 118, -1, 32 }, /* ua_state_2 */
490  { 119, -1, 32 }, /* ua_state_3 */
491  { 120, -1, 128 }, /* q0 */
492  { 121, -1, 128 }, /* q1 */
493  { 122, -1, 128 }, /* q2 */
494  { 123, -1, 128 }, /* q3 */
495  { 124, -1, 128 }, /* q4 */
496  { 125, -1, 128 }, /* q5 */
497  { 126, -1, 128 }, /* q6 */
498  { 127, -1, 128 }, /* q7 */
499 };
500 
502  .stack_registers_size = 26 * 4,
503  .stack_growth_direction = -1,
504  .num_output_registers = ARRAY_SIZE(nuttx_stack_offsets_esp32s3),
505  .calculate_process_stack = rtos_generic_stack_align8,
506  .register_offsets = nuttx_stack_offsets_esp32s3,
507  .read_stack = nuttx_esp_xtensa_stack_read,
508 };
@ ARMV7M_R1
Definition: armv7m.h:108
@ ARMV7M_R6
Definition: armv7m.h:114
@ ARMV7M_R2
Definition: armv7m.h:109
@ ARMV7M_R3
Definition: armv7m.h:110
@ ARMV7M_R14
Definition: armv7m.h:124
@ ARMV7M_R9
Definition: armv7m.h:118
@ ARMV7M_R12
Definition: armv7m.h:122
@ ARMV7M_R0
Definition: armv7m.h:107
@ ARMV7M_R13
Definition: armv7m.h:123
@ ARMV7M_PC
Definition: armv7m.h:125
@ ARMV7M_R7
Definition: armv7m.h:115
@ ARMV7M_R4
Definition: armv7m.h:112
@ ARMV7M_XPSR
Definition: armv7m.h:127
@ ARMV7M_R8
Definition: armv7m.h:117
@ ARMV7M_R11
Definition: armv7m.h:120
@ ARMV7M_R10
Definition: armv7m.h:119
@ ARMV7M_R5
Definition: armv7m.h:113
@ GDB_REGNO_S8
Definition: gdb_regs.h:35
@ GDB_REGNO_S4
Definition: gdb_regs.h:31
@ GDB_REGNO_S11
Definition: gdb_regs.h:38
@ GDB_REGNO_ZERO
Definition: gdb_regs.h:9
@ GDB_REGNO_S5
Definition: gdb_regs.h:32
@ GDB_REGNO_T5
Definition: gdb_regs.h:41
@ GDB_REGNO_T6
Definition: gdb_regs.h:42
@ GDB_REGNO_A4
Definition: gdb_regs.h:24
@ GDB_REGNO_GP
Definition: gdb_regs.h:12
@ GDB_REGNO_S7
Definition: gdb_regs.h:34
@ GDB_REGNO_A1
Definition: gdb_regs.h:21
@ GDB_REGNO_A5
Definition: gdb_regs.h:25
@ GDB_REGNO_T2
Definition: gdb_regs.h:16
@ GDB_REGNO_S1
Definition: gdb_regs.h:19
@ GDB_REGNO_T3
Definition: gdb_regs.h:39
@ GDB_REGNO_SP
Definition: gdb_regs.h:11
@ GDB_REGNO_A6
Definition: gdb_regs.h:27
@ GDB_REGNO_FP
Definition: gdb_regs.h:18
@ GDB_REGNO_A0
Definition: gdb_regs.h:20
@ GDB_REGNO_A2
Definition: gdb_regs.h:22
@ GDB_REGNO_A7
Definition: gdb_regs.h:28
@ GDB_REGNO_RA
Definition: gdb_regs.h:10
@ GDB_REGNO_S9
Definition: gdb_regs.h:36
@ GDB_REGNO_PC
Definition: gdb_regs.h:45
@ GDB_REGNO_T4
Definition: gdb_regs.h:40
@ GDB_REGNO_S10
Definition: gdb_regs.h:37
@ GDB_REGNO_S2
Definition: gdb_regs.h:29
@ GDB_REGNO_TP
Definition: gdb_regs.h:13
@ GDB_REGNO_T1
Definition: gdb_regs.h:15
@ GDB_REGNO_S6
Definition: gdb_regs.h:33
@ GDB_REGNO_S3
Definition: gdb_regs.h:30
@ GDB_REGNO_T0
Definition: gdb_regs.h:14
@ GDB_REGNO_A3
Definition: gdb_regs.h:23
#define LOG_ERROR(expr ...)
Definition: log.h:132
#define ERROR_OK
Definition: log.h:164
#define sp
Definition: mips32.c:222
static const struct stack_register_offset nuttx_stack_offsets_esp32s2[]
static const struct stack_register_offset nuttx_stack_offsets_cortex_m[]
const struct rtos_register_stacking nuttx_esp32s2_stacking
const struct rtos_register_stacking nuttx_riscv_stacking
const struct rtos_register_stacking nuttx_esp32s3_stacking
static int nuttx_cortex_m_tcbinfo_stack_read(struct target *target, int64_t stack_ptr, const struct rtos_register_stacking *stacking, uint8_t *stack_data)
const struct rtos_register_stacking nuttx_esp32_stacking
const struct rtos_register_stacking nuttx_stacking_cortex_m
static const struct stack_register_offset nuttx_stack_offsets_esp32[]
static const struct stack_register_offset nuttx_stack_offsets_esp32s3[]
static int nuttx_esp_xtensa_stack_read(struct target *target, int64_t stack_ptr, const struct rtos_register_stacking *stacking, uint8_t *stack_data)
static const struct stack_register_offset nuttx_stack_offsets_riscv[]
@ NX_SYM_REG_OFFSETS
target_addr_t rtos_generic_stack_align8(struct target *target, const uint8_t *stack_data, const struct rtos_register_stacking *stacking, target_addr_t stack_ptr)
#define BIT(nr)
Definition: stm32l4x.h:18
const struct stack_register_offset * register_offsets
Definition: rtos.h:104
unsigned char num_output_registers
Definition: rtos.h:94
unsigned char stack_registers_size
Definition: rtos.h:92
signed char stack_growth_direction
Definition: rtos.h:93
Definition: rtos.h:36
struct symbol_table_elem * symbols
Definition: rtos.h:39
struct target * target
Definition: rtos.h:40
unsigned short width_bits
Definition: rtos.h:88
signed short offset
Definition: rtos.h:85
symbol_address_t address
Definition: rtos.h:25
Definition: target.h:116
struct rtos * rtos
Definition: target.h:183
void target_buffer_set_u32(struct target *target, uint8_t *buffer, uint32_t value)
Definition: target.c:352
int target_read_buffer(struct target *target, target_addr_t address, uint32_t size, uint8_t *buffer)
Definition: target.c:2407
int target_read_u16(struct target *target, target_addr_t address, uint16_t *value)
Definition: target.c:2574
uint32_t target_buffer_get_u32(struct target *target, const uint8_t *buffer)
Definition: target.c:316
#define ARRAY_SIZE(x)
Compute the number of elements of a variable length array.
Definition: types.h:57
uint64_t target_addr_t
Definition: types.h:335
#define NULL
Definition: usb.h:16