[riot-devel] Hardfault when linking OpenThread library

Daniel Krebs mail at daniel-krebs.net
Fri Jun 17 15:21:21 CEST 2016


Hi Jose,

the cause of the HardFault can still be your port. You need to check
your static initializers, i.e. constructors of the classes you
initialize in global storage. Those will be executed before main() is
called. Pay attention: the order in which those constructors are called
is undefined.

Depending on your architecture the cause can be something not so obvious
like unaligned memory access, so e.g. check dereferencing pointers.

Cheers,
Daniel

Am 17.06.2016 um 13:51 schrieb Jose Alamos:
> Hi community,
> 
> I'm having a weird hardfault when I'm linking the OpenThread library to
> RIOT. After running GDB, I noticed the hardfault is before accessing
> main() function (so shouldn't be a problem of the port itself).
> 
> RIOT is crashing in this line [1]. Here's the content of hardfault:
> 
> 2016-06-17 13:40:42,716 - INFO # Context before hardfault:
> 2016-06-17 13:40:42,718 - INFO #    r0: 0x00000000
> 2016-06-17 13:40:42,719 - INFO #    r1: 0x00000655
> 2016-06-17 13:40:42,721 - INFO #    r2: 0x00000000
> 2016-06-17 13:40:42,722 - INFO #    r3: 0x000058c4
> 2016-06-17 13:40:42,724 - INFO #   r12: 0x00000000
> 2016-06-17 13:40:42,726 - INFO #    lr: 0x00021ea7
> 2016-06-17 13:40:42,727 - INFO #    pc: 0x000058c4
> 2016-06-17 13:40:42,729 - INFO #   psr: 0x40000000
> 2016-06-17 13:40:42,729 - INFO # 
> 2016-06-17 13:40:42,729 - INFO # Misc
> 2016-06-17 13:40:42,731 - INFO # EXC_RET: 0xfffffff9
> 2016-06-17 13:40:42,735 - INFO # Attempting to reconstruct state for
> debugging...
> 2016-06-17 13:40:42,736 - INFO # In GDB:
> 2016-06-17 13:40:42,737 - INFO #   set $pc=0x58c4
> 2016-06-17 13:40:42,738 - INFO #   frame 0
> 2016-06-17 13:40:42,739 - INFO #   bt
> 
> 
> The OpenThread library is in C++, I programmed the hooks in C and C++
> but I get the same hardfault.
> 
> Any clue?
> Cheers
> 
> [1]: https://github.com/RIOT-OS/RIOT/blob/b5497c3be43bdfecb0fb10e84bffbbd76d7a1ca1/cpu/cortexm_common/vectors_cortexm.c#L113
> 
> 
> _______________________________________________
> devel mailing list
> devel at riot-os.org
> https://lists.riot-os.org/mailman/listinfo/devel
> 


More information about the devel mailing list