Jlink GDB 调试

wangjintao@sh-wangjintao /cygdrive/d/Project/Project-xiaomiWatch/watch
$ ToolChain/win/gcc-arm-none-eabi-8-2018-q4-major/bin/arm-none-eabi-gdb out_obj_st/smart_watch_stm32.elf
GNU gdb (GNU Tools for Arm Embedded Processors 8-2018-q4-major) 8.2.50.20181213-git
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "--host=i686-w64-mingw32 --target=arm-none-eabi".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from out_obj_st/smart_watch_stm32.elf...
(gdb) tar ect:2331
Undefined target command: "ect:2331".  Try "help target".
(gdb) tar ext:2331
Remote debugging using :2331
0x08056f78 in cm_backtrace_fault (fault_handler_lr=135392203,
    fault_handler_sp=536954328)
    at ../../Module/SysLogger/CmBacktrace/cm_backtrace.c:583
583         CMB_ASSERT(init_ok);
(gdb) bt
#0  0x08056f78 in cm_backtrace_fault (fault_handler_lr=135392203,
    fault_handler_sp=536954328)
    at ../../Module/SysLogger/CmBacktrace/cm_backtrace.c:583
#1  0x0811f08e in sys_panic (lr=135392203, sp=536954328)
    at ../../Module/SysLogger/sw_logger.c:1295
#2  0x08047d44 in HardFaultHandler (pStack=0x200145d8 <ucHeap+37756>)
    at HardFaultHandler/SEGGER_HardFaultHandler.c:266
#3  <signal handler called>
#4  0x0810a918 in prvPortStartFirstTask ()
    at ../../FreeRTOS/Source/portable/GCC/ARM_CM4F/port.c:267
#5  0x0810aa08 in xPortStartScheduler ()
    at ../../FreeRTOS/Source/portable/GCC/ARM_CM4F/port.c:379
Backtrace stopped: previous frame inner to this frame (corrupt stack?)
(gdb) p HardFaultRegs
$1 = {SavedRegs = {r0 = 4294967294, r1 = 536954400, r2 = 4294967295,
    r3 = 4294967294, r12 = 135964553, lr = 135392203, pc = 135390688, psr = {
      byte = 2164260864, bits = {IPSR = 0, EPSR = 65536, APSR = 16}}},
  syshndctrl = {byte = 0, bits = {MEMFAULTACT = 0, BUSFAULTACT = 0,
      UnusedBits1 = 0, USGFAULTACT = 0, UnusedBits2 = 0, SVCALLACT = 0,
      MONITORACT = 0, UnusedBits3 = 0, PENDSVACT = 0, SYSTICKACT = 0,
      USGFAULTPENDED = 0, MEMFAULTPENDED = 0, BUSFAULTPENDED = 0,
      SVCALLPENDED = 0, MEMFAULTENA = 0, BUSFAULTENA = 0, USGFAULTENA = 0}},
  mfsr = {byte = 0 '\000', bits = {IACCVIOL = 0 '\000', DACCVIOL = 0 '\000',
      UnusedBits = 0 '\000', MUNSTKERR = 0 '\000', MSTKERR = 0 '\000',
      UnusedBits2 = 0 '\000', MMARVALID = 0 '\000'}}, bfsr = {byte = 130,
    bits = {IBUSERR = 0, PRECISERR = 1, IMPREISERR = 0, UNSTKERR = 0,
      STKERR = 0, UnusedBits = 0, BFARVALID = 1}}, bfar = 4294967294, ufsr = {
    byte = 0, bits = {UNDEFINSTR = 0, INVSTATE = 0, INVPC = 0, NOCP = 0,
      UnusedBits = 0, UNALIGNED = 0, DIVBYZERO = 0}}, hfsr = {
    byte = 1073741824, bits = {UnusedBits = 0, VECTBL = 0, UnusedBits2 = 0,
      FORCED = 1, DEBUGEVT = 0}}, dfsr = {byte = 0, bits = {HALTED = 0,
      BKPT = 0, DWTTRAP = 0, VCATCH = 0, EXTERNAL = 0}}, afsr = 0}
(gdb) info line *135390688
Line 360 of "../../Module/SysLogger/sw_logger.c"
   starts at address 0x811e5e0 <simple_strlen+34>
   and ends at 0x811e5e2 <simple_strlen+36>.
(gdb) info line *135392203
Line 767 of "../../Module/SysLogger/sw_logger.c"
   starts at address 0x811ebc4 <sw_vsprintf+500>
   and ends at 0x811ebcc <sw_vsprintf+508>.
(gdb)
wangjintao@sh-wangjintao /cygdrive/d/Project/Project-xiaomiWatch/watch/App
$ ./gdb.sh
GNU gdb (GNU Tools for Arm Embedded Processors 8-2018-q4-major) 8.2.50.20181213-git
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "--host=i686-w64-mingw32 --target=arm-none-eabi".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from smart_watch_stm32.elf...
prvCheckTasksWaitingTermination () at ../../FreeRTOS/Source/tasks.c:3601
3601                    while( uxDeletedTasksWaitingCleanUp > ( UBaseType_t ) 0U )
$1 = {SavedRegs = {r0 = 0x0, r1 = 0x0, r2 = 0x0, r3 = 0x0, r12 = 0x0,
    lr = 0x0, pc = 0x0, psr = {byte = 0x0, bits = {IPSR = 0x0, EPSR = 0x0,
        APSR = 0x0}}}, syshndctrl = {byte = 0x0, bits = {MEMFAULTACT = 0x0,
      BUSFAULTACT = 0x0, UnusedBits1 = 0x0, USGFAULTACT = 0x0,
      UnusedBits2 = 0x0, SVCALLACT = 0x0, MONITORACT = 0x0,
      UnusedBits3 = 0x0, PENDSVACT = 0x0, SYSTICKACT = 0x0,
      USGFAULTPENDED = 0x0, MEMFAULTPENDED = 0x0, BUSFAULTPENDED = 0x0,
      SVCALLPENDED = 0x0, MEMFAULTENA = 0x0, BUSFAULTENA = 0x0,
      USGFAULTENA = 0x0}}, mfsr = {byte = 0x0, bits = {IACCVIOL = 0x0,
      DACCVIOL = 0x0, UnusedBits = 0x0, MUNSTKERR = 0x0, MSTKERR = 0x0,
      UnusedBits2 = 0x0, MMARVALID = 0x0}}, bfsr = {byte = 0x0, bits = {
      IBUSERR = 0x0, PRECISERR = 0x0, IMPREISERR = 0x0, UNSTKERR = 0x0,
      STKERR = 0x0, UnusedBits = 0x0, BFARVALID = 0x0}}, bfar = 0x0, ufsr = {
    byte = 0x0, bits = {UNDEFINSTR = 0x0, INVSTATE = 0x0, INVPC = 0x0,
      NOCP = 0x0, UnusedBits = 0x0, UNALIGNED = 0x0, DIVBYZERO = 0x0}},
  hfsr = {byte = 0x0, bits = {UnusedBits = 0x0, VECTBL = 0x0,
      UnusedBits2 = 0x0, FORCED = 0x0, DEBUGEVT = 0x0}}, dfsr = {byte = 0x0,
    bits = {HALTED = 0x0, BKPT = 0x0, DWTTRAP = 0x0, VCATCH = 0x0,
      EXTERNAL = 0x0}}, afsr = 0x0}
No line number information available.
No line number information available.
(gdb) bt
#0  prvCheckTasksWaitingTermination () at ../../FreeRTOS/Source/tasks.c:3601
#1  0x081493b8 in prvIdleTask (pvParameters=0x0)
    at ../../FreeRTOS/Source/tasks.c:3359
#2  0x08131484 in pxPortInitialiseStack (pxTopOfStack=0x0, pxCode=0xa5a5a5a5,
    pvParameters=0x81493b9 <prvIdleTask+12>)
    at ../../FreeRTOS/Source/portable/GCC/ARM_CM4F/port.c:214
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb) p uxDeletedTasksWaitingCleanUp
$2 = 0
(gdb) n
3616    }
(gdb) n
prvIdleTask (pvParameters=0x0) at ../../FreeRTOS/Source/tasks.c:3382
3382                            if( listCURRENT_LIST_LENGTH( &( pxReadyTasksLists[ tskIDLE_PRIORITY ] ) ) > ( UBaseType_t ) 1 )
(gdb) n
3359                    prvCheckTasksWaitingTermination();
(gdb) list
3354
3355            for( ;; )
3356            {
3357                    /* See if any tasks have deleted themselves - if so then the idle task
3358                    is responsible for freeing the deleted task's TCB and stack. */
3359                    prvCheckTasksWaitingTermination();
3360
3361                    #if ( configUSE_PREEMPTION == 0 )
3362                    {
3363                            /* If we are not using preemption we keep forcing a task switch to
(gdb) n
3382                            if( listCURRENT_LIST_LENGTH( &( pxReadyTasksLists[ tskIDLE_PRIORITY ] ) ) > ( UBaseType_t ) 1 )
(gdb) n
3359                    prvCheckTasksWaitingTermination();
(gdb) n
3382                            if( listCURRENT_LIST_LENGTH( &( pxReadyTasksLists[ tskIDLE_PRIORITY ] ) ) > ( UBaseType_t ) 1 )
(gdb) n
3359                    prvCheckTasksWaitingTermination();
(gdb) n
3382                            if( listCURRENT_LIST_LENGTH( &( pxReadyTasksLists[ tskIDLE_PRIORITY ] ) ) > ( UBaseType_t ) 1 )
(gdb) n
3359                    prvCheckTasksWaitingTermination();
(gdb) n
3382                            if( listCURRENT_LIST_LENGTH( &( pxReadyTasksLists[ tskIDLE_PRIORITY ] ) ) > ( UBaseType_t ) 1 )
(gdb) n
3359                    prvCheckTasksWaitingTermination();
(gdb) n
3382                            if( listCURRENT_LIST_LENGTH( &( pxReadyTasksLists[ tskIDLE_PRIORITY ] ) ) > ( UBaseType_t ) 1 )
(gdb) bt
#0  prvIdleTask (pvParameters=0x0) at ../../FreeRTOS/Source/tasks.c:3382
#1  0x08131484 in pxPortInitialiseStack (pxTopOfStack=0x0, pxCode=0xa5a5a5a5,
    pvParameters=0x81493b9 <prvIdleTask+12>)
    at ../../FreeRTOS/Source/portable/GCC/ARM_CM4F/port.c:214
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb) n
3359                    prvCheckTasksWaitingTermination();
(gdb) bt
#0  prvIdleTask (pvParameters=0x0) at ../../FreeRTOS/Source/tasks.c:3359
#1  0x08131484 in pxPortInitialiseStack (pxTopOfStack=0x0, pxCode=0xa5a5a5a5,
    pvParameters=0x81493b9 <prvIdleTask+12>)
    at ../../FreeRTOS/Source/portable/GCC/ARM_CM4F/port.c:214
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb) b sw_main.c:291
Breakpoint 1 at 0x8147eac: file 70mai/sw_main.c, line 292.
(gdb) c
Continuing.

Breakpoint 1, MainTask (para=0x0) at 70mai/sw_main.c:292
292                     if(pdTRUE == xResult)
(gdb) n
372                     }
(gdb) n
374                     GetSystemTime(&SystemTime);
(gdb) n
375                     LOG_INFO("Hours:%d Minutes:%d Seconds:%d\n",  SystemTime.Hours,SystemTime.Minutes,SystemTime.Seconds);
(gdb) n
376                     LOG_INFO("AmoledSel:%d PSRAMID:0x%x  NandID:0x%x \n",xdevinfo.AmoledSel,xdevinfo.PsramID,xdevinfo.NandFlashId);
(gdb) n
290                     xResult = xQueueReceive(sys_manage_queue, &sys_cmd, pdMS_TO_TICKS(5000)); //portMAX_DELAY
(gdb)

2、用j-link commander 读写flash

发布了91 篇原创文章 · 获赞 160 · 访问量 19万+

猜你喜欢

转载自blog.csdn.net/weixin_40204595/article/details/98595676
今日推荐