malloc() fails on XDP512 (HCS12x)

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

malloc() fails on XDP512 (HCS12x)

1,210件の閲覧回数
VigneshGanesan
Contributor I
We're have an issue with the malloc() command on the MC9S12XDP512 controller (SK-S12XDP512-A EVB) with CodeWarrior for HCS12x v5.7.0. malloc() doesn't seem to work. It doesn't produce any complier or linker warnings. BUT the return pointer points to an address in the EEPROM (the returned pointer value was 0x824). Stepping through the code, we see that the heap_end starts at 0xc000 (flash memory). None of this seems right, but we can't find out how to fix the issue -- possibly some variable somewhere needs to get the right initial value of the memory space or something like that.

We've tried this out with a dummy program with just a main() and malloc() and it still doesn't work -- that is, its not a stack overflow or something running out of memory.

Any help would be greatly appreciated !

Best,
Vignesh.
ラベル(1)
0 件の賞賛
1 返信

412件の閲覧回数
pappan
Contributor I
Hi Vignesh,
 

Please check the Project settings and ensure that you selected ANSI C start up, think you are currently using minimal startup code settings.

If you are application requires less than 2000 bytes of heap then you can open the Freescale\CW for HC12 V4.5\lib\hc12c\hc12_lib.mcp project and select the type of .lib u need to compile. Open the stdlib.c and from includes open the libdefs.h header file and change the #define LIBDEF_HEAPSIZE 2000 to required size in order to save the RAM.Compile the lib project and include the new .lib file for your porject.

Have a nice time.

Please feel free to revert for any further clarification in this regard

With Best Regards

Padmakumar

0 件の賞賛