Atmel CAVR-4 Manual De Usuario
CAVR-4
Part 1. Using the compiler
Placing code and data
45
Heap size allocation in IAR Embedded Workbench
Select Project>Options. In the General Options category, click the Heap
configuration page.
configuration page.
Add the required heap size in the appropriate text box.
Heap size allocation from the command line
The size of the heap segments are defined in the linker command file.
The default linker file sets up a constant, representing the size of each heap, at the
beginning of the linker command file:
beginning of the linker command file:
-D_TINY_HEAP_SIZE=size
-D_NEAR_HEAP_SIZE=size
-D_FAR_HEAP_SIZE=size
-D_HUGE_HEAP_SIZE=size
-D_HEAP_SIZE=size /* For CLIB */
Specify the appropriate size for your application.
If your application uses near or far memory, symbols for heaps for these memories
should also be defined in the linker command file.
should also be defined in the linker command file.
Placement of heap segments
The actual heap segment is allocated in the memory area available for the heap:
-Z(DATA)HEAP+_TINY_HEAP_SIZE=60-25F
Note: This range does not specify the size of the heap; it specifies the range of the
available memory.
available memory.
Use the same method for all used heaps.
Heap size and standard I/O
If you have excluded
FILE
descriptors from the DLIB runtime environment, like in the
normal configuration, there are no input and output buffers at all. Otherwise, like in the
full configuration, be aware that the size of the input and output buffers is set to 512
bytes in the
full configuration, be aware that the size of the input and output buffers is set to 512
bytes in the
stdio
library header file. If the heap is too small, I/O will not be buffered,
which is considerably slower than when I/O is buffered. If you execute the application
using the simulator driver of the IAR C-SPY Debugger, you are not likely to notice the
speed penalty, but it is quite noticeable when the application runs on an AVR
microcontroller. If you use the standard I/O library, you should set the heap size to a
value which accommodates the needs of the standard I/O buffer.
using the simulator driver of the IAR C-SPY Debugger, you are not likely to notice the
speed penalty, but it is quite noticeable when the application runs on an AVR
microcontroller. If you use the standard I/O library, you should set the heap size to a
value which accommodates the needs of the standard I/O buffer.