Issue with C++ exception handling with 4.6.2 release on PSIM BSP
Joel Sherrill <joel@OARcorp.com>
joel.sherrill at OARcorp.com
Mon Jan 10 14:49:52 UTC 2005
Karel Gardas wrote:
> Hello,
>
> after non-success with ARM/RTEMS, I'm trying to get C++ working for
> PowerPC/RTEMS. Unfortunatelly it seems something is broken with exception
> handling. I've slightly modified hello_world_c to:
Everything has to be "just so" for exceptions to work. It requires
some magic in the bsp_specs and linkcmds.
psim has had a lot of work since 4.6.2 and C++ exceptions should work
now on the 4.6 branch. It was converted from the old to the new
exception model as part of fixing some outstanding issues like this
one.
If you REALLY want C++ exceptions with psim, then I suggestion you
get the diff post 4.6.2 on the 4.6 branch from CVS.
--joel
>
> /*
> * Simple test program -- simplified version of sample test hello.
> */
>
> #include <bsp.h>
>
> #include <stdlib.h>
> #include <stdio.h>
> #include <stdlib.h>
>
> rtems_task Init(
> rtems_task_argument ignored
> )
> {
> printf( "\n\n*** HELLO WORLD TEST ***\n" );
> try {
> throw 1;
> }
> catch (...) {
> printf("1 caught!\n");
> }
> printf( "Hello World\n" );
> printf( "*** END OF HELLO WORLD TEST ***\n" );
> exit( 0 );
> }
>
> /* configuration information */
>
> #define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
>
> #define CONFIGURE_RTEMS_INIT_TASKS_TABLE
>
> #define CONFIGURE_MAXIMUM_TASKS 1
>
> #define CONFIGURE_INIT
>
> #include <confdefs.h>
>
> /* end of file */
>
>
> also I've added make-cxx-exe rule into the PSIM's custom makefile.
> Building this example looks:
>
> /mnt/karel/downloads/RTEMS/build/tools/examples-4.6.2/hello_world_cxx_without_libstdcxx$
> make
> test -d o-optimize || mkdir o-optimize
> powerpc-rtems-g++ -B/mnt/karel/rtems-ppc//powerpc-rtems/psim/lib/ -specs
> bsp_specs -qrtems -g -Wall -g -mcpu=603e -D_OLD_EXCEPTIONS
> -Dppc603e -c -o o-optimize/test.o test.cc
> powerpc-rtems-g++ -B/mnt/karel/rtems-ppc//powerpc-rtems/psim/lib/ -specs
> bsp_specs -qrtems -g -Wall -g -mcpu=603e -D_OLD_EXCEPTIONS
> -Dppc603e -o o-optimize/hello.exe o-optimize/test.o
> /mnt/karel/rtems-ppc//powerpc-rtems/psim/lib/no-dpmem.rel
> /mnt/karel/rtems-ppc//powerpc-rtems/psim/lib/no-event.rel
> /mnt/karel/rtems-ppc//powerpc-rtems/psim/lib/no-msg.rel
> /mnt/karel/rtems-ppc//powerpc-rtems/psim/lib/no-mp.rel
> /mnt/karel/rtems-ppc//powerpc-rtems/psim/lib/no-part.rel
> /mnt/karel/rtems-ppc//powerpc-rtems/psim/lib/no-signal.rel
> /mnt/karel/rtems-ppc//powerpc-rtems/psim/lib/no-timer.rel
> /mnt/karel/rtems-ppc//powerpc-rtems/psim/lib/no-rtmon.rel
> powerpc-rtems-nm -g -n o-optimize/hello.exe > o-optimize/hello.num
> powerpc-rtems-size o-optimize/hello.exe
> text data bss dec hex filename
> 145144 22692 21421 189257 2e349 o-optimize/hello.exe
> /mnt/karel/downloads/RTEMS/build/tools/examples-4.6.2/hello_world_cxx_without_libstdcxx$
>
>
> and running looks:
>
> /mnt/karel/downloads/RTEMS/build/tools/examples-4.6.2/hello_world_cxx_without_libstdcxx$
> psim o-optimize/hello.exe
>
>
> *** HELLO WORLD TEST ***
> /mnt/karel/downloads/RTEMS/build/tools/examples-4.6.2/hello_world_cxx_without_libstdcxx$
>
>
> as you can see, exception is thrown, but never caught in catch block. FYI:
> Yes, I built rtems with `--enable-cxx'.
>
> Is there anybody here who is using C++ on RTEMS?
>
> Thanks,
> Karel
> --
> Karel Gardas kgardas at objectsecurity.com
> ObjectSecurity Ltd. http://www.objectsecurity.com
>
--
Joel Sherrill, Ph.D. Director of Research & Development
joel at OARcorp.com On-Line Applications Research
Ask me about RTEMS: a free RTOS Huntsville AL 35805
Support Available (256) 722-9985
More information about the users
mailing list