Technical information

AN2216/D
14 MC9S12DP256 Software Development Using Metrowerk’s Codewarrior MOTOROLA
MC9S12DP256, many programming tools, including the Codewarrior
debugger, automatically program the security byte with a value of $FE after
successfully erasing the Flash. This prevents the device from accidentally
being placed in a secure state if a programming operation were to fail. Having
this block of data included in the object file with a value of $FE for the security
byte will ensure that a verify operation will be performed properly.
typedef unsigned char tUINT8;
typedef unsigned short tUINT16;
typedef struct
{
const tUINT16 key1;
const tUINT16 key2;
const tUINT16 key3;
const tUINT16 key4;
const tUINT16 res1;
const tUINT8 prot3;
const tUINT8 prot2;
const tUINT8 prot1;
const tUINT8 prot0;
const tUINT8 res2;
const tUINT8 security;
}tFlashProt;
#pragma CONST_SEG FLASH_PROT
extern const tFlashProt FlashProtection =
{
0xFFFF, /* key1 */
0xFFFF, /* key2 */
0xFFFF, /* key3 */
0xFFFF, /* key4 */
0xFFFF, /* res1 */
0xFF, /* block 3 protection */
0xFF, /* block 2 protection */
0xFF, /* block 1 protection */
0xFF, /* block 0 protection */
0xFF, /* res2 */
0xFE, /* security: unsecured */
};
#pragma CONST_SEG DEFAULT
Figure 14. Flash Security and Protection Constant Values
The contents for the 16 byte memory area is shown in the C source listing in
Figure 14. The values for each of the constants will vary depending on the
memory security and protection features used by an application. However,
especially during development, the security byte,
FlashProtection.security, should be $FE. This is the only value of the