Qorivva MPC56xx Flash Programming Through Nexus/JTAG: Application Note
Qorivva MPC56xx Flash Programming Through Nexus/JTAG: Application Note
Qorivva MPC56xx Flash Programming Through Nexus/JTAG: Application Note
Rev. 0, 09/2011
Application Note
For further information on VLE, please consult VLEPM, Variable-Length Encoding (VLE) Programming
Environments Manual, available from freescale.com.
This application note is adapted from AN3283, “MPC5500 Flash Programming Through Nexus/JTAG.” It
first addresses the JTAG and Nexus communication protocol. The JTAG discussion includes the JTAG
signals, TAP controller state machine, and the JTAG controller. The explanation of Nexus includes the
on-chip emulation (OnCE) module and the Nexus read/write (R/W) access block. As different versions of
the MPC56xx devices may use different JTAG and Nexus modules, the examples given here are generic
to suit this flash memory programming note. If more detailed information is required for a specific device,
please consult the reference manual.
After the communication protocols are described, this document goes into the details of the
Freescale-provided flash memory drivers and the requirements of the external tool for flash programming.
For the purpose of this document, the external tool consists of a PC application combined with interface
hardware that connects the PC to the JTAG port on an MPC56xx board or module.
This document is intended for anyone wanting to develop a flash memory programming tool for the
MPC56xx family of devices. Someone wanting to learn about the JTAG communication protocol, OnCE
module, or the Nexus R/W access block may also find this application note beneficial.
1 JTAG
JTAG is a serial communication protocol developed by the Joint Test Access Group. Originally developed
for boundary scan, JTAG is also used for communication with the Nexus debug interface (NDI) on the
MPC56xx devices. Figure 2 shows a block diagram of the NDI.
Cache
Off-Chip
eTPU Memory & I/O
MMU
Engine Engine XBAR On-Chip
1 2* Memory & I/O
e200z6
CDC
eDMAC FlexRay
Read/Write
Access
•••
JCOMP RDY TDI TCK TDO TMS EVTI MSEO[0:1] MCKO MDO(4 or 12) EVTO
* Some MPC55xx devices have one eTPU engine, others have two engines.
to the EXIT1-IR state. Table 3 shows the steps required to enable the OnCE TAP controller, assuming the
TAP controller state machine is initially in the RUN-TEST/IDLE state. The state machine is returned to
the RUN-TEST/IDLE state when the write is complete.
Table 3. Steps for enabling the OnCE TAP controller
1 1 X SELECT-DR-SCAN
2 1 X SELECT-IR-SCAN
3 0 X CAPTURE-IR
4 0 X SHIFT-IR
5 0 1 SHIFT-IR
6 0 0 SHIFT-IR
7 0 0 SHIFT-IR
8 0 0 SHIFT-IR
9 1 1 EXIT1-IR
10 1 X UPDATE-IR
11 0 X RUN-TEST/IDLE
1
A value of X signifies that the signal value does not
matter.
Figure 3 shows the required signal transitions on a logic analyzer for enabling the OnCE TAP controller.
0 1 2 3 4 5 6 7 8 9
R/W GO EX RS[0:6]
Reset - 0b10_0000_0010 on assertion of JCOMP, during power on reset, or while in the TEST LOGIC RESET state
1 GO Go Command bit
0 Inactive (no action taken)
1 Execute instruction in IR
If the GO bit is set, the chip will execute the instruction that resides in the IR register in the
CPUSCR. To execute the instruction, the processor leaves debug mode, executes the
instruction, and if the EX bit is cleared, returns to debug mode immediately after executing the
instruction. The processor goes on to normal operation if the EX bit is set, and no other debug
request source is asserted. The GO command is executed only if the operation is a read/write
to CPUSCR or a read/write to “No Register Selected.” Otherwise, the GO bit is ignored. The
processor will leave debug mode after the TAP controller Update-DR state is entered.
On a GO + NoExit operation, returning to debug mode is treated as a debug event, thus
exceptions such as machine checks and interrupts may take priority and prevent execution of
the intended instruction. Debug firmware should mask these exceptions as appropriate. The
OSR[ERR] bit indicates such an occurrence.
Table 5 shows the OnCE register address. This example is taken from an e200z7 core MPC56xx device.
Some of the registers shown may not be available on devices with other cores. However, the registers used
for flash memory programming are identical across all MPC56xx e200zx cores.
Only the DBCR0[EDM] is accessible in the DBCR0 register prior to that bit being set. Setting
DBCR0[EDM] enables external debug mode and disables software updates to debug registers. The CPU
should be placed in debug mode via the OCR[DR] bit prior to setting the DBCR0[EDM] bit. For more
information on enabling external debug mode, see Section 2.5, “Enabling external debug mode and other
initialization.”
Table 5. OnCE register addressing (e200z7 core)
EDM bit is used as an example of a writing a OnCE register. Figure 5 shows the register definition of
DBCR0.
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
R EDM IDM RST ICMP BRT IRPT TRAP IAC1 IAC2 IAC3 IAC4 DAC1 DAC2
Reset 01 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
Reset 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1DBCR0[EDM] is affected by a Nexus port reset or a power on reset, but not by an assertion of RESET. All other
bits are reset by processor reset (including assertion of RESET) as well as by a power on reset.
The example of writing DBCR0 is divided into two parts: writing OCMD to select a write to DBCR0, and
writing the value 0x80000000 to DBCR0. All data will be scanned in least significant bit first.
Figure 6 shows writing the value 0b00_0011_0001 to OCMD through the IR path to select a write to
DBCR0 assuming the TAP controller state machine is initially in the RUN-TEST/IDLE state. The state
machine is returned to the RUN-TEST/IDLE state when the write is complete.
Figure 7 shows writing the value 0x80000000 to DBCR0 through the DR path to set the EDM bit assuming
the TAP controller state machine is initially in the RUN-TEST/IDLE state. The state machine is returned
to the RUN-TEST/IDLE state when the write is complete.
Figure 8. Signal transitions for writing OCMD to select a read from DBCR0
Figure 9 shows reading the value 0x80000000 from DBCR0 through the DR path assuming the TAP
controller state machine is initially in the RUN-TEST/IDLE state. The state machine is returned to the
RUN-TEST/IDLE state when the read is complete.
0 1 2 3 4 5 6 7 8 9
Figure 11 shows reading the OnCE status register on TDO while writing the OCMD on TDI assuming the
TAP controller state machine is initially in the RUN-TEST/IDLE state. The state machine is returned to
the RUN-TEST/IDLE state when the read is complete. The OCMD is written with the value
0b10_0001_0001 choosing a read of No Register Selected. The data read on TDO from the OnCE status
register is 0b10_0000_1001 showing that the OSR[MCLK] and OSR[DEBUG] status bits are set. All data
is scanned in and out least significant bit first.
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
DW
DM
DG
DR
0 DMDIS 0 DE 0 WKUP FDB
DI
Reset - 0x0000_0000 on negation of JCOMP, power on reset, or entering TEST LOGIC RESET state
The OCR[DR] bit is the CPU debug request control bit; it requests that the CPU unconditionally enter
debug mode. The OCR[WKUP] bit is the wakeup request bit used to guarantee that the CPU clock is
running. Debug status and CPU clock activity can be determined by reading the DEBUG and MCLK bits
in the OnCE status register. After entering debug mode, the OCR[DR] bit should be cleared leaving the
OCR[WKUP] bit set. OCR[FDB] should also then be set to enable recognition of software breakpoints.
See Section 2.12.1, “Software breakpoints,” for details on software breakpoints. The steps required for
entering debug mode during reset assuming the OnCE TAP controller has been enabled via the method
described in Section 2.1, “Enabling the OnCE TAP Controller,” are listed below:
1. Assert RESET.
2. Set the OCR[DR] and OCR[WKUP] bits.
3. Deassert RESET.
4. Verify debug mode via the DEBUG bit in the OnCE status register.
5. Clear the OCR[DR] bit while leaving OCR[WKUP] set and set OCR[FDB].
In order to program the flash memory through the Nexus port, the boot mode must be set such that the
internal flash and Nexus state are both enabled. This is determined in slightly different ways on different
MPC56xx family members. Some use BOOTCFG pins, whereas others use FAB (Force Alternate Boot)
and ABS (Alternate Boot Selector) pins. Please consult the BAM chapter of the relevant reference manual
for detailed information on boot mode setting.
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
R IDE UDE MRR ICMP BRT IRPT TRAP IAC1 IAC2 IAC3 IAC4 DAC1 DAC1 DAC2 DAC2
R W R W
W
Reset 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
Reset 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
TDO
32 TCK
0 31
WBBR low
32 TDI
0 31
WBBR high
32
0 31
MSR
32
0 31
PC
32
0 31
IR
32
0 31
CTL
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
IRSTAT8
IRSTAT9
IRSTAT0
IRSTAT1
IRSTAT2
IRSTAT3
IRSTAT4
IRSTAT5
IRSTAT6
IRSTAT7
* PCOFST
PCINV
FFRA
Figure 15. Control State Register (CTL)
The “*” in the CTL register represents internal processor state bits that should be restored to the value they
held when debug mode was entered prior to exiting debug mode. If a single step is executing an instruction
that is in the normal instruction flow of the program that was running when debug mode was entered, these
bits should be restored. If a single step is executing an instruction outside the normal instruction flow, these
bits should be cleared to zero.
The PCOFST field indicates whether the value in the PC portion of the CPUSCR must be adjusted prior
to exiting debug mode. Due to the pipelined nature of the CPU, the PC value must be backed-up under
certain circumstances. The PCOFST field specifies the value to be subtracted from the PC value when
debug mode was entered. This PC value should be adjusted according to PCOFST prior to exit from debug
mode if continuation of the normal instruction stream is desired. In the event that PCOFST is non-zero,
the IR should be loaded with a no-op instruction instead of the value in the IR when debug mode was
entered. The preferred no-op instruction is ori 0,0,0 (0x60000000). Using VLE the preferred no-op is e_ori
0,0,0 (0x1800D000).
Below are the possible values and meanings of the PCOFST field.
0000 = No correction required.
0001 = Subtract 0x04 from PC.
0010 = Subtract 0x08 from PC.
0011 = Subtract 0x0C from PC.
0100 = Subtract 0x10 from PC.
0101 = Subtract 0x14 from PC.
All other encodings are reserved.
After entering debug mode, the PCINV field overrides the PCOFST field and indicates if the values in the
PC and IR are invalid. If PCINV is 1, then exiting debug mode with the saved values in the PC and IR will
have unpredictable results. Debug firmware should initialize the PC and IR values in the CPUSCR with
desired values before exiting debug if this bit was set when debug mode was initially entered.
0 = No error condition exists.
1 = Error condition exists. PC and IR are corrupted.
The FFRA control bit causes the contents of WBBR to be used as the rA (rS for logical and shift
operations) operand value of the first instruction to be executed when exiting debug mode or the
instruction to be single stepped. This allows the external tool to update CPU registers and memory. rA and
rS are instruction syntax used to identify a source GPR.
0 = No action.
1 = Contents of WBBR used as rA (rS for logical and shift operations) operand value.
The IRStat0-9 bits provide status information to the external tool. The IRStat8 bit indicates that the
instruction in the IR is a VLE or non-VLE instruction. For MPC56xx devices with an e200z0 core only
VLE instructions are used and this bit is reserved.
0 = IR contains a BookE instruction.
1 = IR contains a PowerPC VLE instruction, aligned in the most significant portion of IR if 16-bit.
error by verifying that the OSR[DEBUG] bit is set and OSR[ERR] bit is cleared. For details on reading
the OSR, see Section 2.3, “OnCE Status Register.”
During single step, exception conditions can occur, if not masked, and may prevent the desired instruction
from being executed. After stepping over the instruction, the core will fetch the next instruction. The new
program counter and instruction will be loaded into the PC and IR portions of the CPUSCR. Care must be
taken to insure that the next instruction fetch after the single step is to a valid memory location. See
Section 4.1, “Setting up the memory management unit,” and Section 4.2, “Internal SRAM initialization,”
for details. For MPC56xx devices with Book E and VLE capable cores, the CTL[IRstat8] bit indicates that
the instruction in the IR is a VLE or non-VLE instruction. For MPC56xx devices with an e200z0 core,
only VLE instructions are available and the CTL[IRstat8] is reserved. The CTL[FFRA], CTL[IRStat8],
and the CTL bits indicated by “*” should be set as appropriate before single stepping. All other CTL bits
should be set to zero. See Section 2.6.2, “Control State register (CTL),” for details on FFRA, IRStat8, and
the bits indicated by “*”.
Single stepping can be used during normal execution of the instruction flow or to force execution of a
particular instruction by loading the desired instruction into the IR portion of the CPUSCR. By forcing
execution of particular instructions, single stepping can be used for memory and register access by the tool.
See Section 2.11, “OnCE memory access,” Section 2.9, “GPR access,” and Section 2.10, “SPR access,”
for details.
to r31. The next step is to step over the instruction stw r31, 0(X) with 0x40000000 in WBBRlow and the
CTL[FFRA] bit set. The X in the instruction is replaced by the WBBRlow register. GPR r31 should then
be restored to its saved value.
Reading a memory location is achieved by first reading the contents of a GPR and saving that value, then
single stepping a lwz, lhz, or lbz (VLE e_lwz, e_lhz, e_lbz) with the address to be read in WBBRlow and
the CTL[FFRA] bit set. The GPR that was previously saved should be used as the rD field of the load
instruction. The value read from the memory location will then be in both the WBBRlow and the GPR
whose value was previously saved. After single stepping the load instruction and getting the read data from
WBBRlow, the saved GPR value should then be restored. For example, to read a word from address
location 0x40000000, first save the value in r31. Then single step over the instruction lwz r31, 0(X) with
0x40000000 in WBBRlow and the CTL[FFRA] bit set. The X in the instruction is replaced by the
WBBRlow register. After the single step is complete, the data read from memory can be read by the external
tool from WBBRlow. GPR r31 should then be restored to its saved value. See Section 2.7, “Single step,”
for details on single stepping.
2.12 Breakpoints
The OnCE debug module provides the capability for both software and hardware breakpoints to be set at
a particular address. For Flash programming using the Freescale provided Flash drivers, software
breakpoints are the easiest to use. As a reference, instruction address hardware breakpoints will also be
discussed in this section.
4. Poll the DBSR for the appropriate status bit to be set; DBSR[IAC1], DBSR[IAC2], DBSR[IAC3],
or DBSR[IAC4]. Figure 13 shows the register definition of DBSR.
5. If the appropriate status bit in DBSR is set, verify entry into debug mode by reading the OnCE
status register.
6. Clear the appropriate status bit by writing a 1 to that bit location in the DBSR; DBSR[IAC1],
DBSR[IAC2], DBSR[IAC3], or DBSR[IAC4].
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
R AC RW SZ MAP PR BST 0 0 0 0 0
Reset 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
R CNT ERR DV
Reset 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
31 AC Access control.
0 End access
1 Start access
30 RW Read/write select.
0 Read access
1 Write access
20–16 — Reserved.
15–2 CNT Access control count. Number of accesses of word size SZ.
[13:0]
Read access has not completed Write access completed without error 0 0
Read access error has occurred Write access error has occurred 1 0
Read access completed without error Write access has not completed 0 1
Not allowed Not allowed 1 1
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
R Read/Write Data
W
Reset 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Nexus Reg 0xA
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
R Read/Write Data
W
Reset 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Nexus Reg 0xA
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
R Read/Write Address
Reset 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
R Read/Write Address
Reset 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
(7 bits) (1 bit)
2. The second pass through the DR then shifts the data in or out depending on the type of access. Data
is always shifted LSB first.
a) During a read access, the data is latched from the Nexus register when the TAP controller state
machine passes through the CAPTURE-DR state. The data from the Nexus register can be read
by the external tool by shifting the data out in the SHIFT-DR state. The last bit is shifted out
with TMS set to 1, causing a transition to the EXIT1-DR state.
b) During a write access, the data is shifted in while in the SHIFT-DR state. The last bit is shifted
in with TMS set to 1, causing transition to the EXIT1-DR state. The data is latched into the
Nexus register when the TAP controller state machine passes through the UPDATE-DR state.
4. The Nexus block will then arbitrate for the system bus and transfer the data value from RWD to
the memory mapped address in RWA. When the access has completed without error, then
RWCS[ERR] = 0 and RWCS[DV] = 0. See Table 7 for details. This indicates that the device is
ready for the next access. Nexus will also assert the RDY pin when the transaction has completed
without error. The external tool can use this as an alternative to polling the RWCS status bits.
4 System initialization
For flash memory programming, there is some system initialization that needs to be performed by the
external tool. This initialization includes setting up the memory management unit (MMU), initializing the
internal SRAM, and configuring the frequency modulated phase-locked loop (FMPLL).
in WBBRlow will cause all 32 GPRs to be written to memory starting at address 0x40000000 using 64-bit
writes. Then 0x80 should be added to the address, written to WBBRlow, and stmw executed again. This
should be done [size of internal SRAM] [0x80] times to initialize the entire internal SRAM. The MMU
must be configured prior to initializing the internal SRAM. See Section 4.1, “Setting up the memory
management unit,” for details.
Table 9. MPC56xx flash memory standard driver and e200zx core family type1
MPC564xL C90FL_JDP_SSD e200z4
An example of the s-record demo for the C90LC flash driver is shown in Appendix A, “Demo calling
basic SSD functions,” to illustrate how parameters are passed to the flash driver functions used in the next
steps.
5.2.2 FlashInit
After the drivers are loaded into internal SRAM, operations on the flash memory can begin. The FlashInit
driver should be called first to initialize the flash memory. The steps required are outlined below.
1. Set up the SSD_CONFIG structure as required. This is documented in the SSD user’s manual. YOu
should correctly initialize the fields XXXXRegBase (replace XXXX with the relevant flash
memory module such as C90LC or C90FL), mainArrayBase, shadowRowBase, shadowRowSize,
pageSize, and BDMEnable. The other fields will be initialized when FlashInit is executed.
BDMEnable should be set to 1 to cause debug mode to be entered via a software breakpoint when
each driver completes execution. This is the easiest way for the external tool to determine when
driver execution is complete.
2. Set up r1 as the stack pointer by writing r1 using the method described in Section 2.9, “GPR
access.”
3. Set up r3 to point to the SSD_CONFIG structure in internal SRAM.
4. Set the PC to the beginning of FlashInit minus 0x4 and load the IR with a no-op (ex: Book
E=0x60000000 VLE =1800D000). See Section 2.6, “CPU Status and Control Scan Chain Register
(CPUSCR)” for details.
5. Exit debug mode and begin execution of the driver as described in Section 2.8, “Exit from debug
mode to normal execution.”
6. Poll the OnCE Status Register to determine when debug mode has been re-entered. Reading the
OnCE Status Register is described in Section 2.3, “OnCE Status Register.”
7. When debug mode has been entered, read the return value in r3. Possible return values and their
meanings are discussed in the SSD user’s manual. Reading a GPR is explained in Section 2.9,
“GPR access.”
5.2.3 SetLock
After the flash memory has been initialized using the FlashInit function, the SetLock function should be
called as many times as required to unlock or lock the appropriate flash memory blocks. For the low and
mid blocks as well as the shadow block, the lock bits in both the primary and secondary lock registers must
be set appropriately. It is recommended that the shadow block be locked unless programming of the
shadow block is absolutely necessary. Erasing the shadow block without reprogramming the censorship
information prior to a reset will cause the device to be censored. The steps to call the SetLock driver are
listed below.
1. Set up r1 as the stack pointer.
2. Set up r3 to point to the SSD_CONFIG structure in internal SRAM.
3. Set up r4 with the lock indicator as documented in the SSD user’s manual.
4. Set up r5 with the lock state as documented in the SSD user’s manual.
5. Set up r6 with the correct password as documented in the SSD user’s manual.
6. Set the PC to the beginning of SetLock minus 0x4 and load the IR with a no-op.
7. Exit debug mode and begin execution of the driver.
8. Poll the OnCE Status Register to determine when debug mode has been re-entered.
9. When debug mode has been entered, read the return value in r3. Possible return values and their
meanings are discussed in the SSD user’s manual.
5.2.4 FlashErase
When the appropriate blocks have been locked or unlocked, then an erase of the unlocked blocks can be
performed. The steps to call the FlashErase driver are listed below.
1. Set up r1 as the stack pointer.
2. Set up r3 to point to the SSD_CONFIG structure in internal SRAM.
3. Set up r4 to indicate either the main array or shadow block to be erased as describes in the SSD
user’s manual. Erasing the shadow block without reprogramming the censorship control
information prior to a reset will result in the device being censored.
4. Set up r5 to select the low address array blocks to be erased as documented in the SSD user’s
manual.
5. Set up r6 to select the mid address array blocks to be erased as documented in the SSD user’s
manual.
6. Set up r7 to select the high address array blocks to be erased as documented in the SSD user’s
manual.
7. Set up r8 with the pointer to the call back function as documented in the SSD user’s manual.
8. Set the PC to the beginning of FlashErase minus 0x4 and load the IR with a no-op.
9. Exit debug mode and begin execution of the driver.
10. Poll the OnCE Status Register to determine when debug mode has been re-entered.
11. When debug mode has been entered, read the return value in r3. Possible return values and their
meanings are discussed in the SSD user’s manual.
5.2.5 FlashProgram
When flash memory blocks have been erased, they then can be programmed. To program the flash, the
internal SRAM should first be written with the data to be programmed in flash memory. Depending on the
size of the data buffer in internal SRAM and the size of the data to be programmed to flash, the
FlashProgram driver may need to be called multiple times. The steps to call the FlashProgram driver are
listed below.
1. Set up r1 as the stack pointer.
2. Set up r3 to point to the SSD_CONFIG structure in internal SRAM.
3. Set up r4 to point to the destination address to be programmed in flash memory. This address must
be aligned on a double word boundary.
4. Set up r5 to the size of the data in bytes to be programmed to flash memory. This size should be a
multiple of 8 and the combination of the destination address and size should be entirely contained
in the main array or shadow block.
5. Set up r6 to point to the source buffer of data in internal SRAM to be programmed to flash memory.
This address should be aligned on a word boundary.
6. Set up r7 with the pointer to the call back function as documented in the SSD user’s manual.
7. Set the PC to the beginning of FlashProgram minus 0x4 and load the IR with a no-op.
8. Exit debug mode and begin execution of the driver.
9. Poll the OnCE Status Register to determine when debug mode has been re-entered.
10. When debug mode has been entered, read the return value in r3. Possible return values and their
meanings are discussed in the SSD user’s manual.
• Nexus3 burst read, see Section 3.5, “Burst block memory read access.”
• MMU initialization, see Section 4.1, “Setting up the memory management unit.”
• Internal SRAM initialization, see Section 4.2, “Internal SRAM initialization.”
• FMPLL initialization, see Section 4.3, “FMPLL initialization.”
• S-record parser and loader.
• Debug and driver initialization, see Section 5.2.1, “Debug and driver initialization.”
• Flash initialization, see Section 5.2.2, “FlashInit.”
• Flash block lock initialization, see Section 5.2.3, “SetLock.”
• Flash erase, see Section 5.2.4, “FlashErase.”
• Flash program, see Section 5.2.5, “FlashProgram.”
6 References
For further information, please refer to the documents listed in Table 10.
Table 10. References
7 Revision history
Table 11. Changes made April 20121
Section Description
Appendix A
Demo calling basic SSD functions
This is a demo for the LC flash driver included in the flash driver. A similar example is provided in each
of the other Freescale flash drivers.
;*************************************************************************
;* (c) Copyright Freescale Semiconductor & STMicroelectronics Inc. 2011 *
; All Rights Reserved *
;*************************************************************************
;
;*************************************************************************
;* *
;* Standard Software Driver for C90lc(2) *
;* *
;* FILE NAME : demo.mac *
;* DESCRIPTION : This file shows how to call basic SSD functions. *
;* DATE : May 18, 2011 *
;* AUTHOR : FPT Team *
;* *
;* *
;*************************************************************************/
;
;******************************* CHANGES *********************************
; 0.1.0 05.18.2010 FPT Team Initial Version
;*************************************************************************/
;1. Demo with SSD in S-record format;
;
;2. Demo 8 S-record format SSD functions:
; FlashInit FlashInit.sx
; FlashErase FlashErase.sx
; BlankCheck BlankCheck.sx
; FlashProgram FlashProgram.sx
; ProgramVerify ProgramVerify.sx
; CheckSum CheckSum.sx
; GetLock GetLock.sx
; SetLock SetLock.sx
;
;3. RAM Mapping of SSD S-record demo
; Start Address End Address Size (Byte)
; ---------------------------------------------------------------------------
; FlashInit $40000000 $40000300-1 $300
; FlashErase $40000300 $40000A00-1 $700
; BlankCheck $40000A00 $40000D00-1 $300
; FlashProgram $40000D00 $40001B00-1 $E00
; ProgramVerify $40001B00 $40001E00-1 $300
; CheckSum $40001E00 $40002100-1 $300
; GetLock $40002100 $40002600-1 $500
; SetLock $40002600 $40002A00-1 $400
;
; Demo data $40004000 $40004200-1 $200
; Data buffer $40005000 $40005800-1 $800
; Stack $40007000 $40008000-1 $1000
;
; ***********************************************************************
; NULL callback
symbol NULL_CALLBACK $FFFFFFFF
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; variables used in demo
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; procedures for SSD functions
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; ===================== initialize SSD_CONFIG structure =========================
; FlashInit
; Pass input arguments
R3 pSSDConfig
; Set PC
PC Addr_FlashInit
; Run
go
;======================= GetLock primary for low address space===============================;
; Pass input arguments
R3 pSSDConfig
R4 LOCK_LOW_PRIMARY
R5 blkLockEnabled
R6 blkLockState
; Set PC
PC Addr_GetLock
; Run
go
; Set PC
PC Addr_SetLock
; Run
go
; Set PC
PC Addr_GetLock
; Run
go
; Set PC
PC Addr_SetLock
; Run
go
R4 LOCK_MID_PRIMARY
R5 blkLockEnabled
R6 blkLockState
; Set PC
PC Addr_GetLock
; Run
go
; Set PC
PC Addr_SetLock
; Run
go
; Set PC
PC Addr_GetLock
; Run
go
; Set PC
PC Addr_SetLock
; Run
go
;====================== FlashErase to erase low block 0, low block 1, mid block 0============;
; Pass input arguments
R3 pSSDConfig
R4 shadowFlag
R5 lowEnabledBlocks
R6 midEnabledBlocks
R7 highEnabledBlocks
R8 NULL_CALLBACK
; Set PC
PC Addr_FlashErase
; Run
go
;============================ BlankCheck for low block 0 and low block 1======================;
; Pass input arguments
R3 pSSDConfig
R4 $0
R5 $C000
R6 failAddress
R7 failData
R8 NULL_CALLBACK
; Set PC
PC Addr_BlankCheck
; Run
go
; Set PC
PC Addr_BlankCheck
; Run
go
; Set PC
PC Addr_FlashProgram
; Run
go
; Set PC
PC Addr_ProgramVerify
; Run
go
; Set PC
PC Addr_FlashProgram
; Run
go
; Set PC
PC Addr_ProgramVerify
; Run
go
; Set PC
PC Addr_CheckSum
; Run
go
; Set PC
PC Addr_CheckSum
; Run
go
;=============================END OF DEMO============================================;
Freescale, the Freescale logo, AltiVec, C-5, CodeTest, CodeWarrior, ColdFire, C-Ware,
Energy Efficient Solutions logo, Kinetis, mobileGT, PowerQUICC, Processor Expert,
QorIQ, Qorivva, StarCore, Symphony, and VortiQa are trademarks of Freescale
Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. Airfast, BeeKit, BeeStack, ColdFire+,
CoreNet, Flexis, MagniV, MXC, Platform in a Package, QorIQ Qonverge, QUICC
Engine, Ready Play, SafeAssure, SMARTMOS, TurboLink, Vybrid, and Xtrinsic are
trademarks of Freescale Semiconductor, Inc. All other product or service names are
the property of their respective owners. The Power Architecture and Power.org
word marks and the Power and Power.org logos and related marks are
trademarks and service marks licensed by Power.org.
© 2011 Freescale Semiconductor, Inc.