176 lines
5.4 KiB
Plaintext
176 lines
5.4 KiB
Plaintext
; --------------------------------------------------------------------------------
|
|
; @Title: eMMC flash script for TCC8030-CR5 on TCC803x EVB (RAM)
|
|
; @Description:
|
|
; eMMC(SK Hynix, H26M41208HPRA)is connected to the SD/SDIO/MMC controller
|
|
;
|
|
; SRAM: 0x6000000
|
|
; SD/MMC Host: 0x16440000
|
|
;
|
|
; Prerequisites:
|
|
; * Connect the DC 12V/10A power adapter to the DC-JACK (J7) on main board.
|
|
; * Connect Debug Cable to JTAG header (J10D1) on TCC8030 CPU board.
|
|
; * eMMC Boot : BM[3:0] ==0101b (GPIO_SD0 Group, 0110b == GPIO_SD1 Group)
|
|
; * The Slide Switched(JSW1/2/3/4/) are used to select the boot modes(BM)
|
|
;
|
|
; @Keywords: ARM, Cortex-R5, eMMC
|
|
; @Author: PEG, JIM
|
|
; @Board: TCC803x EVB
|
|
; @Chip: TCC8030
|
|
; @Copyright: (C) 1989-2023 Lauterbach GmbH, licensed for use with TRACE32(R) only
|
|
; --------------------------------------------------------------------------------
|
|
; $Id: tcc8030-cr5-emmc.cmm 12413 2023-08-21 02:19:49Z jjeong $
|
|
|
|
WinCLEAR
|
|
&MMC_BASE=A:0x16440000
|
|
|
|
PRIVATE ¶meters
|
|
ENTRY %LINE ¶meters
|
|
|
|
PRIVATE ¶m_prepareonly
|
|
¶meters=STRing.UPpeR("¶meters")
|
|
¶m_prepareonly=(STRing.SCAN("¶meters","PREPAREONLY",0)!=-1)
|
|
|
|
; --------------------------------------------------------------------------------
|
|
; initialize and start the debugger
|
|
RESet
|
|
SYStem.CPU TCC8030-CR5
|
|
SYStem.MemAccess DAP
|
|
SYStem.Option.EnReset OFF
|
|
GOSUB ConfigureDebugPort
|
|
SYStem.Mode Attach
|
|
|
|
IF STATE.RUN()
|
|
Break
|
|
|
|
Data.Set C15:0x1 %Long Data.Long(C15:0x1)&~1 ; disable MPU
|
|
|
|
GOSUB DisableWatchdog
|
|
|
|
; --------------------------------------------------------------------------------
|
|
; Config SDHC
|
|
; --------------------------------------------------------------------------------
|
|
Data.Set A:&MMC_BASE+0x34 %LE %Long 0x37ff7fff ; Normal Interrupt Status Enable
|
|
Data.Set A:&MMC_BASE+0x38 %LE %Long 0x37ff7fff ; Normal Interrupt Event Enable
|
|
Data.Set A:&MMC_BASE+0x04 %LE %Long 0x00010200 ; blk size,cnt
|
|
Data.Set A:&MMC_BASE+0x28 %LE %Long 0xf00 ; bus width, endian
|
|
Data.Set A:&MMC_BASE+0x2C %LE %Long 0xe4007 ; 400KHz clk
|
|
|
|
GOSUB READ_ID_TEST
|
|
|
|
FLASHFILE.RESet
|
|
|
|
//FLASHFILE.CONFIG <MMC Controller Base> 0x0 0x0
|
|
FLASHFILE.CONFIG A:&MMC_BASE 0x0 0x0
|
|
|
|
//FLASHFILE.target <Code_range> <Data_range> <Algorithm file>
|
|
FLASHFILE.TARGET A:0x6000000++0x1FFF A:0x6002000++0x2FFF ~~/demo/arm/flash/byte/emmc_imx6.bin /KEEP ; for eMMC flash
|
|
|
|
;Data.Set A:&MMC_BASE+0x2C %LE %Long 0xe4007 ; set the 400kHz bofore the "flashfile.getid" command
|
|
FLASHFILE.GETID
|
|
|
|
Data.Set A:&MMC_BASE+0x2C %LE %Long 0xe0207 ; 12.Mhz
|
|
FLASHFILE.GETEXTCSD
|
|
|
|
//When you access to the other partition on the flash
|
|
; FLASHFILE.SETEXTCSD 179. 0x48 ; access: partition null
|
|
; FLASHFILE.SETEXTCSD 179. 0x49 ; access: partition boot 1
|
|
; FLASHFILE.SETEXTCSD 179. 0x4A ; access: partition boot 2
|
|
|
|
FLASHFILE.DUMP 0x0 ; Read flash
|
|
;FLASHFILE.ERASE 0x0--0xFFFFF ; Erase flash
|
|
;FLASHFILE.LOAD * 0x0 ; Write flash
|
|
|
|
ENDDO
|
|
|
|
READ_ID_TEST:
|
|
(
|
|
//MMC interface, not SD(HC)
|
|
//CMD0
|
|
RePeaT 2.
|
|
(
|
|
Data.Set A:&MMC_BASE+0x30 %Long 0xFFFFFFFF ;clear status
|
|
Data.Set A:&MMC_BASE+0x8 %Long 0x0 ;arg
|
|
Data.Set A:&MMC_BASE+0xc %Long 0x0 ;cmd
|
|
WAIT 10.ms
|
|
)
|
|
|
|
//CMD1
|
|
RePeaT 10.
|
|
(
|
|
Data.Set A:&MMC_BASE+0x30 %Long 0xFFFFFFFF ;clear status
|
|
Data.Set A:&MMC_BASE+0x8 %Long 0x40FF8000 ;arg
|
|
Data.Set A:&MMC_BASE+0xc %Long 0x01020000 ;cmd1
|
|
WAIT 100.ms
|
|
&resp=Data.Long(A:&MMC_BASE+0x10)
|
|
//print "CMD1 resp: 0x" &resp
|
|
IF (&resp&0x80000000)==0x80000000
|
|
(
|
|
GOTO jump_cmd2
|
|
)
|
|
)
|
|
|
|
PRINT "CMD1 fail"
|
|
ENDDO
|
|
|
|
jump_cmd2:
|
|
//CMD2
|
|
Data.Set A:&MMC_BASE+0x30 %Long 0xFFFFFFFF ;clear status
|
|
Data.Set A:&MMC_BASE+0x8 %Long 0x0 ;arg
|
|
Data.Set A:&MMC_BASE+0xc %Long 0x02010000 ;cmd2
|
|
WAIT 10.ms
|
|
|
|
//CMD3
|
|
Data.Set A:&MMC_BASE+0x30 %Long 0xFFFFFFFF ;clear status
|
|
Data.Set A:&MMC_BASE+0x8 %Long 0x00010000 ; arg, MMC RCA is (0x0001<<16.)
|
|
Data.Set A:&MMC_BASE+0xc %Long 0x03020000 ;cmd3
|
|
WAIT 10.ms
|
|
|
|
//CMD10
|
|
Data.Set A:&MMC_BASE+0x30 %Long 0xFFFFFFFF ;clear status
|
|
Data.Set A:&MMC_BASE+0x8 %Long 0x00010000 ; arg, MMC RCA is (0x0001<<16.)
|
|
Data.Set A:&MMC_BASE+0xc %Long 0x0A010000 ;cmd10
|
|
WAIT 10.ms
|
|
|
|
//Response2
|
|
PRINT "CID register"
|
|
PRINT "[127:104] 0x" Data.Long(A:&MMC_BASE+0x1c)
|
|
PRINT "[103:72] 0x" Data.Long(A:&MMC_BASE+0x18)
|
|
PRINT "[71:40] 0x" Data.Long(A:&MMC_BASE+0x14)
|
|
PRINT "[39:8] 0x" Data.Long(A:&MMC_BASE+0x10)
|
|
|
|
RETURN
|
|
)
|
|
|
|
ConfigureDebugPort:
|
|
(
|
|
; configure debug port for TCC8050-CR5 (not needed after power-on-reset)
|
|
; works if it was configured for debugging CA72 or CA53
|
|
; power-on-reset is required after debugging the CM4, STRG, HSM
|
|
SYStem.CONFIG.AHBACCESSPORT 2
|
|
SYStem.Mode Prepare
|
|
IF Data.Long(EAHB:0x80)!=0x31C03DB9 ; check if TCC8050-CR5 is not selected
|
|
(
|
|
ON ERROR CONTinue ; ignore error because communication will break down
|
|
Data.Set EAHB:0x80 %Long 0x1 ; DEBUG_SEL, configure JTAG interface for TCC8050-CR5
|
|
Data.Set EAHB:0x80 %Long 0x0 ; communication will break down here
|
|
SYStem.Mode Down
|
|
ON ERROR DEFault ; normal error handling
|
|
)
|
|
SYStem.Mode Prepare
|
|
IF Data.Long(EAHB:0x80)!=0x31C03DB9 ; check if TCC8050-CR5 is not selected
|
|
(
|
|
PRINT "Power-on-reset is required, then re-run this script!"
|
|
ENDDO
|
|
)
|
|
SYStem.CONFIG.AHBACCESSPORT 0
|
|
RETURN
|
|
)
|
|
|
|
DisableWatchdog:
|
|
(
|
|
; disable the watchdog
|
|
Data.Set EAHB:0x1b934014 %Long 0x8030ace5 ; WDT_WR_PW (MICOM)
|
|
Data.Set EAHB:0x1b934000 %Long 0x00000000 ; WDT_EN (MICOM)
|
|
RETURN
|
|
)
|