Hi All,
Please could someone help me regarding the "new" operator exception in C6000 compiler?
I am trying to handle exception thrown by the new operator as I normally do in C++ programs.
My platform is 674x, CCS v.4.2.1. In the project I have my exceptions enabled.
To catch the problem I wrote a program simple program:
--------------------------------------------
#include <stdio.h>
int main(void)
{
char* bufferPtr = 0;
try
{
bufferPtr = new char[1000];
}
catch (...)
{
printf("Allocation exception has been thrown\n");
}
printf("Hello World!\n");
delete[] bufferPtr;
return 0;
}
-------------------------------------------- end of program
And my linker.cmd file is:
/*****************************************************************************
* linker command file for C6748 test code.
*
* © Copyright 2009, Logic Product Development, Inc. All Rights Reserved.
******************************************************************************/
-l rts67plus_eh.lib
-stack 0x00001000
-heap 0x00000200
MEMORY
{
dsp_l2_ram: ORIGIN = 0x11800000 LENGTH = 0x00040000
shared_ram: ORIGIN = 0x80000000 LENGTH = 0x00020000
external_ram: ORIGIN = 0xC0000000 LENGTH = 0x08000000
}
SECTIONS
{
.text > external_ram
.const > external_ram
.bss > external_ram
.far > external_ram
.switch > external_ram
.stack > external_ram
.data > external_ram
.cinit > external_ram
.sysmem > external_ram
.cio > external_ram
.pinit > external_ram
}
-------------------------------------------- end of linker.cmd
The size of the heap is set to throw exception when the new operator is used.
When the program is run on the "6747 Device Cycle Accurate Simulator, Little Endian" then excecution of the "new" operator causes the program to jump immediatelly to "C$$EXIT, abort:" label and just bypasses my exception handling.
Is it a bug or is it intended to jump. If so how can I control this scenario of invalid memory allocation?
Kind regards
Radek