Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
14 years ago

About exceptions: Is try, catch and thow supported?

I would like to use try-catch statements, but it does not seems to work for me. I work with Quartus II 11.0sp1 and nios II (the fpga includes a vic).

When I debug what happens in my throw statement it seems as if I get another exception during the call of "_Unwind_RaiseException" in _cxxabiv1::__cxa_throw in the gnu file eh_throw.cc.

My code setup is very simple: static int catched = 0; try { throw 20; } catch (...) { catched++; } Any one have a hint for me?

15 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi Jeffry,

    Thanks for the code, though I have a question:

    What am I suppose to do with the new packages?

    I downloaded the rtems.h file and the nios2 gcc. I unpacked the nios2 gcc package, but there wasn't any manual or help document in it, and I already have a NiosII EDS installed on my computer. Is there any tutorial that I can use to make this package work?

    I guess I have to make my NiosII EDS use this compiler insted of the one under the original Altera installation. Can you refer my to any document that has a description how to do that? I haven't tried to hack my EDS installation before.

    Thanks for your help again.

    Tibor
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    There is some info on the wiki about building gcc from the Altera tarballs.

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    gytibor:

    I obtained the source code so I could build a nios2 cross compiler which specifically targets RTEMS RT OS. The rtems.h is used by the cross compiler build to configure stack unwinding and other properties of the cross compiler specifically for RTEMS.

    The link below has some of the details, and you might also search for "building configuring cross gcc" on google.

    http://www.alterawiki.com/wiki/crossgcc
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi Jeffrey,

    I've just realized that the RTEMS is a RTOS. Unfortunately, I'm tied to the MicroC OS-II, so I cannot just switch to a new RTOS.

    Thank you very much for your help. I really appreciated it.

    Tibor