Hi All, I have implemented a linked list in my program on infineon sle66c168PE. at very first time i intialize the starting node with the null value and whenever i need to add the node to the linked list the malloc function return me the value 0x0000 that is a null value.which causes the program to fail. can anyone please suggest me something to work-around this problem... its very urgent ...Plz Thanks and Regards, Ankit
Did you call init_mempool to setup the heap? Jon
yes i have used init_mempool to setup heap. i know its not feasable to use malloc in an embedded application but i know that my link list may contain 30 elements of 4 bytes each at max and i have enough RAM to accomodate all this. but the thing is even if i try to add the very first node still it returns null. this thing i could not understand and was thinking about this problem all night. Please suggest.... -Ankit
Is your heap large enough? Can you post a small example that can be compiled and that runs that shows the problem? Jon
yes i have used init_mempool to setup heap. i know its not feasable to use malloc in an embedded application but i know that my link list.. So now you know that it is also "not feasable to use" linked lists "in an embedded application" Set an array of pointer large enough to hold your max entries and take that darn PC hat off. Erik
" i know that my link list may contain 30 elements of 4 bytes each at max and i have enough RAM to accomodate all this." So don't mess about with malloc - define it all at compile time!
"So don't mess about with malloc - define it all at compile time!" Further explained here: http://www.eventhelix.com/RealtimeMantra/KeepItSimple.htm#Use Arrays