Files
Gen4_R-Car_Trace32/2_Trunk/demo/arm/flash/ls1043-nand2g08.cmm
2025-10-14 09:52:32 +09:00

104 lines
2.6 KiB
Plaintext

; --------------------------------------------------------------------------------
; @Title: Freescale QorIQ LS1043A RDB NAND FLASH Programming Template
; @Description:
; NAND FLASH(MT29F4G08) is connected to CS0
; The board RCW_SRC[0:8] selects : 1_0000_0110: 8-bit NAND flash, 2 KB page,
; 64 pages/block
; The RCW_SRC field (9 bits) is spread over SW4[1-8] and SW5[1].
;
; Internal SRAM : 0x10001000
; IFC base : 0x01530000
; IFC_SRAM : 0x7e800000
; CS# : 0
;
; @Author: jjeong
; @Copyright: (C) 1989-2022 Lauterbach GmbH, licensed for use with TRACE32(R) only
; @Chip: LS1043A
; @Keywords: Flash NAND
; --------------------------------------------------------------------------------
; $Id: ls1043-nand2g08.cmm 10516 2022-02-02 11:39:30Z bschroefel $
LOCAL &arg1
ENTRY &arg1
&arg1=STRing.UPpeR("&arg1") // for example "PREPAREONLY"
&BASE=A:0x1530000
SYStem.RESet
SYStem.CPU LS1043A
CORE.NUMber 1.
SYStem.Mode Attach
IF STATE.RUN()
Break.direct
Register.Set M 0x5 ;EL1h
GOSUB READ_ID
LOCAL &pdd
&pdd=OS.PresentDemoDirectory()
Break.RESet
FLASHFILE.RESet
; FLASHFILE.CONFIG <IFC base address> <0x0> <NFC buffer RAM address> <chip select>
FLASHFILE.CONFIG &BASE 0x0 A:0x7E800000 0x0
; FLASHFILE.TARGET <code_range> <data_range> <algorithm file>
FLASHFILE.TARGET 0x10001000++0x1FFF 0x10004000++0x3FFF &pdd/flash/byte/nand2g08_lsifc.bin /KEEP /STACKSIZE 0x200
; Read FLASH Manufacturer and Device ID
FLASHFILE.GETID
//End of the test prepareonly
IF "&arg1"=="PREPAREONLY"
ENDDO
//Read FLASH
FLASHFILE.DUMP 0x0
//Erase FLASH
; FLASHFILE.ERASE 0x0--0xFFFFF /EraseBadBlocks
//Write FLASH
; FLASHFILE.LOAD * 0x0 /WriteBadBlocks
; FLASHFILE.LOAD * 0x0 /WriteBadBlocks /ComPare ;verify
ENDDO
READ_ID:
SCREEN.OFF
Data.Set &BASE+0x1014 %BE %Long 0x90000000 ; FCR0 0x90
Data.Set &BASE+0x1018 %BE %Long 0x00000000 ; FCR1
Data.Set &BASE+0x1110 %BE %Long 0x46084000 ; FIR0
Data.Set &BASE+0x1114 %BE %Long 0x0 ; FIR1
Data.Set &BASE+0x1118 %BE %Long 0x0 ; FIR2
Data.Set &BASE+0x115C %BE %Long 0x00000000 ; CS0 select
;Data.Set &BASE+0x115C %BE %Long 0x04000000 ; CS1 select
Data.Set &BASE+0x1108 %BE %Long 0x00000010 ; Byte count
Data.Set &BASE+0x116C %BE %Long 0x00000000 ; state clear
Data.Set &BASE+0x103C %BE %Long 0x00000000 ; IFC_ROW0
Data.Set &BASE+0x1044 %BE %Long 0x00000000 ; IFC_COL0
Data.Set &BASE+0x1164 %BE %Long 0x80000000 ; IFC operation start
&temp=Data.Long(A:0x7e800000)
PRINT "1st: 0x" &temp&0xFF " (manufacture id)"
PRINT "2nd: 0x" (&temp>>8.)&0xFF " (device id)"
PRINT "3rd: 0x" (&temp>>16.)&0xFF
PRINT "4th: 0x" (&temp>>24.)&0xFF
SCREEN.ON
RETURN