LEON2 and C++ exception handling

Mike Looijmans mike.looijmans at topic.nl
Fri Aug 11 11:43:01 UTC 2017


On 11-08-17 10:40, Sebastian Huber wrote:
> On 11/08/17 10:36, Mike Looijmans wrote:
> 
>> Now that we got RTEMS running from ROM on a LEON2, I'm running into the 
>> issue that C++ exceptions don't work. Any "throw" results in a fatal 
>> termination.
>>
>> A program that does something like:
>>
>> try {
>>   throw std::exception();
>> } catch (const std::exception& ex)
>>   puts(ex.what());
>> }
>>
>> results in a stack trace like this:
>>
>>
>>   #0   0xf9404fcc   0x4000c5a8
>>   #1   0x00079340   0x4000c608   <_CPU_Fatal_halt+0x8>
>>   #2   0x0005497c   0x4000c668   <_Terminate+0x48>
>>   #3   0x000535b8   0x4000c6d8   <rtems_fatal+0xc>
>>   #4   0x0004a970   0x4000c738   <bsp_spurious_handler+0xc>
>>   #5   0x00079588   0x4000c7a0
>>   #6   0x00048720   0x40017ab8 <classify_object_over_fdes+0xd0>
>>   #7   0x00048e78   0x40017bd0   <search_object+0x330>
>>   #8   0x0004965c   0x40017c48   <_Unwind_Find_FDE+0x10c>
>>   #9   0x00045f30   0x40017cb0   <uw_frame_state_for+0x3c>
>>   #10  0x0004739c   0x40017d18   <uw_init_context_1+0x28>
>>   #11  0x00047c44   0x400180f0 <_Unwind_RaiseException+0x10>
>>   #12  0x0000b478   0x40018918   <__cxa_throw+0x58>
>>
>>
>> Any tips on how to diagnose this? Or should I just give up on C++ exception 
>> with RTEMS? 
> 
> You must provide a window flush trap. Something is wrong with your trap table. 
> It works with the standard BSPs.
> 

I use the same trap table as the other leon2 BSPs. In start.S I find:

   TRAP( 0x83, SYM(window_flush_trap_handler) ); ! 83 flush windows SW trap

So it looks like it's there and provided by RTEMS.


Kind regards,

Mike Looijmans
System Expert

TOPIC Products
Materiaalweg 4, NL-5681 RJ Best
Postbus 440, NL-5680 AK Best
Telefoon: +31 (0) 499 33 69 79
E-mail: mike.looijmans at topicproducts.com
Website: www.topicproducts.com

Please consider the environment before printing this e-mail






More information about the users mailing list