UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

AR# 23181

9.1i - Exception handling does not work

Description

I have a piece of code, as below, to demonstrate the exception handling:

int main (void) {

xil_printf("-- Entering (EDK) main() --\r\n");

try {

throw 1;

}

catch(...) {

xil_printf("OK -> (EDK) Exception!\r\n");

return 0;

}

xil_printf("-- Exiting (EDK) main() --\r\n");

return 0;

}

This is what I would expect:

----------------------------------------

Step (1) - Printing "-- Entering (EDK) main() -- "

Step (2) - Go to section 'CATCH'

Step (3) - Printing "OK -> (EDK) Exception!"

Step (4) - Exit the program

But, this is what I get:

--------------------------------

Step (1) - Printing "-- Entering (EDK) main( ) -- "

Step (2) - The program hangs on

Solution

Make sure you have enough Stack and Heap space. You can change the Stack and Heap size in the linker script.

Following is an example:

_STACK_SIZE = DEFINED(_STACK_SIZE) ? _STACK_SIZE : 0x5000;

_HEAP_SIZE = DEFINED(_HEAP_SIZE) ? _HEAP_SIZE : 0x5000;

AR# 23181
Date Created 09/04/2007
Last Updated 12/15/2012
Status Active
Type General Article