µVISION: MEMORY SETTINGS AND CLASSES RELATIONSHIP
Information in this article applies to:
How do the memory settings in the Options for Target dialog control the linker?
You may specify up to six ranges of external memory. These may be ROM or RAM. The linker CLASSES directive is then derived from these settings.
For example, if you specify two ROM ranges 000000H -> 00FFFFH and 100000H -> 10FFFFH, then these ranges are used in the following way (for the large memory model):
CLASSES( NCODE (0X100000-0X10FFFF), FCONST (0X0-0XDFFF, 0X100000-0X10FFFF), HCONST (0X0-0XDFFF, 0X100000-0X10FFFF), XCONST (0X0-0XDFFF, 0X100000-0X10FFFF), NCONST (0X4000-0X7FFF) ICODE (0X0-0XDFFF), FCODE (0X0-0XDFFF, 0X100000-0X10FFFF), ...)
Note that the range E000H -> FFFFH is not defined in any of the classes. This is because the on-chip CAN, XRAM and SFRs occupy these locations. If the device you have selected features on-chip CAN or XRAM, then there will be a checkbox in the dialog to specify if they are used or not. Turning that option off increases the class ranges up to EFFFH.
Note that the size of NCONST is only 16kb. This can be increased to 32kb or 48kb by using the Near Memory ROM drop down list in the dialog. The linker DPPUSE directive is used to configure this.
If you specify two RAM ranges, 000000H -> 003FFFH and 200000H -> 20FFFFH, then the following CLASSES directive is used (for the large memory model):
CLASSES( NDATA (0X0-0X3FFF), NDATA0 (0X0-0X3FFF), SDATA (0XE000-0XE7FF, 0XF600-0XFDFF), SDATA0 (0XE000-0XE7FF, 0XF600-0XFDFF), IDATA (0XF600-0XFDFF), IDATA0 (0XF600-0XFDFF), FDATA (0X0-0X3FFF, 0X200000-0X20FFFF), FDATA0 (0X0-0X3FFF, 0X200000-0X20FFFF), HDATA(0X0-0X3FFF, 0X200000-0X20FFFF), HDATA0 (0X0-0X3FFF, 0X200000-0X20FFFF), XDATA (0X0-0X3FFF, 0X200000-0X20FFFF), XDATA0 (0X0-0X3FFF, 0X200000-0X20FFFF), ...)
Again, NDATA only spans 16kb. This may be increased to 32kb or 48kb by using the Near Memory RAM drop down list in the dialog. The linker DPPUSE directive is used to configure this.
SDATA covers the on-chip CAN and XRAM locations and the Internal RAM locations. IDATA covers the Internal RAM locations. The SDATA and IDATA ranges do not change, regardless of where RAM has been specified in External Memory as SDATA and IDATA only relate to internal memory.
If the option to use on-chip CAN and XRAM is turned off, then the SDATA and IDATA classes only cover the Internal RAM of the device.
The FDATA, HDATA and XDATA classes cover the external memory ranges specified in the dialog.
It is possible to increase the size of NDATA and NCONST up to 48kb each, in pages of 16kb, however the total amount of NDATA and NCONST memory cannot exceed 64kb.
To increase the size of these memory classes, the Near Memory drop down lists may be used. The Linker DPPUSE directive configures this and the following is an example for 32kb of NDATA and 16kb of NCONST:
DPPUSE (0=NDATA (0X200000-0X207FFF), 2=NCONST (0X10000-0X13FFF))
Note that the NDATA class was moved from 000000H to 200000H so that the 32kb of NDATA could exist in one single block. If the size of the first range of RAM was increased from 16kb to over 32kb then NDATA would have remained at 000000H.
If the maximum 64kb of NDATA and NCONST are selected, then DPP3 must be used to access one of the four 16kb pages. However, DPP3 must always point to page 3, which is C000H -> FFFFH. Therefore either 16kb of NDATA or 16kb of NCONST must occupy this range of addresses. If you do not ensure that one of these classes does, then either NDATA or NCONST will be reduced by 16kb in size. No warning will be given of this.
The classes that will be used by the linker based on the Target memory settings are shown in the Linker Control String box under the L166 Locate tab.
The following Discussion Forum threads may provide information related to this topic.
Last Reviewed: Tuesday, July 10, 2018
of your data.