 | Technical Support |  |
|
|
Technical Support Support Resources Product Information | C166: LOCATING MORE VARIABLES IN THE NEAR MEMORY AREA
Information in this article applies to:
QUESTIONI'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. - How is the range set for the NEAR and FAR data memory?
- What strategy does the linker use to locate my data segments?
- How can I control how segments are placed into these memory areas?
- 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- In µVision, 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 µVision Project Options dialog, you may specify this in the Data input line in the Target Options dialog.
- Yes. Accessing variables in NEAR memory always takes less code than accessing data in FAR memory.
MORE INFORMATIONLast Reviewed: Friday, July 15, 2005
|
|