Forum: ARM programming with GCC/GNU tools Debugging with "Black Magic Probe"

von Pier T. (Company: P. Tilma Hardware/Software Eng) (kvklaasthomas)

Rate this post
not useful
Anjum, 27-07-2021

Hello everybody,

My situation :
- Platform : Linux Ubuntu 20.04.2 LTS
- Target hardware : STM32F303xD microcontroller based
- Black Magic Probe (firmware 1.7.1, hardware version 3)

What did I do :
- Compiled a minimal program with GCC/GNU
- Start gdb (arm-none-eabi-gdb)
- In gdb I entered the following commands :
- target extended-remote /dev/ttyACM0 (working !)
- monitor swdp_scan (working !)
- attach 1 (working !)
- file CONV002-CAN-USB.elf (working !)
- load (working !)
- start

Now I get back the following :
Temporary breakpoint 1 at 0x8001336: file main.c, line 113.
Note: automatically using hardware breakpoints for read-only addresses.
Starting program: 
Program received signal SIGSEGV, Segmentation fault.
0x00000000 in ?? ()

So the problem is :
Why do I get a segmentation fault ?

Regards from Pier Tilma

von Uwe Bonnes (Guest)

Rate this post
not useful
A SIGSEGV is a problem in your program. That is not the fault of the 
debugger. When the program has crashed, you should be back at the gdb 
command prompt. In many case "bt" (for backtrace) will give you a 
backtrace of functions involved in the crash. It helps, if the program 
was compiled with debug symbols enabled (-Og -g).

If you be chance ran with BMP git head "BMP hosted v1.7.1-232", update 
to 233 as 232 had random flash problems. After "load" "compare-section" 
will reread the flash and compare to the elf file and report errors.

von Pier Tilma (Guest)

Rate this post
not useful

You were right. The problem was not in the debugger.

In the linker script I found that the RAM size was
set to 80kb. But that should have been 64kb.

After I made that change everything was running fine.

Thank you.

Regards from
Pier Tilma Netherlands


Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]

Bild automatisch verkleinern, falls nötig