HardFault on chRescheduleAhead

Discussions and support about ChibiOS/RT, the free embedded RTOS.
User avatar
wurstnase
Posts: 121
Joined: Tue Oct 17, 2017 2:24 pm
Has thanked: 43 times
Been thanked: 30 times
Contact:

HardFault on chRescheduleAhead

Postby wurstnase » Thu Jan 23, 2020 10:15 am

Hi,

i've got a hardfault while testing my code.
Unfortunately this was a tool in normal use, where I'm not able to get the complete backtrace nor a debugger on it.

The only information I've had:
The SP was at 0x200003E0.
R0 at 0x0801EA4B which is chRescheduleAhead when I'm looking in the map file.

Any idea what could be the reason for this?
\o/ Nico

User avatar
Giovanni
Site Admin
Posts: 13008
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 742 times
Been thanked: 620 times
Contact:

Re: HardFault on chRescheduleAhead

Postby Giovanni » Thu Jan 23, 2020 10:51 am

It could be anything, are you able to run the code with debug options enabled?

I would look for a stack overflow or a state violation.

Giovanni

User avatar
wurstnase
Posts: 121
Joined: Tue Oct 17, 2017 2:24 pm
Has thanked: 43 times
Been thanked: 30 times
Contact:

Re: HardFault on chRescheduleAhead

Postby wurstnase » Thu Jan 23, 2020 11:28 am

Yes, I will try to check this with debug options again.
Unfortunately this occure only once for now, just after a reboot.

How much space should the main stack have? I can see it will go down to 100bytes free.
\o/ Nico

User avatar
Giovanni
Site Admin
Posts: 13008
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 742 times
Been thanked: 620 times
Contact:

Re: HardFault on chRescheduleAhead

Postby Giovanni » Thu Jan 23, 2020 11:33 am

Just enough, there is no need to keep "free" space.

You should also try to enable HW stack check, there is a port option for that, it is much more reliable than the normal SW check. If the application is critical I recommend keeping stack checking ON in release code.

You may also try to use chSysIntegrityCheckI() in your error handler for some on-field diagnostic.

Giovanni

User avatar
wurstnase
Posts: 121
Joined: Tue Oct 17, 2017 2:24 pm
Has thanked: 43 times
Been thanked: 30 times
Contact:

Re: HardFault on chRescheduleAhead

Postby wurstnase » Thu Jan 23, 2020 12:27 pm

Thanks for your advice.
I will check some options.
\o/ Nico


Return to “ChibiOS/RT”

Who is online

Users browsing this forum: No registered users and 2 guests