Re: IAR C Problem with Memory Size



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



Relevant Pages

  • assembler syntax
    ... For my Forth CPU I'll write an assembler. ... create ram 20000 allot ... target definitions ... The idea is to read one cell for each line and add it to the memory. ...
    (comp.lang.forth)
  • Re: How to speedup the boothing time of wince
    ... So you can just download some required files from flash to RAM to speedup ... on target platform and boot target from hard disk. ... its booting time is very high. ...
    (microsoft.public.windowsce.embedded)
  • Re: 32-Bit Microcontroller for New Project
    ... Eclipse uses a lot of RAM. ... to the target. ... There is now a new emulator available, AVRONE, which uses ...
    (comp.arch.embedded)
  • Re: Virtual Memory Minimum Too Low - but no pagefile!
    ... On our systems we have 512 MB of RAM and use from 450-480 MB of ram. ... "Virtual Memory is low" is triggered at 256 MB or perhaps little less I can't remember now. ... Have you ever used Microsoft's Windbg? ... > have any way to diagnose an application problem on the target itself. ...
    (microsoft.public.windowsxp.embedded)