NewlibNano does not support (throw/try/catch), it just aborts.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

NewlibNano does not support (throw/try/catch), it just aborts.

506 Views
rshipman
Contributor V

Hi,

It appears that NewlibNano does not support exceptions (throw/try/catch).

I have compiled with -fexceptions and linked with NewlibNano. A call to throw will abort the program, any catch() is ignored.

Linking with Newlib does the right thing (i.e. it observes the catch blocks etc).

The libraries we use call throw, so we cannot avoid exceptions.

Using a simple C++ project in McuXpresso, linking to Newlib seems to add at least 130kbytes to the .text footprint. This is not insignificant.

So is there a better way to handle exceptions and still use NewlibNano? For example, does NewlibNano allow us to provide our own try/catch/throw handlers, or hooks of some sort that allow us to avoid the abort?

Many thanks.

Ronnie

 

Labels (1)
0 Kudos
1 Reply

487 Views
gusarambula
NXP TechSupport
NXP TechSupport

Hello Ronnie,

The following thread talks a bit about this matter, I would recommend fiving it a look. I hope that it will help.

https://community.nxp.com/t5/MCUXpresso-General/How-to-add-exception-support-to-newlib-nano/m-p/1083...

Regards,
Gustavo

0 Kudos