USER'S GUIDE

Application software always has unrestricted read/write access to the nonvolatile RAM designated as data memory. This is the memory that lies above the Partition address and below the Range address (the non±parti- tionable configuration of the DS5001 will be addressed separately). Data memory is read or written using the MOVX instruction. Only the area designated as pro- gram memory can not be altered. The key to doing a ªSoft Reloadº is to temporarily change the program memory RAM into data memory. Using an SFR, the ap- plication software can authorize the Secure Microcon- troller to temporarily redefine a portion of the program memory area as data memory. Once this is done, the new code can be received through a serial port (or other means) and written into data memory. When the pro- cess is complete and the new memory is verified as cor- rect, software converts the RAM back into write±pro- tected program memory for the duration. As with the memory map control, there are minor differences be- tween the DS5000 series and DS5001/DS5002 series devices in how this is accomplished. Each is described below.

SOFT RELOAD OF A DS5000 SERIES DEVICE When application software decides that it should repro- gram a portion of memory, the software must convert the target area into data memory. The DS5000 will do this when software sets the PAA bit (MCON.1) to a logic

1.PAA is the Partition Access Enable. Setting PAA has two effects. The microcontroller will automatically move the Partition to 0800h and allow write access to the Partition control bits PA3±0 (MCON.7±4). At this time, the software can adjust the Partition, but the new value will not be used until after PAA is cleared. The Partition remains at 0800h as long as PAA=1, regardless of the Partition control bits. This leaves a 2K block of NV RAM (from 0000±0800h) assigned as program memory. Apart from this, no other changes take place and soft- ware continues to operate normally. Caution, make cer- tain that the code that controls the PAA resides in this first 2K. When PAA=1, all addresses on the Byte±wide bus greater than 0800h will be viewed as data memory and can not be executed even if they were program memory originally. This gives the software read/write access to the remaining 6K bytes (Range=8K) or 30K bytes (Range=32K) of NV RAM on the Byte±wide bus.

At this time, software can begin reloading the target area of memory. There are two minor variations of this procedure. First, a user's loader routine that resides below 0800h (2K) can reprogram the remainder of memory as needed. This is done be receiving the new

code through a serial port or other mechanism and writ- ing it to the RAM at the addresses where it will be executed. Since the RAM is data memory, the write op- eration is done using MOVX instructions.

The second option is that the user's code below 2K can simply move the Partition to a new value. This is done by writing a new value for PA3±0 in MCON (MCON.7±4) while PAA is still set to a 1, then clearing PAA. The pur- pose of this would be that the loader routine mentioned in option 1 resides in memory above 2K, but below the target memory area. To gain access, the Partition must be moved to a location that includes this loader routine. Once the Partition is moved to this temporary location, the software loader can reprogram new code as before.

When loading is complete, the Partition must be either restored or set to a new value that is appropriate for the new software. If the PA3±0 bits were not modified, then the PAA bit can simply be cleared. This will cause the old Partition to be restored. If the PAA3±0 were modified during loading or software has grown significantly, then a new Partition is needed. The PA3±0 bits must be writ- ten while PAA is set to a 1.

The DS5000FP protects the PAA bit from accidental modification by requiring a Timed Access procedure. Timed Access is designed to prevent an out±of±control program from modifying the PAA bit and crashing the application. Timed Access is discussed in a later sec- tion. To summarize the ªSoft Reloadº, the procedure goes as follows:

1.Ensure that current program execution is in the range of 0000h to 0800h.

2.Set the Partition Address Access (PAA) bit using a Timed Access Procedure.

3.Load new contents into program memory at ad- dresses above 0800h using MOVX instructions.

4.Define a new Partition address if necessary and write the appropriate bits into PA3±0 in the MCON SFR.

5.Restore the current Partition by clearing the PAA bit with a Timed Access procedure.

6.Resume operation.

The following illustrates the Soft Reload procedure. The original program requires a partition of 4000h (16K by- tes). The new program is larger, requiring a Partition of 6000h (24K bytes). The code that performs these steps is shown below. This routine must be located below 0800h in program memory.

050396 23/173

24

Page 24
Image 24
Mitsubishi DS907x SIP, DS5000TK manual 050396 23/173