Make the _unhandled_exception function "weak".

This forum is dedicated to feedback, discussions about ongoing or future developments, ideas and suggestions regarding the ChibiOS projects are welcome. This forum is NOT for support.
rew
Posts: 380
Joined: Sat Jul 19, 2014 12:59 pm
Has thanked: 2 times
Been thanked: 13 times

Make the _unhandled_exception function "weak".

Postby rew » Wed Sep 23, 2020 7:55 am

I've been struggling with debugging exceptions for quite a while now.

One of the things that I hate to do is to modify a library-type of code. That creates an upgrade nightmare: Either future patches no longer apply or I start over and end up with the library without the patches if I simply install the new version. Read "chibios" for library in this paragraph.

So I want to override the chibios _unhandled_exception function to help me in debugging my application. That can be achieved by declaring the function "weak" in vectors.c, so that I can add an _unhandled_exception function of my own desire to my main source.

So now it becomes possible to easily implement Franks suggestion: https://blog.frankvh.com/2011/12/07/cor ... t-handler/

My request is to add this to chibios.

I also found a definition for _unhandled_exception in vectors.S but that seems to be unused. Maybe clean it up?

Code: Select all

diff --git a/os/common/startup/ARMCMx/compilers/GCC/vectors.c b/os/common/startup/ARMCMx/compilers/GCC/vectors.c
index e7b0fe30e..713a11c09 100644
--- a/os/common/startup/ARMCMx/compilers/GCC/vectors.c
+++ b/os/common/startup/ARMCMx/compilers/GCC/vectors.c
@@ -43,7 +43,7 @@
  * @notapi
  */
 /*lint -save -e9075 [8.4] All symbols are invoked from asm context.*/
-void _unhandled_exception(void) {
+void __attribute__((weak)) _unhandled_exception(void) {^M
 /*lint -restore*/
 
   while (true) {


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

Re: Make the _unhandled_exception function "weak".

Postby Giovanni » Sun Oct 11, 2020 10:49 am

Hi,

We don't have a vectors.c file anymore, it was present in 17.6 and that is long time unmaintained.

Giovanni


Return to “Development and Feedback”

Who is online

Users browsing this forum: No registered users and 18 guests