Unable to use debug mode

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderators: barthess, RoccoMarco

weyoui
Posts: 3
Joined: Sun Aug 24, 2014 1:19 pm

Unable to use debug mode

Postby weyoui » Sun Aug 24, 2014 1:36 pm

Hi guys,

I am a novice to use ChibiOS so I am asking some basic question.
My test environment is,

1. Host PC : Unbuntu 12.04LTS
2. Eclipse : Luna + ARM Plugin
3. Target board : STM32F4Discovery
4. OpenOCD : 0.8.0 (installed from OpenOCD homepage)
I followed these steps -> http://gnuarmeclipse.livius.net/blog/openocd-debugging/

After setting the test environment, I made the "ARMCM4-STM32F407-DISCOVERY" project.
Compiled successfully, I entered debug mode but following error message happen!

Code: Select all

Open On-Chip Debugger 0.8.0 (2014-08-24-13:05)
Licensed under GNU GPL v2
For bug reports, read
   http://openocd.sourceforge.net/doc/doxygen/bugs.html
srst_only separate srst_nogate srst_open_drain connect_deassert_srst
Info : This adapter doesn't support configurable speed
Info : STLINK v2 JTAG v14 API v2 SWIM v0 VID 0x0483 PID 0x3748
Info : using stlink api v2
Info : Target voltage: 2.903844
Info : stm32f4x.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : accepting 'gdb' connection from 3333
Info : device id = 0x10016413
Info : flash size = 1024kbytes
target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x080001d0 msp: 0x20000400
semihosting is enabled
target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x080001d0 msp: 0x20000400, semihosting
Info : Padding image section 0 with 4 bytes
target state: halted
target halted due to breakpoint, current mode: Thread
xPSR: 0x61000000 pc: 0x20000042 msp: 0x20000400, semihosting
target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x080001d0 msp: 0x20000400, semihosting
Error: gdb requested a non-existing register
Info : dropped 'gdb' connection


I tired to make File->New->C Project->Executable (STM32F4xx C/C++ Project).
This project works well without problem.

If you have any same experience, please let me know what is the solution.

User avatar
Giovanni
Site Admin
Posts: 10574
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 268 times
Been thanked: 231 times
Contact:

Re: Unable to use debug mode

Postby Giovanni » Sun Aug 24, 2014 1:44 pm

hi,

I never used that OpenOCD plugin nor semihosting. Try disabling semihosting, may be the problem is related to that.

Giovanni

weyoui
Posts: 3
Joined: Sun Aug 24, 2014 1:19 pm

Re: Unable to use debug mode

Postby weyoui » Mon Aug 25, 2014 12:52 pm

Thanks for quick reply. I did following your suggestion that disabling semihosting.
But the result was same. :(

As I mentioned at first post message.
It was successful to connect OpenOCD debug when I created the project in the eclipse's embedded project.
And I attached the result of this auto generated project like below.

Code: Select all

Open On-Chip Debugger 0.7.0 (2014-08-24-23:57)
Licensed under GNU GPL v2
For bug reports, read
   http://openocd.sourceforge.net/doc/doxygen/bugs.html
srst_only separate srst_nogate srst_open_drain connect_deassert_srst
Info : This adapter doesn't support configurable speed
Info : STLINK v2 JTAG v14 API v2 SWIM v0 VID 0x0483 PID 0x3748
Info : Target voltage: 2.889882
Info : stm32f4x.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : accepting 'gdb' connection from 3333
Info : device id = 0x10016413
Info : flash size = 1024kbytes
Warn : acknowledgment received, but no packet pending
undefined debug reason 6 - target needs reset
target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x080001d0 msp: 0x20000400
semihosting is enabled
Info : Padding image section 0 with 1 bytes
target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x08000294 msp: 0x20020000, semihosting

User avatar
Giovanni
Site Admin
Posts: 10574
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 268 times
Been thanked: 231 times
Contact:

Re: Unable to use debug mode

Postby Giovanni » Mon Aug 25, 2014 1:12 pm

I will look into that plugin in the weekend. Currently I use the GDB HW Debugger and it works perfectly, you just have to launch OpenOCD separately.

An example launcher is:

Code: Select all

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.cdt.debug.gdbjtag.launchConfigurationType">
<stringAttribute key="bad_container_name" value="\RT-STM32F303-DISCOVERY\debug"/>
<intAttribute key="org.eclipse.cdt.debug.gdbjtag.core.delay" value="1"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.doHalt" value="true"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.doReset" value="true"/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.imageFileName" value=""/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.imageOffset" value=""/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.initCommands" value="set remotetimeout 20&#13;&#10;monitor reset init&#13;&#10;monitor sleep 50&#13;&#10;"/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.ipAddress" value="localhost"/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.jtagDevice" value="Generic TCP/IP"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.loadImage" value="true"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.loadSymbols" value="true"/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.pcRegister" value=""/>
<intAttribute key="org.eclipse.cdt.debug.gdbjtag.core.portNumber" value="3333"/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.runCommands" value=""/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setPcRegister" value="false"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setResume" value="true"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setStopAt" value="true"/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.stopAt" value="main"/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.symbolsFileName" value=""/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.symbolsOffset" value=""/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.useFileForImage" value="false"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.useFileForSymbols" value="false"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.useProjBinaryForImage" value="true"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.useProjBinaryForSymbols" value="true"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.useRemoteTarget" value="true"/>
<stringAttribute key="org.eclipse.cdt.debug.mi.core.DEBUG_NAME" value="arm-none-eabi-gdb"/>
<stringAttribute key="org.eclipse.cdt.debug.mi.core.commandFactory" value="Standard"/>
<stringAttribute key="org.eclipse.cdt.debug.mi.core.protocol" value="mi"/>
<booleanAttribute key="org.eclipse.cdt.debug.mi.core.verboseMode" value="false"/>
<stringAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_NAME" value="arm-none-eabi-gdb"/>
<intAttribute key="org.eclipse.cdt.launch.ATTR_BUILD_BEFORE_LAUNCH_ATTR" value="2"/>
<stringAttribute key="org.eclipse.cdt.launch.COREFILE_PATH" value=""/>
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_REGISTER_GROUPS" value=""/>
<stringAttribute key="org.eclipse.cdt.launch.FORMAT" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&lt;contentList/&gt;"/>
<stringAttribute key="org.eclipse.cdt.launch.GLOBAL_VARIABLES" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;globalVariableList/&gt;&#13;&#10;"/>
<stringAttribute key="org.eclipse.cdt.launch.MEMORY_BLOCKS" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;memoryBlockExpressionList/&gt;&#13;&#10;"/>
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="./build/ch.elf"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="RT-STM32F303-DISCOVERY"/>
<booleanAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_AUTO_ATTR" value="true"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value="0.1984968159"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/RT-STM32F303-DISCOVERY"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
<listEntry value="org.eclipse.debug.ui.launchGroup.debug"/>
</listAttribute>
</launchConfiguration>


Just replace "RT-STM32F303-DISCOVERY" with your project name and put it as a xxxx.launch file in your project, it will show in the debug menu under the bug icon.

Giovanni

weyoui
Posts: 3
Joined: Sun Aug 24, 2014 1:19 pm

Re: Unable to use debug mode

Postby weyoui » Tue Aug 26, 2014 3:21 pm

Hi Giovanni,

Thanks, I applied your launcher file in my project file, then the problem was solved! :D
I used the GDB Hardware Debugging and OpenOCD as an external tool.

The one I want to comment is the startup option. This option would be very useful to everyone to use eclipse + openocd.

set remotetimeout 20
monitor reset init
monitor sleep 50


Thansk,
weyoui

User avatar
Giovanni
Site Admin
Posts: 10574
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 268 times
Been thanked: 231 times
Contact:

Re: Unable to use debug mode

Postby Giovanni » Tue Aug 26, 2014 3:41 pm

Glad it fixed it for you, I still want to make that OpenOCD plugin work, it looks very nice and wish to include it in ChibiStudio.

Giovanni

faisal
Posts: 63
Joined: Wed Jul 19, 2017 12:44 am
Has thanked: 10 times
Been thanked: 3 times

Re: Unable to use debug mode

Postby faisal » Tue Nov 28, 2017 9:26 pm

Sorry to resurrect this ancient thread, but is there any resolution to this? I am unable to use the MCU Eclipse OpenOCD plugin either. I also get a similar "non-existent register" error. I am able to run the openocd gdb server seperately, and connect to it successfully and debug.

Below is the tail end of the log:

Code: Select all

Debug: 2397 4918 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm32l4x.cpu curstate
Debug: 2398 4918 command.c:143 script_debug(): command - ocd_stm32l4x.cpu ocd_stm32l4x.cpu curstate
Debug: 2399 4918 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm32l4x.cpu invoke-event reset-end
Debug: 2400 4918 command.c:143 script_debug(): command - ocd_stm32l4x.cpu ocd_stm32l4x.cpu invoke-event reset-end
Debug: 2402 4920 gdb_server.c:2676 gdb_v_packet(): wrote 32528 bytes from vFlash image to flash
Debug: 2403 4920 gdb_server.c:2812 gdb_input_inner(): received packet: 'P8=a1010008'
Debug: 2404 4920 gdb_server.c:1298 gdb_set_register_packet(): -
Debug: 2405 4920 gdb_server.c:2812 gdb_input_inner(): received packet: 'P29=ffffffff'
Debug: 2406 4920 gdb_server.c:1298 gdb_set_register_packet(): -
Error: 2407 4920 gdb_server.c:1306 gdb_set_register_packet(): gdb requested a non-existing register
Debug: 2408 4920 gdb_server.c:1022 gdb_connection_closed(): GDB Close, Target: stm32l4x.cpu, state: halted, gdb_actual_connections=0
Debug: 2409 4920 target.c:1517 target_call_event_callbacks(): target event 6 (gdb-end)
Debug: 2410 4920 target.c:1517 target_call_event_callbacks(): target event 24 (gdb-detach)
Debug: 2411 4920 target.c:4313 target_handle_event(): target: (0) stm32l4x.cpu (hla_target) event: 24 (gdb-detach) action:  shutdown
Debug: 2412 4920 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_shutdown
Debug: 2413 4920 command.c:143 script_debug(): command - shutdown ocd_shutdown
User : 2415 4922 server.c:627 handle_shutdown_command(): shutdown command invoked
User : 2416 4922 command.c:544 command_print():

Info : 2417 4922 server.c:503 server_loop(): dropped 'gdb' connection
Debug: 2418 4922 hla_interface.c:117 hl_interface_quit(): hl_interface_quit


Below is my configuration:
Open On-Chip Debugger 0.10.0 (2017-10-19-17:28)
GNU MCU C/C++ OpenOCD Debugging 4.2.1.201711101735
Eclipse Neon.3 (4.6.3)

faisal
Posts: 63
Joined: Wed Jul 19, 2017 12:44 am
Has thanked: 10 times
Been thanked: 3 times

Re: Unable to use debug mode

Postby faisal » Wed Nov 29, 2017 1:49 am

I fixed the problem. Turns out MCU Eclipse was not setting the {gdb_prefix/postfix} paths properly. Instead, in the GDB Client setup, I put the full path to arm-none-eabi-gdb, and it worked. What was happening before was the system 'gdb' command was being run, which obviously is not for arm-none-eabi. Hope you can integrate it into ChibiStudio. Here are the MCU eclipse packages I have installed:

GNU MCU C/C++ CodeRed Debug Perspective 1.1.2.201711101735 ilg.gnumcueclipse.codered.feature.feature.group Liviu Ionescu
GNU MCU C/C++ Documentation (Placeholder) 1.1.2.201711101735 ilg.gnumcueclipse.doc.user.feature.feature.group Liviu Ionescu
GNU MCU C/C++ J-Link Debugging 4.2.1.201711101735 ilg.gnumcueclipse.debug.gdbjtag.jlink.feature.feature.group Liviu Ionescu
GNU MCU C/C++ OpenOCD Debugging 4.2.1.201711101735 ilg.gnumcueclipse.debug.gdbjtag.openocd.feature.feature.group Liviu Ionescu
GNU MCU C/C++ PyOCD Debugging 1.2.1.201711101735 ilg.gnumcueclipse.debug.gdbjtag.pyocd.feature.feature.group Liviu Ionescu


Return to “STM32 Support”

Who is online

Users browsing this forum: No registered users and 3 guests