From 3c11825cda5f99801abdec477820b18df104d795 Mon Sep 17 00:00:00 2001 From: Masayuki Ishikawa Date: Mon, 23 Nov 2020 08:31:35 +0900 Subject: [PATCH] tools: Fix nuttx-gdbinit for armv7-m with FPU Summary: - Brennan reported the script does not work with nucleo-h743zi:otg_fs_host - Actually, the config uses FPU but the script did not detect it - The script assumed that the nuttx contains fpuconfig symbol - However, this assumption was incorrect - This commit fixes this issue by detecting FPU with tcb->xcp.regs Impact: - Cortex-M targets Testing: - Tested with lm3s6965-ek:discover (Cortex-M3) - Tested with spresense:wifi_smp (Cortex-M4F) - Tested with sim:smp (x86_64) Signed-off-by: Masayuki Ishikawa --- tools/nuttx-gdbinit | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tools/nuttx-gdbinit b/tools/nuttx-gdbinit index 2266bf4e5f..89c95bf9c1 100644 --- a/tools/nuttx-gdbinit +++ b/tools/nuttx-gdbinit @@ -48,9 +48,15 @@ define _examine_target if ($_target_examined == 0x0) _examine_arch - python gdb.execute("set $_target_has_fpu = 0") - python if (type(gdb.lookup_global_symbol("fpuconfig")) is gdb.Symbol) : \ - gdb.execute("set $_target_has_fpu = 1") + set $_tcb0 = g_pidhash[0].tcb + set $_xcp_nregs = sizeof($_tcb0->xcp.regs) / sizeof($_tcb0->xcp.regs[0]) + set $_target_has_fpu = 0 + + if ($_streq($_target_arch, "armv7e-m") == 1) + if ($_xcp_nregs != 19) + set $_target_has_fpu = 1 + end + end python gdb.execute("set $_target_has_smp = 0") python if (type(gdb.lookup_global_symbol("g_assignedtasks")) is gdb.Symbol) : \