108 lines
2.2 KiB
Plaintext
108 lines
2.2 KiB
Plaintext
; @Title: RZ/G1x Quad Serial Peripheral Interface FLASH Program script
|
|
; @Description:
|
|
; Serial FLASH(Micron, MT25QL02GCBB) is connected
|
|
;
|
|
; SRAM: 0xE63A0000
|
|
; SPI(controller) Base: 0xE6B10000
|
|
;
|
|
; @Author: jjeong
|
|
; @Copyright: (C) 1989-2022 Lauterbach GmbH, licensed for use with TRACE32(R) only
|
|
; @Chip: R8A77430
|
|
; @Keywords: Flash SPI
|
|
; $Id: rzg1x-qspi.cmm 10516 2022-02-02 11:39:30Z bschroefel $
|
|
|
|
LOCAL &arg1
|
|
ENTRY &arg1
|
|
&arg1=STRing.UPpeR("&arg1") // for example "PREPAREONLY"
|
|
|
|
|
|
&QSPI_BASE=0xE6B10000
|
|
&pfc_base=0xE6060000
|
|
&GPSR1=&pfc_base+0x0008
|
|
&GPSR2=&pfc_base+0x000C
|
|
&IPSR2=&pfc_base+0x0028
|
|
&IPSR3=&pfc_base+0x002C
|
|
&IPSR4=&pfc_base+0x0030
|
|
|
|
RESet
|
|
SYStem.CPU R8A77430 ; R8A77450 respectively
|
|
CORE.ASSIGN 1
|
|
TrOnchip.Set DABORT OFF
|
|
TrOnchip.Set PABORT OFF
|
|
TrOnchip.Set UNDEF OFF
|
|
; SYStem.Option PWRCHECKFIX ON ; use OFF in case of CA7 is active
|
|
SYStem.Mode Up
|
|
|
|
GOSUB QSPI_INIT
|
|
|
|
FLASHFILE.RESet
|
|
|
|
//FLASHFILE.CONFIG <SPI Base AddRESs> ,, ,,
|
|
FLASHFILE.CONFIG &QSPI_BASE
|
|
|
|
//FLASHFILE.TARGET <code range> <data range> <Algorithm file>
|
|
FLASHFILE.TARGET 0xE63A0000++0x1FFF 0xE63A2000++0x21FF ~~/demo/arm/flash/byte/spi64_rcarh2.bin /KEEP
|
|
|
|
//Read FLASH Manufacture and Device ID
|
|
FLASHFILE.GETID
|
|
|
|
//End of the test prepareonly
|
|
IF "&arg1"=="PREPAREONLY"
|
|
ENDDO
|
|
|
|
|
|
//Read FLASH
|
|
FLASHFILE.DUMP 0x0
|
|
|
|
//Erase FLASH
|
|
; FLASHFILE.ERASE 0x0--0xFFFFFF
|
|
|
|
//Write FLASH
|
|
; FLASHFILE.LOAD * 0x0
|
|
; FLASHFILE.LOAD * 0x0 /ComPare ;verify
|
|
|
|
|
|
ENDDO
|
|
|
|
QSPI_INIT:
|
|
|
|
//GP1_4 : SPCLK
|
|
//GP1_5 : MOSI
|
|
//GP1_6 : MISO
|
|
//GP1_7 : IO2
|
|
//GP1_8 : IO3
|
|
//GP1_9 : SSL
|
|
|
|
GOSUB WRITE_SET &GPSR1 0x000003F0
|
|
GOSUB WRITE_SET &IPSR2 0x000244C8
|
|
|
|
Data.Set AZSD:&QSPI_BASE %LE 0x48
|
|
Data.Set AZSD:(&QSPI_BASE+0x2) %LE 0x6
|
|
Data.Set AZSD:(&QSPI_BASE+0x0A) %LE 0x1
|
|
Data.Set AZSD:(&QSPI_BASE+0x10) %Word 0xe084
|
|
|
|
RETURN
|
|
|
|
WRITE_SET:
|
|
ENTRY &addr &data
|
|
¬_data=~(&data)
|
|
Data.Set &pfc_base %Long ¬_data
|
|
Data.Set &addr %Long &data
|
|
RETURN
|
|
|
|
WRITE_AND:
|
|
ENTRY &addr &data
|
|
&data=((&data)&(Data.Long(A:&addr)))
|
|
¬_data=~(&data)
|
|
Data.Set &pfc_base %Long ¬_data
|
|
Data.Set &addr %Long &data
|
|
RETURN
|
|
|
|
WRITE_OR:
|
|
ENTRY &addr &data
|
|
&data=((&data)|(Data.Long(A:&addr)))
|
|
¬_data=~(&data)
|
|
Data.Set &pfc_base %Long ¬_data
|
|
Data.Set &addr %Long &data
|
|
RETURN
|