Page 1 of 1

Nucleo F767ZI - linker script and breakpoints  Topic is solved

Posted: Sun Jan 13, 2019 5:31 pm
by crispus
Hi,

I was complaining some time ago about H7 linker script
I have similar issue with F767ZIH. After loading the binary with the gdb:

Code: Select all

(gdb) load
Loading section .vectors, size 0x200 lma 0x8000000
Loading section .xtors, size 0x8 lma 0x8000200
Loading section .text, size 0x89e8 lma 0x8000210
Loading section .rodata, size 0xf88 lma 0x8008bf8
Loading section .data, size 0x60c lma 0x8009b80
Start address 0x2002e8, load size 41348
Transfer rate: 32 KB/sec, 5906 bytes/write.
(gdb) b main
Note: breakpoints 1, 2, 3 and 4 also set at pc 0x208112.
Breakpoint 5 at 0x208112: file main.cpp, line 24.
(gdb) c
Continuing.
Warning:
Cannot insert breakpoint 1.
Cannot access memory at address 0x208112
Command aborted.

Instead if I modify STM32F76xx.ld to use only flash0 it works just fine:

Code: Select all

(gdb) load
Loading section .vectors, size 0x200 lma 0x8000000
Loading section .xtors, size 0x8 lma 0x8000200
Loading section .text, size 0x89e8 lma 0x8000210
Loading section .rodata, size 0xf88 lma 0x8008bf8
Loading section .data, size 0x60c lma 0x8009b80
Start address 0x80002e8, load size 41348
Transfer rate: 33 KB/sec, 5906 bytes/write.
(gdb) b main
Breakpoint 1 at 0x8008112: file main.cpp, line 24.
(gdb) c
Continuing.
Note: automatically using hardware breakpoints for read-only addresses.

Breakpoint 1, main () at main.cpp:24
24          halInit();

Did I miss any build flag? a configuration?

Thank you

Re: Nucleo F767ZI - linker script and breakpoints

Posted: Sun Jan 13, 2019 9:02 pm
by Giovanni
Hi,

Note that in the 2nd case GDB is using HW breakpoints, enforce HW breakpoints everywhere.

Giovanni

Re: Nucleo F767ZI - linker script and breakpoints

Posted: Sat Aug 24, 2019 9:43 am
by bitto
Hello.
I'm facing the same problem with NUCLEO F767ZI and ChibiOS 191.
Can you please tell me how to modify the linker script in order to have HW breakpoints as default?

Thanks in advance.

Alberto

Re: Nucleo F767ZI - linker script and breakpoints

Posted: Sat Aug 24, 2019 9:55 am
by bitto
Maybe I found it myself: in every REGION_ALIAS line of STM32F76xxI.ld file replace "flash1" with "flash0".

Apparently it works, but is it correct?

Cheers

Alberto

Re: Nucleo F767ZI - linker script and breakpoints

Posted: Sat Aug 24, 2019 10:10 am
by Giovanni
Hi,

Changing the flash area may change the breakpoint behavior but it is like a side effect, you are going to create other problems in doing so, flash0 and flash1 have differences even if they represent the same flash. Apparently GDB assumes flash1 to be RAM and tries to set SW breakpoints there.

I think that memory regions should have extra attributes to tell GDB how to set BP on them. I need to look into this, currently memory areas have no attributes at all and this could be the root cause of the problem.

Depending on the debugger you are using there could be debugger-level settings/commands to enforce breakpoint types. I would look into GDB commands.

Moving this topic into "bug reports" so it is not lost.

Giovanni

Re: Nucleo F767ZI - linker script and breakpoints

Posted: Sat Aug 24, 2019 10:20 am
by Giovanni
This could be interesting:

http://openocd.org/doc/html/GDB-and-OpenOCD.html

To be checked if adding region attributes helps but OpenOCD can be enforced to use HW breakpoints according to documentation.

Giovanni

Re: Nucleo F767ZI - linker script and breakpoints

Posted: Sat Aug 24, 2019 4:14 pm
by mikeprotts
The quick circumvent is to use hb rather than b to set the breakpoints.

Mike

Re: Nucleo F767ZI - linker script and breakpoints

Posted: Tue Aug 27, 2019 8:16 am
by bitto
mikeprotts wrote:The quick circumvent is to use hb rather than b to set the breakpoints.


Thank you, Mike.
Is there any way to instruct Eclipse/gdb (I'm using Chibistudio) to do that?

Alberto

Re: Nucleo F767ZI - linker script and breakpoints

Posted: Wed Sep 18, 2019 8:22 am
by Giovanni
Hi,

I added rx/wx attributes to .ld files in trunk, does this fix the issue with breakpoint types?

Giovanni

Re: Nucleo F767ZI - linker script and breakpoints

Posted: Sat Oct 05, 2019 8:17 am
by Giovanni
Closing....