size of "DATA memory"

nobody wrote on Thursday, November 02, 2006:


I’m working with a LPC2138 (ARM7TDMI)

Compiling the code with GCC, the final log lines are:

  8 356 bytes of CODE  memory
15 956 bytes of DATA  memory (+ 229 absolute )
    396 bytes of CONST memory

What does those values mean ? Is DATA memory the RAM that my uController will need ?


nobody wrote on Thursday, November 02, 2006:

Back again

Having a look to the log, i have seen that the make of task.c require more than 14 kbytes of DATA memory. For what ???


zero_janvier wrote on Thursday, November 02, 2006:


It’s not the task.c, it’s the heap_1.c ! Sorry

Building file: …/FreeRTOS/Source/portable/MemMang/heap_1.c
Invoking: IAR ARM Compiler (C/C++)
iccarm.exe --cpu ARM7TDMI-S --cpu_mode thumb --endian little --stack_align 4 --interwork --fpu None --dlib_config “C:\Program Files\IAR Systems\Embedded Workbench 4.0/arm/lib/dl4tpainl8n.h” --no_wrap_diagnostics --dependencies=i FreeRTOS/Source/portable/MemMang/heap_1.r79.deplist -e --require_prototypes -z9 --segment data=DATA --segment code=CODE -I"D:\projects\mv5\board" -I"D:\projects\mv5\config" -I"D:\projects\mv5\FreeRTOS" -I"D:\projects\mv5\FreeRTOS\Common\include" -I"D:\projects\mv5\FreeRTOS\Source\include" -I"D:\projects\mv5\FreeRTOS\Source\portable\IAR\LPC2000" -I"D:\projects\mv5\FreeRTOS\Source\portable\MemMang" -I"D:\projects\mv5\vw" -I"C:\Program Files\IAR Systems\Embedded Workbench 4.0\ARM\inc" -o “FreeRTOS/Source/portable/MemMang/heap_1.r79” “…/FreeRTOS/Source/portable/MemMang/heap_1.c” &&
    (echo "FreeRTOS/Source/portable/MemMang/heap_1.r79 heap_1.d: \&quot;; sed -e ‘s,\,/,g’ < FreeRTOS/Source/portable/MemMang/heap_1.r79.deplist | while read f; do echo "    $(cygpath -u $(cygpath -dm “$f”)) \&quot;; done) > heap_1.d; rm -f FreeRTOS/Source/portable/MemMang/heap_1.r79.deplist

   IAR ARM ANSI C/C++ Compiler V4.31A/W32
   Copyright 1999-2005 IAR Systems. All rights reserved.

     74 bytes of CODE memory (+ 52 bytes shared)
14 208 bytes of DATA memory

Errors: none
Warnings: none
Finished building: …/FreeRTOS/Source/portable/MemMang/heap_1.c

nobody wrote on Thursday, November 02, 2006:

The data should not be used by task.o but your heap function (maybe heap_1.c or heap_2.c).  The size of the heap is allocated by the constant configTOTAL_HEAP_SIZE in FreeRTOSConfig.h, and is the memory pool set aside for use by the scheduler to create task control blocks, queues and the stack used by each task.

Read through the memory management section of the site for information on this.

nobody wrote on Thursday, November 02, 2006:

You can just use malloc() and free() in place of the heap_1 and heap_2 implementations.  This means the configTOTAL_HEAP_SIZE does not need to allocate any RAM.  But all this does is mean you have to allocate a heap from within your linker script instead so you gain nothing.

zero_janvier wrote on Friday, November 03, 2006:

Great !

Thanks a lot