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

99 lines
2.5 KiB
Plaintext

; --------------------------------------------------------------------------------
; @Title: LSI AXM5516 Serial FLASH Programming Script
; @Description:
; Serial FLASH(SPANSION, 25F64) is connected the SSP_CS0(Synchronous Serial Port)
;
; SDRAM: 0x100000
; Serial FLASH Controller base addr: 0x90088000
;
; @Author: jjeong
; @Copyright: (C) 1989-2022 Lauterbach GmbH, licensed for use with TRACE32(R) only
; @Chip: AXM5516
; @Keywords: SPANSION 25F64 FLASH SPI
; --------------------------------------------------------------------------------
; $Id: axm5516-spi64.cmm 10516 2022-02-02 11:39:30Z bschroefel $
LOCAL &arg1
ENTRY &arg1
&arg1=STRing.UPpeR("&arg1") // for example "PREPAREONLY"
&SSP_BASE=0x90088000 ; or 0x10088000 , it depends on the booting
PER.Set.simple ZSD:&SSP_BASE %Long 0x7
PER.Set.simple ZSD:&SSP_BASE+0x4 %Long 0x2
PER.Set.simple ZSD:&SSP_BASE+0x10 %Long 0x32
flush_loop:
&reg_data=Data.Long(ZSD:&SSP_BASE+0xC)&0x4
IF &reg_data==0x0
(
GOTO flush_end
)
&dummy=Data.Long(ZSD:&SSP_BASE+0x8)
GOTO flush_loop
flush_end:
GOSUB READ_ID_TEST
Break.RESet
FLASHFILE.RESet
//FLASFILE.CONFIG <Tx Reg> <Rx Reg> <CS Reg> <CS Num>
FLASHFILE.CONFIG (&SSP_BASE+0x8) (&SSP_BASE+0x8) (&SSP_BASE+0x30) 0x0
FLASHFILE.TARGET 0x100000++0x3FFF 0x104000++0x3FFF ~~/demo/arm/flash/byte/spi64_axx5500.bin /KEEP
//Read FLASH Manufacture and Device ID
FLASHFILE.GETID
//End of the test prepareonly
IF "&arg1"=="PREPAREONLY"
ENDDO
//Dump window for Serial FLASH
;FLASHFILE.DUMP 0x0
;FLASHFILE.UNLOCK 0x0--0xFFFFF
//Erase Serial FLASH
;FLASHFILE.ERASE 0x0--0xFFFFF
//Write
;FLASHFILE.LOAD * 0x0
;FLASHFILE.LOAD * 0x0 /ComPare ;verify
ENDDO
READ_ID_TEST:
SCREEN.OFF
Data.Set ZSD:(&SSP_BASE+0x030) %LE %Long 0x1E ;Enable SPI_CS_LOW
PER.Set.simple ZSD:&SSP_BASE+0x8 %Long 0x00F0
&dummy=Data.Long(ZSD:&SSP_BASE+0x8)
Data.Set ZSD:(&SSP_BASE+0x030) %LE %Long 0x1F ;Enable SPI_CS_HIGH
Data.Set ZSD:(&SSP_BASE+0x030) %LE %Long 0x1E ;Enable SPI_CS_LOW
PER.Set.simple ZSD:&SSP_BASE+0x8 %Long 0x009F
PRINT "1st : 0x" Data.Long(ZSD:&SSP_BASE+0x8)
PER.Set.simple ZSD:&SSP_BASE+0x8 %Long 0x0000
PRINT "2nd : 0x" Data.Long(ZSD:&SSP_BASE+0x8) " (manufacture id)"
PER.Set.simple ZSD:&SSP_BASE+0x8 %Long 0x0000
PRINT "3rd : 0x" Data.Long(ZSD:&SSP_BASE+0x8) " (device id)"
PER.Set.simple ZSD:&SSP_BASE+0x8 %Long 0x0000
PRINT "4th : 0x" Data.Long(ZSD:&SSP_BASE+0x8)
Data.Set ZSD:(&SSP_BASE+0x030) %LE %Long 0x1F ;Enable SPI_CS_HIGH
SCREEN.ON
RETURN