Keil™, An ARM® Company

C166 User's Guide

Sections, Classes, and Groups

A section is a contiguous area of memory generated from code or data defined in a source module. Each section has a type, class, group, and a name. Sections are usually related to the hardware configuration. Therefore, portions of programs stored in ROM are in separate sections from the portions stored in RAM. Sections generated by the Keil C166 Compiler are given names which are composed of a prefix and the name of the source module.

A class is an arbitrarily ordered collection of sections that share a common attribute. The purpose of a class is to allow manipulation of a number of sections using only the class name. For instance, the near data objects from all modules in a program are combined into the NDATA class while the far constant objects are combined into the FCONST class.

A group is a shorthand which is used to reference a collection of sections that all reside within one data page (for data groups) or segment (for code groups). Groups define address-range limits for their references sections. Two group types are supported: CGROUP (code groups) and DGROUP (data groups). Groups are used by the linker to guarantee that classes within the group fit into the appropriate address range (16K for DATA or 64K for CODE) and that DPP register assignments are correctly performed in the startup code. The DPPUSE linker directive may be used to extend the address space possible for DATA groups.

Objects that the C166 Compiler generates (such as program code, program data, and constant data) are stored in sections that may be absolute or relocatable. The only exception is automatic variables that are stored on the USER STACK that is addressed by the R0 register. The compiler creates a separate section for each memory type used in the C source.

Section names created by the C166 Compiler are converted to and stored in uppercase and include a class-code and a module-name formatted as follows:

?class-code?module-name

Where

class-codeis an abbreviation for the class type.
module-nameis the name of the source file in which the object is declared.

The following table shows all possible section names with their associated class and group names. The class and group names are used by the linker to simplify address assignments and to ensure that objects from different modules are placed in valid address ranges.

Section NameGroup NameClass NameSection Contents
?PR?module-nameNCODENCODEnear function code
?PR?module-nameFCODEfar function code
?NC?module-nameNCONSTNCONSTconst near objects
?FC?module-nameFCONSTconst far objects
?HC?module-nameHCONSTconst huge objects
?XC?module-nameXCONSTconst xhuge objects
?ND?module-nameNDATANDATAnear objects with #pragma NOINIT
?ND0?module-nameNDATANDATA0near objects with #pragma INIT
?SD?module-nameSDATASDATAsdata objects with #pragma NOINIT
?SD0?module-nameSDATASDATA0sdata objects with #pragma INIT
?ID?module-nameSDATAIDATAidata objects with #pragma NOINIT
?ID0?module-nameSDATAIDATA0idata objects with #pragma INIT
?BD?module-nameSDATABDATAbdata objects with #pragma NOINIT
?BD0?module-nameSDATABDATA0bdata objects with #pragma INIT
?BI?module-nameBITbit objects with #pragma NOINIT
?BI0?module-nameBIT0bit objects with #pragma INIT
?FD?module-nameFDATAfar objects with #pragma NOINIT
?FD0?module-nameFDATA0far objects with #pragma INIT
?HD?module-nameHDATAhuge objects with #pragma NOINIT
?HD0?module-nameHDATA0huge objects with #pragma INIT
?XD?module-nameXDATAxhuge objects with #pragma NOINIT
?XD0?module-nameXDATA0xhuge objects with #pragma INIT
?C_INITSECVariable-initialization information
?C_MEMCLRSECRAM zero-initialization information
?C_STARTUP_CODEICODEStartup code for the C main function

Note

  • If the TINY memory model is used, no group names are assigned to the section names.