Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT




Loading

How to manage memory on PIC24.

Posted by Nakorn Threesinghawong on October 7, 2009
Hi,

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
-------------------

BUILD FAILED

"

please advice me.

RE: How to manage memory on PIC24.

Posted by Peter on October 7, 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[512];
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.

Kind regards,
Peter

RE: How to manage memory on PIC24.

Posted by Richard on October 7, 2009
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.

Regards.

RE: How to manage memory on PIC24.

Posted by Nakorn Threesinghawong on October 8, 2009
Thank You.

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.

Best regards.
EchoRtos

RE: How to manage memory on PIC24.

Posted by Richard Damon on October 8, 2009
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.

RE: How to manage memory on PIC24.

Posted by Nakorn Threesinghawong on October 8, 2009
Thank you very much for your kindy.

it work, when i announce with far attribute.

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?

Best regards.
EchoRtos


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]




Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

FreeRTOS kernel V10 is available for immediate download. Now MIT licensed.


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS