LOCATING MORE VARIABLES IN THE NEAR MEMORY AREA
Applies to: C166 C Compiler
Information in this article applies to:
I'm migrating a working C166 application from the TINY memory
model (near code & near data) to the COMPACT memory model (near
code & far data). The tools have split my RAM usage between near
memory and far memory even though these memory spaces occupy the same
Here are my questions.
- How is the range set for the NEAR and FAR data memory?
What strategy does the linker use to locate my data
How can I control how segments are placed into these memory
The code size of my application increased from 20k to 23k. If I
can get the linker to place more of my data in the NEAR area, will
the code size shrink because NEAR data is accessed using 16-bit
In uVision, if you use the target options window to specify
your memory areas, the ranges for the data area are set
automatically. So, if you select the COMPACT memory model, the NEAR
and FAR data areas are set to the same address space. You can use
the L166 Locate dialog in the Project Options dialog to manually
set the address ranges for each memory class. You must un-check the
Use Memory Layout from Target Dialog to do that.
The strategy used is described in the L166 Linker User's Guide.
Basically, the linker combines all NEAR segments and all FAR
segments together as you would expect.
Use the HOLD compiler directive to specify the maximum size of
objects placed in the NEAR memory. In the uVision Project Options
dialog, you may specify this in the Data input line in the Target
Yes. Accessing variables in NEAR memory always takes less code
than accessing data in FAR memory.
Article last edited on: 2005-07-15 14:09:34
Rate this article
Disagree? Move your mouse over the bar and click