Technical information

AN2216/D
CodeWarrior Linker
MOTOROLA MC9S12DP256 Software Development Using Metrowerk’s Codewarrior 13
typedef unsigned char tUINT8;
typedef struct
{
volatile tUINT8 porta; /* port A data register */
volatile tUINT8 portb; /* port B data register */
tUINT8 ddra; /* port A data direction register */
tUINT8 ddrb; /* port B data direction register */
/* continue… */
}tREGISTER;
#pragma DATA_SEG S12_REG
extern tREGISTER Registers;
#pragma DATA_SEG DEFAULT
Figure 12. Example Code for Registers Variable
SECTIONS
/* flash, RAM, EEPROM etc */
DP256_REG = NO_INIT 0x0000 TO 0x0003; /* exact address for Registers */
END
PLACEMENT
/* Placement of code */
S12_REG INTO DP256_REG; /* Placement of Registers */
END
Figure 13. Additional Linker Commands for Register Placement
As an alternative to placement of the Registers variable in the linker file, the
Registers variable may be placed at an absolute address within the code, by
using the non-ANSI '@' symbol as follows:
tREGISTER Registers @0x00;
Flash Protection and
Security Registers
A short summary of the Flash protection and security features is given in
Appendix A of this document. Further details are given in Application Note
AN2400/D.
Even if the memory security and protection features are not being utilized
during development, a constant variable containing data for this 16 byte area
should be created, compiled and linked into the absolute file for compatibility
with some Flash programming tools. Because of the inability to erase the Flash
and EEPROM using the BDM interface in the first mask set (0K36N) of the