Hot answers tagged

15

Thanks for the pointers, markt and chris-stratton. The semihosting option turned out to be quite straightforward. I managed to find the source for a couple of simple logging routines that can send messages to the OpenOCD console. I'll post them here since (i) they required some modification to work and (ii) I think this info is not super easy to find for ...


9

Finally I found the solution myself: Disable semihosting - it seems when the firmware is loaded via OpenOCD, MCU detects that semihosting interface is available and after disconnecting of the debugger the MCU hangs when it tries to write the semihosting interface. To make firmware running again it is necessary to replug the ST-link USB connector or leave ...


5

Indeed the documentation for this amazing feature is rather poor, however there is a guide for ChibiOS. Basically this boils down to: pass -rtos auto to {TARGET_NAME}.cpu configure in the Tcl configuration script use thread commands in gdb, where info threads is the probably the one you will use most


2

It seems that st-until has issue with setting watchpoints on STM32F4, even though it is supposed to be supported. As I previously noted, OpenOCD is an alternative and it looks like switching to it has resolved the issue for you.


2

Direct connection of NRST to 3.3V VCC is wrong. Disconnect it.


2

but I don't know what '\252' means. This is an octal value. It's equal to 2 + 5*8 + 2*8*8 = 170. Another example: '\123' is octal for 3 + 2*8 + 1*8*8 = 83. Next I changed the variable to a char instead of an unsigned char and ran the same print test_var, I got an output of $10 = -86 '\252' 170 is greater than 127, so when represented as a char (which is a ...


1

The Cortex-M7 processor has internal flag that identifies debugger accesses as either cacheable, or non-cacheable. Non-cacheable is the default, and it causes all requests to bypass the data cache. Openocd tries to set the flag in stm32h7x.cfg, but that only works for low-level access debuggers. ST-Link is a high-level debugger (you can check with monitor ...


1

My current approach as a global¹ and extandable² solution is declaring a NOOP and placing breakpoint at that line: 5: #define NOOP ({;}) ... 31: spiExchange(&SPID1, 2, txbuffer, rxbuffer); 32: NOOP; // put a breakpoint at this point 33: } ... (gdb) break main.c:32 The NOOP macro will be removed by optimization, so optimization shouln't be used ...


1

This can be achieved by something is called semihosting. How this is implemented depends on the specific devices and software you are using. It works by using an SVC and BKPT instructions to trigger an action from the debugger host.


1

I found a way to fix it. First I launched OpenOCD with some special flags: sudo openocd -f interface/stlink-v2.cfg -f target/stm32f0x.cfg -c init -c "reset halt" All while holding down reset for about half a second. Which causes it to connect in a halted state. Open On-Chip Debugger 0.9.0 (2016-07-31-11:32) Licensed under GNU GPL v2 For bug reports, read ...


1

You can reset the option bytes of a STM32 device to their factory settings with SEGGER's J-Link Unlock STM32 tool. It is included in some SDKs but you can download it here : https://www.segger.com/downloads/jlink You can also use J-Flash that is also included in J-Link to do a full erase. Check this link too, it might help.


1

I'm resetting the development board with the reset button Don't do that while OpenOCD is running. Use OpenOCDs reset halt or reset run commands instead. The reset button will affect the internal debugging state of the target but OpenOCD may not detect that correctly, depending which debugger you use and how it is wired up. Note that you should do reset ...


1

The fact that exchanging steps 3 and 4 doesn't work (doesn't break the program) suggests that operation 3 has the effect of clearing the hardware breakpoints, and that a "trivial" interaction between the debugger and the program has the effect of re-installing the breakpoints. If in your environment you don't have a way to load the program in a halted state,...


Only top voted, non community-wiki answers of a minimum length are eligible