2 relocatable sections, Relocatable sections, Relocatable section programming example – Motorola HC12 User Manual

Page 111

Advertising
background image

Sections

Section Types

MCUez HC12 Assembler

User’s Manual

MOTOROLA

Sections

111

The linker PRM file contains at least:

The name of the absolute file (command LINK)

The name of the object file that should be linked (command NAMES)

Specification of a memory area where the sections containing variables
must be allocated. At least the predefined section

.data

must be placed

there (command SEGMENTS and PLACEMENT). For applications
containing only absolute sections, nothing will be allocated.

Specification of a memory area where the sections containing code or
constants must be allocated. At least the predefined section

.text

must

be placed there. For applications containing only absolute sections,
nothing will be allocated.

The application entry point (command INIT)

Definition of the reset vector (command VECTOR ADDRESS)

6.4.2 Relocatable Sections

The start address of a relocatable section is evaluated at link time, according to
the information stored in the linker parameter file. A relocatable section is
defined through the directive SECTION, as illustrated in

Figure 6-3

.

XDEF entry

constSec: SECTION

; Relocatable constant data section

cst1:

DC.B $A6

cst2:

DC.B $BC

...

dataSec: SECTION

; Relocatable data section

var:

DS.B 1

codeSec: SECTION ; Relocatable code section

entry:

LDAA cst1

; Load value in cst1

ADDA cst2

; Add value in cst2

STAA var

; Store in var

BRA entry

Figure 6-3. Relocatable Section Programming Example

Advertising