Breakpoints not working for NUCLEO-F746ZG

Sysprogs forums Forums VisualGDB Breakpoints not working for NUCLEO-F746ZG

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #11653
    adchester
    Participant

    Hi, I can compile and run firmware on an STM32F746ZG NUCLEO evaluation board however, breakpoints are not working at any level other than global. So the program will not break in any called functions or even in switch cases in main.c.

    I have copied the program output below.

    The breakpoints do seem to be hit because the embedded hardware stops functioning however the UI behaves as if a breakpoint has not been hit and so no debugging can be done.

    Breakpoints do seem to work in a sample project that uses the serial to USB debug serial port.

    I had selected “Fixed-size stack and heap” in the project properties Embedded Frameworks page. However, when I noticed the following in the program output:

    ~”\tWhile running this, GDB does not access memory from…\n”
    ~”Local exec file:\n”
    ~”\t`C:\\Users\\Alex\\Documents\\Business\\Gaiatek\\SilentSentinel\\Stabilisation\\VisualStudio\\CameraStabilisation_002_Recovered\\VisualGDB\\Debug\\CameraStabilisation_002′, file type elf32-littlearm.\n”
    ~”\tEntry point: 0x80003f0\n”
    ~”\t0x08000000 – 0x080001c8 is .isr_vector\n”
    ~”\t0x080001c8 – 0x08009ef8 is .text\n”
    ~”\t0x08009ef8 – 0x08009ef8 is .eh_frame\n”
    ~”\t0x08009ef8 – 0x08009f00 is .init_array\n”
    ~”\t0x08009f00 – 0x08009f04 is .fini_array\n”
    ~”\t0x20000000 – 0x200001b0 is .data\n”
    ~”\t0x200001b0 – 0x200001b0 is .jcr\n”
    ~”\t0x200001b0 – 0x200001b0 is .tm_clone_table\n”
    ~”\t0x200001b0 – 0x20008f28 is .bss\n”
    <strong>~”\t0x20008f28 – 0x2000af28 is .heap\n”</strong>
    <strong>~”\t0x2000af28 – 0x2000c328 is .reserved_for_stack\n”</strong>

    I decided to undo “Fixed-size stack and heap” by unselecting it. This resulted in a build error:

    Error ld returned 1 exit status CameraStabilisation_002 C:\Users\Alex\Documents\Business\Gaiatek\SilentSentinel\Stabilisation\VisualStudio\CameraStabilisation_002_Recovered\CameraStabilisation_002\collect2.exe 1

    The project now appears to be broken because even when I re select “Fixed-size stack and heap”, the same error persists. However I have a backup of the project before it was broken and my main concern is to get the breakpoints working.

    Here is  the program output when a breakpoint is added (inside a C++ class definition in main.c) during running and also the stm32.xmlsettings file:

    VisualGDB is licensed to Tatum Maskell at Silent Sentinel Limited
    C:\SysGCC\arm-eabi\bin\arm-eabi-gdb.exe –interpreter mi C:\Users\Alex\Documents\Business\Gaiatek\SilentSentinel\Stabilisation\VisualStudio\CameraStabilisation_002_Recovered\VisualGDB\Debug\CameraStabilisation_002
    -gdb-version
    =thread-group-added,id=”i1″
    ~”GNU gdb (GDB) 7.12\n”
    ~”Copyright (C) 2016 Free Software Foundation, Inc.\n”
    ~”License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html&gt;\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law. Type \”show copying\”\nand \”show warranty\” for details.\n”
    ~”This GDB was configured as \”–host=i686-pc-mingw32 –target=arm-eabi\”.\nType \”show configuration\” for configuration details.”
    ~”\nFor bug reporting instructions, please see:\n”
    ~”<http://www.gnu.org/software/gdb/bugs/&gt;.\n”
    ~”Find the GDB manual and other documentation resources online at:\n<http://www.gnu.org/software/gdb/documentation/&gt;.\n”
    ~”For help, type \”help\”.\n”
    ~”Type \”apropos word\” to search for commands related to \”word\”…\n”
    ~”Reading symbols from C:\\Users\\Alex\\Documents\\Business\\Gaiatek\\SilentSentinel\\Stabilisation\\VisualStudio\\CameraStabilisation_002_Recovered\\VisualGDB\\Debug\\CameraStabilisation_002…”
    ~”done.\n”
    ~”GNU gdb (GDB) 7.12\n”
    ~”Copyright (C) 2016 Free Software Foundation, Inc.\n”
    ~”License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html&gt;\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law. Type \”show copying\”\nand \”show warranty\” for details.\n”
    ~”This GDB was configured as \”–host=i686-pc-mingw32 –target=arm-eabi\”.\nType \”show configuration\” for configuration details.”
    ~”\nFor bug reporting instructions, please see:\n”
    ~”<http://www.gnu.org/software/gdb/bugs/&gt;.\n”
    ~”Find the GDB manual and other documentation resources online at:\n<http://www.gnu.org/software/gdb/documentation/&gt;.\n”
    ~”For help, type \”help\”.\n”
    ~”Type \”apropos word\” to search for commands related to \”word\”.\n”
    ^done
    -list-features
    ^done,features=[“frozen-varobjs”,”pending-breakpoints”,”thread-info”,”data-read-memory-bytes”,”breakpoint-notifications”,”ada-task-info”,”language-option”,”info-gdb-mi-command”,”undefined-command-error-code”,”exec-run-start-option”]
    -gdb-set disassembly-flavor intel
    ^error,msg=”No symbol \”disassembly\” in current context.”
    -gdb-set print demangle off
    ^done
    -break-insert -f main
    ^done,bkpt={number=”1″,type=”breakpoint”,disp=”keep”,enabled=”y”,addr=”0x08006ad0″,func=”main()”,file=”Main.cpp”,fullname=”C:\\Users\\Alex\\Documents\\Business\\Gaiatek\\SilentSentinel\\Stabilisation\\VisualStudio\\CameraStabilisation_002_Recovered\\CameraStabilisation_002\\Main.cpp”,line=”1139″,thread-groups=[“i1″],times=”0″,original-location=”main”}
    set remotetimeout 60
    &”set remotetimeout 60\n”
    =cmd-param-changed,param=”remotetimeout”,value=”60″
    ^done
    target remote :51092
    &”target remote :51092\n”
    ~”Remote debugging using :51092\n”
    =thread-group-started,id=”i1″,pid=”42000″
    =thread-created,id=”1″,group-id=”i1″
    ~”Reset_Handler () at C:/Users/Alex/AppData/Local/VisualGDB/EmbeddedBSPs/arm-eabi/com.sysprogs.arm.stm32/STM32F7xxxx/StartupFiles/startup_stm32f746xx.c:1106\n”
    ~”1106\t\tfor (pSource = &_sidata, pDest = &_sdata; pDest != &_edata; pSource++, pDest++)\n”
    *stopped,frame={addr=”0x080003f0″,func=”Reset_Handler”,args=[],file=”C:/Users/Alex/AppData/Local/VisualGDB/EmbeddedBSPs/arm-eabi/com.sysprogs.arm.stm32/STM32F7xxxx/StartupFiles/startup_stm32f746xx.c”,fullname=”C:\\Users\\Alex\\AppData\\Local\\VisualGDB\\EmbeddedBSPs\\arm-eabi\\com.sysprogs.arm.stm32\\STM32F7xxxx\\StartupFiles\\startup_stm32f746xx.c”,line=”1106″},thread-id=”1″,stopped-threads=”all”
    ^done
    info shared
    &”info shared\n”
    ~”No shared libraries loaded at this time.\n”
    ^done
    mon halt
    &”mon halt\n”
    ^done
    mon reset init
    &”mon reset init\n”
    @”target halted due to debug-request, current mode: Thread \n”
    @”xPSR: 0x01000000 pc: 0x080003f0 msp: 0x20050000\n”
    ^done
    load
    &”load\n”
    ~”Loading section .isr_vector, size 0x1c8 lma 0x8000000\n”
    +download,{section=”.isr_vector”,section-size=”456″,total-size=”384214″}
    +download,{section=”.isr_vector”,section-sent=”456″,section-size=”456″,total-sent=”456″,total-size=”384214″}
    ~”Loading section .text, size 0x9d30 lma 0x80001c8\n”
    +download,{section=”.text”,section-size=”40240″,total-size=”384214″}
    ~”Loading section .init_array, size 0x8 lma 0x8009ef8\n”
    +download,{section=”.init_array”,section-size=”8″,total-size=”384214″}
    ~”Loading section .fini_array, size 0x4 lma 0x8009f00\n”
    +download,{section=”.fini_array”,section-size=”4″,total-size=”384214″}
    ~”Loading section .data, size 0x1b0 lma 0x8009f04\n”
    +download,{section=”.data”,section-size=”432″,total-size=”384214″}
    ~”Start address 0x80003f0, load size 41140\n”
    ~”Transfer rate: 27 KB/sec, 5877 bytes/write.\n”
    ^done
    -data-evaluate-expression “sizeof(void *)”
    ^done,value=”4″
    -data-evaluate-expression “sizeof(int)”
    ^done,value=”4″
    -data-evaluate-expression “sizeof(short)”
    ^done,value=”2″
    -data-evaluate-expression “sizeof(long)”
    ^done,value=”4″
    -data-evaluate-expression “sizeof(long long)”
    ^done,value=”8″
    -data-evaluate-expression “sizeof(char)”
    ^done,value=”1″
    -data-evaluate-expression “sizeof(wchar_t)”
    ^error,msg=”No symbol \”wchar_t\” in current context.”
    -data-evaluate-expression “sizeof(float)”
    ^done,value=”4″
    -data-evaluate-expression “sizeof(double)”
    ^done,value=”8″
    -data-evaluate-expression “sizeof(long double)”
    ^done,value=”8″
    info target
    &”info target\n”
    ~”Symbols from \”C:\\Users\\Alex\\Documents\\Business\\Gaiatek\\SilentSentinel\\Stabilisation\\VisualStudio\\CameraStabilisation_002_Recovered\\VisualGDB\\Debug\\CameraStabilisation_002\”.\n”
    ~”Remote serial target in gdb-specific protocol:\n”
    ~”Debugging a target over a serial line.\n”
    ~”\tWhile running this, GDB does not access memory from…\n”
    ~”Local exec file:\n”
    ~”\t`C:\\Users\\Alex\\Documents\\Business\\Gaiatek\\SilentSentinel\\Stabilisation\\VisualStudio\\CameraStabilisation_002_Recovered\\VisualGDB\\Debug\\CameraStabilisation_002′, file type elf32-littlearm.\n”
    ~”\tEntry point: 0x80003f0\n”
    ~”\t0x08000000 – 0x080001c8 is .isr_vector\n”
    ~”\t0x080001c8 – 0x08009ef8 is .text\n”
    ~”\t0x08009ef8 – 0x08009ef8 is .eh_frame\n”
    ~”\t0x08009ef8 – 0x08009f00 is .init_array\n”
    ~”\t0x08009f00 – 0x08009f04 is .fini_array\n”
    ~”\t0x20000000 – 0x200001b0 is .data\n”
    ~”\t0x200001b0 – 0x200001b0 is .jcr\n”
    ~”\t0x200001b0 – 0x200001b0 is .tm_clone_table\n”
    ~”\t0x200001b0 – 0x20008f28 is .bss\n”
    ~”\t0x20008f28 – 0x2000af28 is .heap\n”
    ~”\t0x2000af28 – 0x2000c328 is .reserved_for_stack\n”
    ^done
    -data-evaluate-expression “&_estack”
    ^done,value=”0x20050000″
    -var-create – * “*((void **)0x2004fffc)”
    ^done,name=”var1″,numchild=”0″,value=”0x8000421 <Reset_Handler+48>”,type=”void *”,has_more=”0″
    -var-assign “var1″ 0xc44cdbf
    ^done,value=”0xc44cdbf”
    -data-evaluate-expression “\*\(\(void\ \*\*\)0x2004fffc\)”
    ^done,value=”0xc44cdbf”
    -exec-continue
    ^running
    *running,thread-id=”all”
    ~”Note: automatically using hardware breakpoints for read-only addresses.\n”
    =breakpoint-modified,bkpt={number=”1″,type=”breakpoint”,disp=”keep”,enabled=”y”,addr=”0x08006ad0″,func=”main()”,file=”Main.cpp”,fullname=”C:\\Users\\Alex\\Documents\\Business\\Gaiatek\\SilentSentinel\\Stabilisation\\VisualStudio\\CameraStabilisation_002_Recovered\\CameraStabilisation_002\\Main.cpp”,line=”1139″,thread-groups=[“i1″],times=”1″,original-location=”main”}
    ~”\n”
    ~”Breakpoint 1, main () at Main.cpp:1139\n”
    ~”1139\t HAL_Init();\n”
    *stopped,reason=”breakpoint-hit”,disp=”keep”,bkptno=”1″,frame={addr=”0x08006ad0″,func=”main”,args=[],file=”Main.cpp”,fullname=”C:\\Users\\Alex\\Documents\\Business\\Gaiatek\\SilentSentinel\\Stabilisation\\VisualStudio\\CameraStabilisation_002_Recovered\\CameraStabilisation_002\\Main.cpp”,line=”1139″},thread-id=”1″,stopped-threads=”all”
    -break-delete 1
    ^done
    -exec-continue
    ^running
    *running,thread-id=”all”
    ~”\nProgram”
    ~” received signal SIGINT, Interrupt.\n”
    ~”0x08006682 in GetXsensMessage (inEvent=GET_MESSAGE_REQUEST, XsensData_EulerAngles=0x200087af <XsensData_EulerAnglesArray+375>) at Main.cpp:695\n”
    ~”695\t if (__HAL_UART_GET_FLAG(&Usart2Handle, UART_FLAG_RXNE))\n”
    *stopped,reason=”signal-received”,signal-name=”SIGINT”,signal-meaning=”Interrupt”,frame={addr=”0x08006682″,func=”GetXsensMessage”,args=[{name=”inEvent”,value=”GET_MESSAGE_REQUEST”},{name=”XsensData_EulerAngles”,value=”0x200087af <XsensData_EulerAnglesArray+375>”}],file=”Main.cpp”,fullname=”C:\\Users\\Alex\\Documents\\Business\\Gaiatek\\SilentSentinel\\Stabilisation\\VisualStudio\\CameraStabilisation_002_Recovered\\CameraStabilisation_002\\Main.cpp”,line=”695″},thread-id=”1″,stopped-threads=”all”
    -break-insert -f C:/Users/Alex/Documents/Business/Gaiatek/SilentSentinel/Stabilisation/VisualStudio/CameraStabilisation_002_Recovered/CameraStabilisation_002/Main.cpp:399
    ^done,bkpt={number=”2″,type=”breakpoint”,disp=”keep”,enabled=”y”,addr=”0x080062da”,func=”Axis::ProcessGyroSensorAxisData(float)”,file=”Main.cpp”,fullname=”C:\\Users\\Alex\\Documents\\Business\\Gaiatek\\SilentSentinel\\Stabilisation\\VisualStudio\\CameraStabilisation_002_Recovered\\CameraStabilisation_002\\Main.cpp”,line=”399″,thread-groups=[“i1″],times=”0″,original-location=”C:/Users/Alex/Documents/Business/Gaiatek/SilentSentinel/Stabilisation/VisualStudio/CameraStabilisation_002_Recovered/CameraStabilisation_002/Main.cpp:399″}
    -break-after 2 0
    ^done
    info symbol 0x80062da
    &”info symbol 0x80062da\n”
    ~”_ZN4Axis25ProcessGyroSensorAxisDataEf + 1404 in section .text\n”
    ^done
    info line *0x80062da
    &”info line *0x80062da\n”
    ~”Line 399 of \”Main.cpp\” starts at address 0x80062da <Axis::ProcessGyroSensorAxisData(float)+1404> and ends at 0x8006304 <Axis::ProcessGyroSensorAxisData(float)+1446>.\n”
    ^done
    x/4xb 0x8006682
    &”x/4xb 0x8006682\n”
    ~”0x8006682 <GetXsensMessage(Enum_GetXsensMessage_Events, Struct_XsensMessage_EulerAngles*)+62>:\t0x1b\t0x68\t0xdb\t0x69\n”
    ^done
    -exec-continue
    ^running
    *running,thread-id=”all”

     

    <?xml version=”1.0″?>
    <EmbeddedProfile xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance&#8221; xmlns:xsd=”http://www.w3.org/2001/XMLSchema”&gt;
    <ToolchainID>com.visualgdb.arm-eabi</ToolchainID>
    <BspID>com.sysprogs.arm.stm32</BspID>
    <BspVersion>4.2</BspVersion>
    <McuID>STM32F746ZG</McuID>
    <MCUDefinitionFile>STM32F7xxxx/DeviceDefinitions/stm32f746xx.xml</MCUDefinitionFile>
    <MCUProperties>
    <Entries>
    <KeyValue>
    <Key>com.sysprogs.bspoptions.primary_memory</Key>
    <Value>flash</Value>
    </KeyValue>
    <KeyValue>
    <Key>com.sysprogs.bspoptions.arm.floatmode</Key>
    <Value>-mfloat-abi=hard</Value>
    </KeyValue>
    <KeyValue>
    <Key>com.sysprogs.toolchainoptions.arm.libctype</Key>
    <Value>–specs=nano.specs</Value>
    </KeyValue>
    <KeyValue>
    <Key>com.sysprogs.toolchainoptions.arm.libnosys</Key>
    <Value>–specs=nosys.specs</Value>
    </KeyValue>
    </Entries>
    </MCUProperties>
    <BSPSourceFolderName>Device-specific files</BSPSourceFolderName>
    <MCUMakFile>stm32.mak</MCUMakFile>
    <ReferencedFrameworks>
    <string>com.sysprogs.arm.stm32.hal</string>
    <string>com.sysprogs.arm.fixed_stack_and_heap</string>
    <string>com.sysprogs.embedded.semihosting_and_profiler</string>
    </ReferencedFrameworks>
    <FrameworkProperties>
    <Entries>
    <KeyValue>
    <Key>com.sysprogs.efp.semihosting.buffer_size</Key>
    <Value>32768</Value>
    </KeyValue>
    <KeyValue>
    <Key>com.sysprogs.efp.semihosting.stdio</Key>
    <Value>1</Value>
    </KeyValue>
    <KeyValue>
    <Key>com.sysprogs.efp.semihosting.blocking_mode</Key>
    <Value>0</Value>
    </KeyValue>
    <KeyValue>
    <Key>com.sysprogs.efp.profiling.semihosting_driver</Key>
    <Value>1</Value>
    </KeyValue>
    <KeyValue>
    <Key>com.sysprogs.efp.profiling.counter</Key>
    <Value />
    </KeyValue>
    <KeyValue>
    <Key>com.sysprogs.efp.profiling.nosampling</Key>
    <Value>0</Value>
    </KeyValue>
    <KeyValue>
    <Key>com.sysprogs.bspoptions.stackheap.stacksize</Key>
    <Value>4096</Value>
    </KeyValue>
    <KeyValue>
    <Key>com.sysprogs.bspoptions.stackheap.heapsize</Key>
    <Value>8192</Value>
    </KeyValue>
    </Entries>
    </FrameworkProperties>
    <TestFrameworkProperties>
    <Entries />
    </TestFrameworkProperties>
    </EmbeddedProfile>

     

     

    #11654
    adchester
    Participant

    The following error appears in the project build log when the “Fixed-size stack and heap” option is removed from the project. And, as mentioned, this error does not go away again once the “Fixed-size stack and heap” option is re-selected. I stress again though that my main concern is the breakpoints not working.

     

    1>attempt to open VisualGDB/Debug/stm32f7xx_hal_wwdg.o succeeded
    1>c:/sysgcc/arm-eabi/bin/../lib/gcc/arm-eabi/6.2.0/../../../../arm-eabi/bin/ld.exe: cannot find -l$$com.sysprogs.toolchainoptions.arm.compactcpp$$
    1>collect2.exe : error : ld returned 1 exit status
    1>VisualGDB/Debug/stm32f7xx_hal_wwdg.o

    #11656
    support
    Keymaster

    Hi,

    The breakpoint issue could be caused by your code reassigning JTAG pins as regular GPIO (or otherwise tampering with the on-chip debug unit). Please try pinpointing the exact place in your program flow after which the breakpoints stop working.

    The link error looks like it’s caused by switching the toolchain to a different version. Please try checking/unchecking the “reduce size of C++ binaries” checkbox on the first page of VisualGDB Project Properties. This should regenerate the necessary settings and fix the problem.

    #11664
    adchester
    Participant

    Thanks for the advice for the link error. That did work to remove the error.

    However the problem with the breakpoints remains and is a serious issue for me as I cannot effectively develop the firmware without this working.

    The project is based on an ST example for stepper driver hardware on the nucleo boards. All the hardware pin configuration has been done via the STM32CubeMX utility to ensure that hardware conflicts do not occur so I do not think this could be the issue.

    The breakpoints do not stop working after some point in the program flow because they always work at the global level. So I can set a breakpoint in the main.cpp while(1) loop and it will always be hit. So for example I have a switch in the main loop and I can set a breakpoint on the switch statement and step into each case statement. What I cant do is set a breakpoint in one of the case statements because although the embedded program seems to break, the UI program does not (it behaves as if the embedded program is still running).

     

     

     

    #11666
    adchester
    Participant

    Update

    Breakpoints do work sometimes if I set them up before running rather than create a breakpoint during running. However they still seem to fail about 70% of the time so debugging is difficult and slow and not being able to create breakpoints during run time is also quite limiting. So I am still in need of a solution to this issue.

    #11673
    support
    Keymaster

    Hi,

    This could be caused by optimization. Please enure you have the “-O0” flag in the project settings.

    You can diagnose this by injecting asm(“nop”) statements in the code and trying to set breakpoints there.

    If your board is controlling a motor, it could make the power supply unstable and cause weird behavior like the one you are describing. Please try disconnecting the actual motor and see if the problem still occurs. If not, you would need to modify your board schematic to stabilize the power.

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.