rust-embedded / discovery

Discover the world of microcontrollers through Rust!
https://docs.rust-embedded.org/discovery/
Apache License 2.0
1.48k stars 514 forks source link

07 Registers / Bad Address: Function "UserHardFault" not defined #155

Open XOSplicer opened 5 years ago

XOSplicer commented 5 years ago

Hi, thanks for the awesome work.

I found a minor bug in section 07 Registers / Bad Address When running the example with the following openocd.gdb config:

target remote :3333
set print asm-demangle on
set print pretty on
monitor tpiu config internal itm.txt uart off 8000000
monitor itm port 0 on
load
break DefaultHandler
break UserHardFault
break main
continue

gdb complains about not finding the UserHardFault function:

...
Function "UserHardFault" not defined.
...

When running continue, the program does not halt as expected in the hard fault handler, but hangs in a loop.

I looked into the cortex_m_rt crate which, does not expose the expected UserHardFault function, however it exposes HardFault.

Changing the openocd.gdb config to:

...
break HardFault
...

solved the problem and the program holds as expected on the breakpoint.

I hope you can improve this section. Keep up the great work!

Relevant versions: discovery book: bbd3f0 cortex-m-rt: 0.6.7

bahrozjaved commented 4 years ago

thnxxx for the suggestion