Odd new() exception - K22F KDS

キャンセル
次の結果を表示 
次の代わりに検索 
もしかして: 

Odd new() exception - K22F KDS

449件の閲覧回数
tharonhall
Contributor IV

I am getting a rather odd __cxa_throw() exception using operator new() using KDS and a K22F. I saw, odd, because it happens on only maybe the second invocation of new(), and there is PLENTY of room on the heap.

 

Using the representative code below:

 

class_ptr1 = new Class("Class 1");

class_ptr2 = new Class("Class 2");

 

class_ptr1 is assigned the address 0x20000020

 

When the attempt to allocate the second class fires, I get the __cxa_throw() exception. Of course, this would typically mean I am out of memory, but I have TONS of space left in the heap, unless i am reading this wrong somehow and the space is allocated top to bottom and not bottom to top:

 

.heap           0x20000000     0x8000

                0x20000000                . = ALIGN (0x8)

                0x20000000                __end__ = .

                0x20000000                PROVIDE (end, .)

                0x20000000                __HeapBase = .

                0x20008000                . = (. + HEAP_SIZE)

 

Anyone else seen this? This triggered after I changed my OSA from Bare Metal to FreeRTOS, so something funny may have happened there.

 

This has stopped me in my tracks, so any help GREATLY appreciated. Thanks!

ラベル(1)
0 件の賞賛
2 返答(返信)

274件の閲覧回数
tharonhall
Contributor IV

So it appears that FreeRTOS didn't pull back into the code as cleanly as I had hoped. I did some clean up and the trap went away. Know I am having other issues with FreeRTOS, which I did not see before. It makes me suspicious that some more things are not set up correctly.

Will look at a clean FreeRTOS build for reference and see if I can't find something that is amiss.

0 件の賞賛

274件の閲覧回数
Carlos_Mendoza
NXP Employee
NXP Employee

Hi Tharon,

Is good to hear that the problem with the __cxa_throw() exception was fixed, please let us know if you you run into any other problem.

Best Regards,

Carlos Mendoza

Technical Support Engineer

0 件の賞賛