173 lines
5.4 KiB
Plaintext
173 lines
5.4 KiB
Plaintext
; --------------------------------------------------------------------------------
|
|
; @Title: Serial flash script for TCC8050-CA72 on TCC805x EVB (RAM)
|
|
; @Description:
|
|
; MX25L256 is connected to the SFMC controller
|
|
;
|
|
; SRAM: 0xC0001000
|
|
; SFMC: 0x1B9100000
|
|
; SFMC memory mapped ADDRESS: 0xD0000000
|
|
;
|
|
; Prerequisites:
|
|
; * Connect the DC 12V/10A power adapter to the DC-JACK (J12) on main board.
|
|
; * Connect Debug Cable to JTAG header (J10D1) on TCC8050_53 CPU board.
|
|
; * Use board with Android SDK firmware and default S-NOR and eMMC boot mode.
|
|
; * After power-on(-reset) let the board 30s boot before you run this script.
|
|
;
|
|
; @Keywords: ARM, Cortex-A72, SPI
|
|
; @Author: PEG, JIM
|
|
; @Board: TCC805x EVB
|
|
; @Chip: TCC8050
|
|
; @Copyright: (C) 1989-2022 Lauterbach GmbH, licensed for use with TRACE32(R) only
|
|
; --------------------------------------------------------------------------------
|
|
; $Id: tcc8050-ca72-spi.cmm 11733 2023-01-16 08:55:12Z bschroefel $
|
|
|
|
PRIVATE ¶meters
|
|
ENTRY %LINE ¶meters
|
|
|
|
PRIVATE ¶m_prepareonly
|
|
¶meters=STRing.UPpeR("¶meters")
|
|
¶m_prepareonly=(STRing.SCAN("¶meters","PREPAREONLY",0)!=-1)
|
|
|
|
WinCLEAR
|
|
|
|
; --------------------------------------------------------------------------------
|
|
; initialize and start the debugger
|
|
RESet
|
|
SYStem.CPU TCC8050-CA72
|
|
CORE.ASSIGN 1.
|
|
SYStem.Option EnReset OFF
|
|
SYStem.MemAccess DAP
|
|
Trace.DISable
|
|
GOSUB ConfigureDebugPort
|
|
SYStem.Mode Attach
|
|
GOSUB DisableWatchdog
|
|
Break
|
|
|
|
Data.Set SPR:0x30100 %Long Data.Long(SPR:0x30100)&~1 ; disable MMU
|
|
|
|
; ------------------------------------------------------------------------------
|
|
; Flash Pin Mux Configuration
|
|
|
|
; ------------------------------------------------------------------------------
|
|
; Flash Controller Init
|
|
;GOSUB SPI_Init
|
|
;GOSUB SET_SPI_ADDRMODE_3B
|
|
;GOSUB SET_SPI_ADDRMODE_4B
|
|
|
|
; ------------------------------------------------------------------------------
|
|
; Flash Read ID Test
|
|
;GOSUB READ_ID_TEST
|
|
|
|
; ------------------------------------------------------------------------------
|
|
; Init SRAM (16KB) for the flash algorithm
|
|
Data.Test EA:0xC0001000++0x3FFF
|
|
|
|
; ------------------------------------------------------------------------------
|
|
; Flash declaration
|
|
Break.RESet
|
|
|
|
FLASH.RESet
|
|
FLASH.Create 0xD0000000++0x01FFFFFF 0x10000 TARGET Byte
|
|
FLASH.TARGET 0xC0001000 E:0xC0003000 0x2000 ~~/demo/arm/flash/byte/snor_tcc80xx.bin /stacksize 0x200 /DUALPORT
|
|
|
|
; Flash script ends here if called with parameter PREPAREONLY
|
|
IF ¶m_prepareonly
|
|
ENDDO PREPAREDONE
|
|
|
|
; ------------------------------------------------------------------------------
|
|
; Flash programming example
|
|
|
|
DIALOG.YESNO "Program flash memory?"
|
|
LOCAL &progflash
|
|
ENTRY &progflash
|
|
IF &progflash
|
|
(
|
|
FLASH.ReProgram.ALL
|
|
Data.LOAD.auto *
|
|
;Data.LOAD..Binary * 0xD0000000
|
|
FLASH.ReProgram.off
|
|
PRINT "Please power-cycle the board after flash program is complete"
|
|
)
|
|
|
|
ENDDO
|
|
|
|
READ_ID_TEST:
|
|
(
|
|
&offset=Data.Long(A:0x1B91001C) ;get the manual base address
|
|
|
|
Data.Set A:(0x1B910000+&offset)+0x0 %Long 0x8400009F
|
|
Data.Set A:(0x1B910000+&offset)+0x4 %Long 0x20004000|((&offset-0x800+0x10)>>2)
|
|
Data.Set A:(0x1B910000+&offset)+0x8 %Long 0xF4000000
|
|
|
|
Data.Set SD:0x0:0x1B91001C %LE %Long &offset // Set Manual Addr
|
|
Data.Set SD:0x0:0x1B910010 %LE %Long 0x00000001 // CMD manual RUN
|
|
|
|
WAIT 100.ms
|
|
|
|
&read_data=Data.Long(A:(0x1B910000+&offset+0x10))
|
|
|
|
PRINT "Read 1st: 0x" (&read_data)&0xFF " (Manufacturer)"
|
|
PRINT "Read 2nd: 0x" (&read_data>>8.)&0xFF " (Device ID)"
|
|
PRINT "Read 3rd: 0x" (&read_data>>16.)&0xFF " (Device ID)"
|
|
PRINT "Read 4th: 0x" (&read_data>>24.)&0xFF
|
|
|
|
RETURN
|
|
)
|
|
|
|
SET_SPI_ADDRMODE_3B:
|
|
(
|
|
Data.Set A:0x1B910800 %LE %Long 0x840000EB
|
|
Data.Set A:0x1B910804 %LE %Long 0x4A000001
|
|
Data.Set A:0x1B910808 %LE %Long 0x86000000
|
|
Data.Set A:0x1B91080C %LE %Long 0x46002000
|
|
Data.Set A:0x1B910810 %LE %Long 0x2A000000
|
|
Data.Set A:0x1B910814 %LE %Long 0xF4000000
|
|
RETURN
|
|
)
|
|
|
|
SET_SPI_ADDRMODE_4B:
|
|
(
|
|
//4Byte read
|
|
Data.Set A:0x1B910800 %LE %Long 0x840000EC ; 4Byte read cmd
|
|
Data.Set A:0x1B910804 %LE %Long 0x4a000000 ; write AHB address to Serial NOR (4bytea address)
|
|
Data.Set A:0x1B910808 %LE %Long 0x46003000 ; dummy cycles (3*8)/4qpi == 6 cycles
|
|
Data.Set A:0x1B91080C %LE %Long 0x2A000000 ; read out ahb quad
|
|
Data.Set A:0x1B910810 %LE %Long 0xF4000000 ; stop
|
|
RETURN
|
|
)
|
|
|
|
ConfigureDebugPort:
|
|
(
|
|
; configure debug port for TCC8050-CA72
|
|
; not needed if it was configured for debugging CA53
|
|
; works if it was configured for debugging CR5 (default after power-on-reset)
|
|
; 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 selected
|
|
(
|
|
ON ERROR CONTinue ; ignore error because communication will break down
|
|
Data.Set EAHB:0x4 %Long 0x1 ; DEBUG_SEL, configure JTAG interface for TCC8050-CA53
|
|
SYStem.MODE Down ; communication will break down on the command before
|
|
ON ERROR DEFault ; normal error handling
|
|
)
|
|
SYStem.MODE Prepare
|
|
IF Data.Long(EAHB:0x0)==0 ; check if TCC8050-CA72 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:0x17010000 %Long 0 ; WDT_EN (CPU_WDT0)
|
|
Data.Set EAHB:0x1b934014 %Long 0x5AFEACE5 ; WDT_WR_PW (MICOM)
|
|
Data.Set EAHB:0x1b934000 %Long 0x00000000 ; WDT_EN (MICOM)
|
|
RETURN
|
|
)
|
|
|