Просто заметка, что бы самому потом не потерять.
Руководство для отладки потоков в RTOS NuttX:
Отмечу, что последние версии GDB и OpenOCD включают весь необходимый софт для работы. А если грузить ELF как-то так:
arm-none-eabi-gdb main.elf \
-ex "target extended-remote | openocd -f interface/stlink.cfg -f ${OPENOCD_CFG} -c 'gdb_port pipe' -c '\$_CHIPNAME.cpu0 configure -rtos nuttx'" -x openocd_nuttx_gdb.rc
То содержимое openocd_nuttx_gdb.rc
стоит сделать таким:
define hookpost-file
eval "monitor nuttx.pid_offset %d", &((struct tcb_s *)(0))->pid
eval "monitor nuttx.xcpreg_offset %d", &((struct tcb_s *)(0))->xcp.regs
eval "monitor nuttx.state_offset %d", &((struct tcb_s *)(0))->task_state
eval "monitor nuttx.name_offset %d", &((struct tcb_s *)(0))->name
eval "monitor nuttx.name_size %d", sizeof(((struct tcb_s *)(0))->name)
end
eval "monitor nuttx.pid_offset %d", &((struct tcb_s *)(0))->pid
eval "monitor nuttx.xcpreg_offset %d", &((struct tcb_s *)(0))->xcp.regs
eval "monitor nuttx.state_offset %d", &((struct tcb_s *)(0))->task_state
eval "monitor nuttx.name_offset %d", &((struct tcb_s *)(0))->name
eval "monitor nuttx.name_size %d", sizeof(((struct tcb_s *)(0))->name)
т.е. что бы и хуком на команду file сработало и сразу же отработало. Как будет более красивое решение - подправлю.
Ещё остался не опробованным вариант отладки с включенной PROCFS и скриптом nuttx/tools/pynuttx/gdbinit.py
из поставки NuttX.