ARM Technical Support Knowledge Articles

LOCATING MORE VARIABLES IN THE NEAR MEMORY AREA

Applies to: C166 C Compiler

Answer


Information in this article applies to:


QUESTION

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

Here are my questions.

  1. How is the range set for the NEAR and FAR data memory?
  2. What strategy does the linker use to locate my data segments?
  3. How can I control how segments are placed into these memory areas?
  4. 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 addresses?

ANSWER

  1. 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.
  2. 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.
  3. 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 Options dialog.
  4. Yes. Accessing variables in NEAR memory always takes less code than accessing data in FAR memory.

MORE INFORMATION

Article last edited on: 2005-07-15 14:09:34

Rate this article

[Bad]
|
|
[Good]
Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential