Re: IAR C Problem with Memory Size
- From: Daniel W <_Ravenware_@xxxxxxxxxxx>
- Date: Tue, 28 Feb 2006 16:11:58 +0100
Hi Steven,
Steven Woody wrote:
hi,
i am using IAR Embedded Workbench for C, the target is M16C. i met
problems when setting heap/stack size in the project options.
currently, the working setting is: stack = 1920, interrupt stack =
128, data 16 heap = far heap size = data20 heap size = 1024. though
i've not yet well unstood what the above really mean, but it works.
the problem is, it seems that i can not most of these values. for
example, if i change the data 16 heap from 1024 to 2048, i will get an
error:
Error[e16]: Segment DATA16_Z (size: 0x59aa align: 0x1) is too long for
segment definition. At least 0x372 more bytes
needed. The problem occurred while processing the segment placement
command
"-Z(NEAR)DATA16_I,DATA16_Z,DATA16_N,DATA16_AN", where at the moment of
placement the available memory
ranges were "CODE:29c8-7fff"
Reserved ranges relevant to this placement:
400-b7f CSTACK
b80-bff ISTACK
c00-13ff DATA16_HEAP
1400-7fff DATA16_I
The linker lets you know that it cannot place the segment DATA16_Z
as there is not enough space available in the defined RAM area.
but i can successfully change the stack from 1920 to 2048.
Increasing the stack from 1920 to 2048 bytes only require 128 bytes
whereas increasing the heap size from 1K to 2K requires a whole
kilobyte of RAM. You probably only have about 136 bytes of free RAM
(deduced by looking at the error message).
The linker command file tries to describe your target system, i.e.
where there is ROM and where there is RAM. You can verify which
..xcl file that is used by checking in the options dialog under
XLINK->Input. Make sure this file matches your actual hardware,
perhaps you've added more external RAM?
The message above indicates that the area 0x29C8 through 0x7FFF
is used when placing __data16 variables.
i heard the M16C gets more than 31k memory, so i feel the error is
confusing.
As I said, make sure that your .xcl file is properly reflecting
your hardware.
by the way, in the data mode option, if i disable ( uncheck ) the>
'Writable constants' check box, i will get another error:
Fatal Error[e72]: Segment DATA16_C must be defined in a segment
definition option (-Z, -b or -P)
what this mean? i believe enable the 'Writable constants' is not a good
solution.
The M16Cs usually do not have ROM in the lower part of the memory,
this option is used to copy-initialize variables instead of placing
them in __far memory. This generates much more efficient code at the
cost of sarificing RAM to store constants. If you do not want this,
then you must use a data model where the default pointer is a __far
pointer.
If you have any other questions, please feel free to direct them at
IAR Systems Support. They are very good at what they do.
Regards
/D
P.s. remove underscores from e-mail address if replying via e-mail.
.
- References:
- IAR C Problem with Memory Size
- From: Steven Woody
- IAR C Problem with Memory Size
- Prev by Date: Re: What's the modern way to dim AC lights?
- Next by Date: Re: @far directive not working as expected
- Previous by thread: IAR C Problem with Memory Size
- Next by thread: Interview Question Suggestions
- Index(es):
Relevant Pages
|