This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

RM48 malloc fails using LwIP 1.4.1

Other Parts Discussed in Thread: RM48L952, HALCOGEN, TMS570LS3137

Hi,

I'm working with the RM48L952 HDK using the lwIP Stack for TCP/IP communication. CCS 5.4 using Halcogen 3.05.02 and compiler TI v5.0.4.

The malloc function fails for unaccountable reasons. Malloc is used to allocate my temporary used buffers in a structure.

I have enlarged the heap by adding -heap=0x8000 to the linker command file.

The strange behaviour is, that malloc works well for the first time, but fails the second time I'm using it in the code. The third time is again working well and so on.

Please give me an update.

Is it possible that this is an address alignment issue using little endian, because running the same code on TMS570LS3137 works fine?

Thanks and regards

Matthias

 

Example code: green marked malloc works, red fails.

conn_state *cs = NULL;

cs = (typeof(cs))malloc(sizeof(cs));

if (cs == NULL) return ERR_MEM;

/* Initializes the helper structure */

cs->data = NULL;

//cs->data is defined as uint8 *data;

/* Create buffer to hold the data to transmit */

cs->data = (typeof(cs->data))malloc(1500);

if (cs->data == NULL) return ERR_MEM;

cs->elements = (byte + 1);