I start to use freeRTOS. But i have some problem. when i announce more variable,Compiler is build failed.
it show message
"…\…\Source\croutine.o: Link Error: Could not allocate section .ndata, size = 2 bytes, attributes = data near
Link Error: Could not allocate data memory
Release build of project `C:\FreeRTOS\Demo\PIC24_MPLAB_Edit\RTOSDemo_PIC24.mcp’
failed.
Wed Oct 07 15:04:38 2009
Hej,
as the linker said -> Could not allocate data in section -> NDATA.
You are running out of RAM. This ram is being static declared in your source code. e.g.
unsigned char buffer;
This statement will allocate 512 bytes of memory.
So you need to reduce the memory usage of freeRTOS. See in FreeRTOSconfig.h for the parameters.
Also have a look in MPLAB at View -> Memory Usage Gauge to have an overview of you consumed ram.
Look at the configTOTAL_HEAP_SIZE parameter in FreeRTOSConfig.h. It allocates a huge array that is used as the heap. Lowing it will reduce the RAM consumption.
First i look to Memory Usage Gauge,When i do not add variable. it show that have free memory about 2042 byte.
But When i add more variable,i build Failed.
Second i try to reduce configTOTAL_HEAP_SIZE from 5120 to 4864 byte. but it do not work too.
Note that it said you were out of "near" memory. Pic24s have if I remember right 2k of "near" ram and the rest is "far" ram. You may need to change your memory model or explicitly declare some buffer to be put into "far" memory.
Other Question. When i announce configTOTALHEAPSIZE 4864 byte, But memory useage gauge is show that it use data memory same as announce 5120 byte. Why?