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

87 lines
2.2 KiB
Plaintext

; --------------------------------------------------------------------------------
; @Title: Serial FLASH Programming script for TI AM335x
; @Description:
; Serial FLASH(ST,25P64) is connected to McSPI_CH0
;
; SDRAM: 0x40300000
;
; before booting up
; SPI Tx Register : 0x48030138
; SPI Rx Register : 0x4803013C
; SPI CS Register : 0x4803012C
;
; @Author: jjeong
; @Copyright: (C) 1989-2022 Lauterbach GmbH, licensed for use with TRACE32(R) only
; @Chip: AM335*
; @Keywords: ST 25P64 flash spi
; --------------------------------------------------------------------------------
; $Id: am335x-spi.cmm 10516 2022-02-02 11:39:30Z bschroefel $
LOCAL &arg1
ENTRY &arg1
&arg1=STRing.UPpeR("&arg1") // for example "PREPAREONLY"
SYStem.CPU AM3359
TrOnchip.Set DABORT OFF
TrOnchip.Set PABORT OFF
TrOnchip.Set UNDEF OFF
SYStem.Option.ResBreak OFF
SYStem.Mode Go
WAIT 1.s
IF STATE.RUN()
Break.direct
PER.Set.simple C15:0x1 %Long 0xC50078 ;disable MMU & Cache
;wdog disable
Data.Set 0x44E35048 %LE %Long 0x0000AAAA
Data.Set 0x44E35048 %LE %Long 0x00005555
;configure the SPI pin mux registers
Data.Set 0x44E0004C %LE %Long 0x2
Data.Set 0x44E10950 %LE %Long 0x20
Data.Set 0x44E10954 %LE %Long 0x30
Data.Set 0x44E10958 %LE %Long 0x20
Data.Set 0x44E1095C %LE %Long 0x30
;configure the SPI registers
Data.Set 0x48030110 %LE %Long 0x2
Data.Set 0x48030110 %LE %Long 0x15
Data.Set 0x48030120 %LE %Long 0x1
Data.Set 0x48030128 %LE %Long 0x1
Data.Set 0x4803012C %LE %Long 0x1A0103C4 ; MCSPI_CH0 CONF
Data.Set 0x48030134 %LE %Long 0x1 ; Enable McSPI Channel 0
//FLASFILE.CONFIG <Tx Reg> <Rx Reg> <CS Reg, McSPI_CH0CONF>
FLASHFILE.CONFIG 0x48030138 0x4803013C 0x4803012C
//FLASHFILE.TARGET <Code Range> <Data Range> <Algorithm File>
FLASHFILE.TARGET 0x40300000++0x1FFF 0x40302000++0x1FFF ~~/demo/arm/flash/byte/spi64_mcspi.bin /KEEP
FLASHFILE.GETID ; Read FLASH Manufacture and Device ID
//End of the test prepareonly
IF "&arg1"=="PREPAREONLY"
ENDDO
//FLASHFILE.ERASE 0x0++0xFFFFF
//FLASHFILE.LOAD uboot.bin 0x0 ; Write uboot.bin to 0x0 on the serial flash
//FLASHFILE.LOAD uboot.bin 0x0 /ComPare ; Verify
FLASHFILE.DUMP 0x0 ; Read out from the serial flash
ENDDO