EmbDev.net

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
useful
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: 
/home/pier/codeBlocks/projects/CONV002-CAN-USB/101/bin/Debug/CONV002-CAN 
-USB.elf
Program received signal SIGSEGV, Segmentation fault.
0x00000000 in ?? ()

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

Regards from Pier Tilma
Netherlands

von Uwe Bonnes (Guest)


Rate this post
useful
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
useful
not useful
28-07-2021

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

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.