Memory allocation

Maybe they are silly questions, but I’m beginner in programming microcontrollers.

Memory allocation is available in Wixel environment ?
Can I use malloc() and free() normally?
Is there anything I should know to use dynamic allocation?
Whereas Wixel has 32K of memory, pointers occupy 2 bytes? or 4 bytes?

thanks.

Hello. Yes, you can use malloc and free on a Wixel because they are supported by the compiler, SDCC. You would just need to include malloc.h.

Pointers to a specific memory region (e.g. “XDATA char *”) take only two bytes, while SDCC’s generic pointers (e.g. “char *”) take three bytes. All the memory regions of the CC2511F32 are available in the XDATA address space so I would avoid using generic pointers when possible.

For more information on both of these topics, I recommend reading the documentation of SDCC. It can be found at their website:

http://sdcc.sourceforge.net/

–David

thanks David, you helped a lot.