malloc for a pointer.

Hello, I am debugging an application who run on FreeRTOS ported on ADuC7026, using Heap_2 as memory management.(Using KEIL Debugger) I allocate memory for a pointer: uint8 *mem_to_send = PanicNull(prvPortMalloc(sizeof(uint8))); So the allocated memory will be on the Heap. My Problem is that the debugger signalize a Address violation error: *** error 65: access violation at 0x00000000 : no ‘write’ permission when he execute the instruction : mem_to_send[0]=0xC0; so that it seam like my pointer is not initialized Please can you explain me what is going on ? Generally, how to allocate memory to someting other than a task. Best regards; Emeric

malloc for a pointer.

I presume PanicNull() will tell you if the pointer is NULL. Check that portBYTE_ALIGNMENT is set correctly in your port (ADu is not official port?). You say you are allocating memory for a pointer, but use sizeof( uint8), which is presumably 8bits.  Most likely a pointer is 32bits.  Should this be (uint8*).

malloc for a pointer.

portBYTE_ALIGNMENT is set to 4. I thing this is normal. You are wrigth, i have to use (uint8*). I ported Aduc using LPC2106 as starting point. The only thing i have changed are the timers and interrupt service routine which are specific to ADUC. I don´t really know where my problem com from. Any ideas? best regards