heinbali01 wrote on Thursday, March 12, 2015:
Which heap_x.c are you using?
You will find this declaration in versions 1, 2 and 4:
static uint8_t ucHeap[ configTOTAL_HEAP_SIZE ];
That is the heap space.
You can make this
configTOTAL_HEAP_SIZE as big as you want, the linker will issue an error when you’re running out of RAM.
Another possibility is to use heap_5.c. Right after starting-up, and before the first call to pvPortMalloc(), you will have to call:
void vPortDefineHeapRegions( const HeapRegion_t * const pxHeapRegions );
to add the heap regions. Depending on the compiler used, you can calculate the amount of RAM memory dynamically.
Note that, depending on the compiler you’re using, some standard functions may still call the the malloc/free couple.
Often I declare these functions, making sure that they have a C-linking (and not a C++ linking):
extern void non_existent_function( void );
void *malloc( size_t size )
( void ) size;
void free( void *pvMemory )
( void ) pvMemory;
Now if I call e.g. gmtime(), there will be a linking error because
non_existent_function could not be found.