14
3.2 Utility Files
The on-chip monitor program has only basic commands which have to be used as the building blocks
for more complex functions. In particular, the monitor ‘write’ commands can only write to RAM, so
programming of Flash memory requires that another short program is available to do this. Such a
program cannot itself reside in Flash, and therefore most HC908 chips have a Flash programming
routine built into an auxiliary ROM area of memory. Xplor8 makes use of these ROM-resident
routines where appropriate, and to do so it loads a small utility program into the RAM area whenever
necessary. These utility programs are stored in S19 format files, and the source code is provided if you
wish to understand better how they work.
3.3 Entering Monitor Mode
To enter monitor mode, the correct voltages must be applied to various MCU pins during reset. See
the HC908 data sheet for the particular MCU that you are using. If these voltages are recognized, and
the reset is effective (Vdd must drop below 100 mV before being restored), then the MCU will emit
a ‘break’ character. When Xplor8 receives this break, it sends the eight security unlocking bytes as
explained in the following section. Finally, Xplor8 reads a RAM memory location to determine
whether or not unlocking has been successful.
3.4 Security Bytes
If it was simply a matter of applying the correct voltages to the pins of the MCU to enter Monitor
Mode, then any user could read t he contents of FLASH of any MCU. To make this much more
difficult, it is arranged that eight bytes must be sent correctly to the MCU immediately following a
power-on reset when it is desired to enter Monitor Mode. These eight bytes are compared with Flash
locations (actually in the vector area) that have been programmed by the user. If the bytes do not
match the MCU will still enter Monitor Mode, but all Flash memory locations read as garbage. The
only command available in these circumstances is one to mass erase all of Flash memory.
The important consideration is that all access to FLASH memory is lost if the user doesn't know, or
forgets, the values in the 8 security byte locations. Xplor8 therefore goes to some length to make it
unlikely that these bytes will end up in an unknown state.
Security Byte Log
Xplor8 maintains a default log of all changes to the security bytes. Every time an operation is
performed which might change these bytes, a record is added to the log which shows:
• Current project file name
• Date & time of modification
• The security bytes, and
• A note of the reason for the addition of the record.
The log is maintained in the same folder as the Xplor8 executable, and as a read-only file to help avoid
accidental deletion. It is also backed up to a '.bak' file every time it is written. The file format is
'comma-separated value' (.csv) so it may be opened in a spreadsheet program such as Excel - but there
should be no need for this as Xplor8 includes a viewer - see Security Bytes Log Viewer (page 29).
Comentários a estes Manuais