FreeRTOS takes up all ROM and Program memory

Hello all, I’ve been messing around with FreeRTOS for the PIC32MX460512L and have successfully managed to create a project from scratch and create two tasks which blink some LEDs. However, checking the Memory Usage Gauge in MPLAB shows that my very simple system is taking up 131471 out of 134140 words of ROM and 31404 out of 32768 words of RAM!! I only found out about this when I tried to incorporate FreeRTOS into an existing PIC32 project. Without FreeRTOS, this project consumes 35160 words of ROM and 8460 words of RAM. However, once I add the FreeRTOS files in, the linker brings up these error messages: Executing: "C:Program FilesMicrochipMPLAB C32 Suitebinpic32-gcc.exe" -mprocessor=32MX360F512L "Main.o" "list.o" "queue.o" "tasks.o" "port.o" "port_asm.o" "heap_2.o" -o"BD176-01.elf" -Wl,-L"C:Program FilesMicrochipMPLAB C32lib",-L"C:Program FilesMicrochipMPLAB C32pic32mxlib",–defsym=__MPLAB_BUILD=1,-Map="BD176-01.map" C:Program FilesMicrochipMPLAB C32 Suitepic32mxbinld.exe: region kseg1_data_mem is full (BD176-01.elf section .bss) C:Program FilesMicrochipMPLAB C32 Suitepic32mxbinld.exe: address 0xa00091b0 of BD176-01.elf section .heap is not within region kseg1_data_mem C:Program FilesMicrochipMPLAB C32 Suitepic32mxbinld.exe: address 0xa00095b0 of BD176-01.elf section .stack is not within region kseg1_data_mem C:Program FilesMicrochipMPLAB C32 Suitepic32mxbinld.exe: address 0xa0009800 of BD176-01.elf section .ramfunc is not within region kseg1_data_mem Link step failed. Any ideas? --Amr

FreeRTOS takes up all ROM and Program memory

I have seem FreeRTOS run with file system, TCP/IP stack and other software all at once so ROM should not be an issue. I suggest you look at the map file to see where it is going. Probably to the GCC libraries. Are you using sprintf() or something similar? There are lower cost versions in the download. Regarding RAM. What you are seeing is the heap RAM, nearly all of which will be free. This is just a big array set by configTOTAL_HEAP_SIZE.

FreeRTOS takes up all ROM and Program memory

Thanks for your reply Dave, The heap was causing the problem – the default heap size was set to 28000 but my program was already using 8460 words of ram in variables and the two couldn’t fit into the 32768 words of on chip ram. Changing the heap to 20000 fixed the problem and the project now compiles just fine. Thanks for your help! --Amr