IAR Linker Problem

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View

I'm using an IAR Compiler for Hitachi H8-3687. This Controller has to RAM
areas (0xE800-0xEFFF(2kByte) and 0xFB80-0xFF7F(1kByte). My segment UDATA1
has more than 2kByte an is not linkable. How can I split the segment in two
parts to locate it in both RAM areas?


Re: IAR Linker Problem

Quoted text here. Click to load it

I've not used that compiler, but a couple of general principles:

1) Initialized and Uninitialized data usually go into two separate
segments.  A first guess would be IDATA1.  Try initializing some data
to see if it moves.  Tell your linker script to put IDATA1 in one RAM
area and UDATA1 in the other.

2) The compiler usually decides where to put data.  There may be an
option or a pragma you can use when compiling to direct some modules
to place data in one or another segment of your own choosing.  Maybe
UDATA2?  Look for something like that.


Change is inevitable, progress is not.

Re: IAR Linker Problem

Quoted text here. Click to load it

I have not used the H8-3 IAR compiler, but on the IAR compilers I have
used theres is a compiler flag that keeps text/string data in the ROM
areas. Make sure this is enabled otherwise all text/string data is
copied to RAM.
For locating some variables in other data areas you need to use
something like the following:
 #pragma memory=dataseg(anothersection)
int var_in_anothersection;
#pragma memory=default
You can specify in the linker file where "anothersection" should be

   Anton Erasmus

Re: IAR Linker Problem

Thanks, it's working now!!!!!!


Quoted text here. Click to load it

Re: IAR Linker Problem
Quoted text here. Click to load it

If none of your projects translation units e.g. .c files consists more
2 kBytes uninitialized data, then the linker should be able to place
uninitialilzed data to those two RAM areas automatically.
But if one of these translation units have more than 2 kBytes
uninitialized data
then you better do what Dave said in his post.

Site Timeline