Nucleo F767ZI - linker script and breakpoints Topic is solved

Report here problems in any of ChibiOS components. This forum is NOT for support.
Post Reply
crispus
Posts: 24
Joined: Sat Aug 27, 2016 10:14 am
Has thanked: 4 times
Been thanked: 3 times

Nucleo F767ZI - linker script and breakpoints

Post 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
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Nucleo F767ZI - linker script and breakpoints

Post by Giovanni »

Hi,

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

Giovanni
bitto
Posts: 16
Joined: Thu Jan 30, 2014 9:45 am

Re: Nucleo F767ZI - linker script and breakpoints

Post 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
bitto
Posts: 16
Joined: Thu Jan 30, 2014 9:45 am

Re: Nucleo F767ZI - linker script and breakpoints

Post 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
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Nucleo F767ZI - linker script and breakpoints

Post 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
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Nucleo F767ZI - linker script and breakpoints

Post 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
mikeprotts
Posts: 166
Joined: Wed Jan 09, 2019 12:37 pm
Has thanked: 19 times
Been thanked: 31 times

Re: Nucleo F767ZI - linker script and breakpoints

Post by mikeprotts »

The quick circumvent is to use hb rather than b to set the breakpoints.

Mike
bitto
Posts: 16
Joined: Thu Jan 30, 2014 9:45 am

Re: Nucleo F767ZI - linker script and breakpoints

Post 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
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Nucleo F767ZI - linker script and breakpoints

Post by Giovanni »

Hi,

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

Giovanni
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Nucleo F767ZI - linker script and breakpoints

Post by Giovanni »

Closing....
Post Reply