235 lines
6.7 KiB
Plaintext
235 lines
6.7 KiB
Plaintext
; --------------------------------------------------------------------------------
|
|
; @Title: Flash declaration for Infineon XMC7000 series internal flash.
|
|
; @Description:
|
|
; Script arguments:
|
|
; DO xmc7000 [PREPAREONLY] [CPU=<cpu>] [DUALPORT=<0|1>] [FIRMWARERAM]
|
|
; PREPAREONLY only declares flash but does not execute flash programming
|
|
; CPU=<cpu> selects CPU derivative <cpu>
|
|
; DUALPORT=<0|1> use dual port memory access, default 1
|
|
;
|
|
; Example:
|
|
; DO ~~/demo/arm/flash/xmc7000 PREPAREONLY
|
|
; Note:
|
|
; This file must NOT be modified.
|
|
; This file is intended to stay within TRACE32 installation.
|
|
; Usage examples are available in the ~~/demo/arm/hardware/... subdirectories.
|
|
;
|
|
; List of XMC7000 derivatives and their configuration:
|
|
;
|
|
; CPU-Type Code Flash Work Flash SRAM
|
|
; [Byte] [Byte] [Byte]
|
|
; --------------------------------------------------------------------------------
|
|
; XMC7100-*K1* 0x110000 0x20000 0x30000
|
|
; XMC7100-*K2* 0x210000 0x20000 0x60000
|
|
; XMC7100-*K4* 0x410000 0x40000 0xC0000
|
|
; XMC7100-*K8* 0x830000 0x40000 0x100000
|
|
;
|
|
; @Author: STK
|
|
; @Chip: XMC7*
|
|
; @Copyright: (C) 1989-2022 Lauterbach GmbH, licensed for use with TRACE32(R) only
|
|
; --------------------------------------------------------------------------------
|
|
; $Id: xmc7000.cmm 11736 2023-01-17 13:24:22Z skrausse $
|
|
|
|
LOCAL ¶meters ¶m_prepareonly ¶m_cpu ¶m_dualport ¶m_firmwareram
|
|
ENTRY %LINE ¶meters
|
|
¶m_prepareonly=(STRing.SCAN(STRing.UPpeR("¶meters"),"PREPAREONLY",0)!=-1)
|
|
¶m_cpu=STRing.SCANAndExtract(STRing.UPpeR("¶meters"),"CPU=","")
|
|
¶m_dualport=STRing.SCANAndExtract("¶meters","DUALPORT=","1")
|
|
|
|
; ------------------------------------------------------------------------------
|
|
; Prerequisites:
|
|
IF CPUIS("TRAVEOII*")
|
|
(
|
|
DIALOG.OK "Please select the appropriate CPU."
|
|
END
|
|
)
|
|
|
|
; ------------------------------------------------------------------------------
|
|
; Initialize and start the debugger
|
|
|
|
IF !SYStem.Up()
|
|
(
|
|
SYStem.RESet
|
|
|
|
IF "¶m_cpu"!=""
|
|
SYStem.CPU ¶m_cpu
|
|
|
|
IF !CPUIS("XMC7*")
|
|
SYStem.CPU XMC7*
|
|
|
|
IF CABLE.TWOWIRE()
|
|
SYStem.CONFIG DEBUGPORTTYPE SWD
|
|
ELSE
|
|
SYStem.CONFIG DEBUGPORTTYPE JTAG
|
|
|
|
SYStem.JtagClock 10MHz
|
|
|
|
(
|
|
; assert reset line and do another debugger based reset
|
|
; -> M0+ should stop in BootROM/Supervisory Flash
|
|
SYStem.Option EnReset ON
|
|
SYStem.Option WaitIDCODE ON
|
|
SYStem.Option CoreSightRESet ON
|
|
)
|
|
|
|
SYStem.Up
|
|
SYStem.Option CypressACQuire OFF
|
|
|
|
GOSUB WatchdogDisable
|
|
)
|
|
|
|
; ------------------------------------------------------------------------------
|
|
; Flash declaration
|
|
FLASH.RESet
|
|
GOSUB FlashDeclaration
|
|
|
|
;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 *
|
|
FLASH.ReProgram OFF
|
|
|
|
; Reset device
|
|
SYStem.Down
|
|
SYStem.Up
|
|
)
|
|
|
|
ENDDO
|
|
|
|
; ------------------------------------------------------------------------------
|
|
; Subroutines
|
|
|
|
WatchdogDisable: ;()
|
|
(
|
|
|
|
)
|
|
|
|
; --------------------------------------------------------------------------------
|
|
; Flash declaration depending on selected CPU
|
|
;
|
|
; Please do NOT modify the TRACE32 flash declaration.
|
|
;
|
|
; Modifications can result in unpredictable behavior.
|
|
; Please contact support@lauterbach.com for any changes.
|
|
FlashDeclaration:
|
|
(
|
|
PRIVATE &nMainCodeLargeSectors &nMainCodeSmallSectors
|
|
PRIVATE &nWorkFlashLargeSectors &nWorkFlashSmallSectors
|
|
PRIVATE &nSRamBaseAddress
|
|
|
|
&nMainCodeLargeSectors=0.
|
|
&nMainCodeSmallSectors=0.
|
|
&nWorkFlashLargeSectors=0.
|
|
&nWorkFlashSmallSectors=0.
|
|
&nSRamBaseAddress=0x28000000
|
|
|
|
IF CPUIS(XMC7?00*K1*)
|
|
(
|
|
// 1MB
|
|
&nMainCodeLargeSectors=30.
|
|
&nMainCodeSmallSectors=16.
|
|
|
|
// 128kB
|
|
&nWorkFlashLargeSectors=48.
|
|
&nWorkFlashSmallSectors=256.
|
|
)
|
|
ELSE IF CPUIS(XMC7?00*K2*)
|
|
(
|
|
// 2MB
|
|
&nMainCodeLargeSectors=62.
|
|
&nMainCodeSmallSectors=16.
|
|
|
|
// 128kB
|
|
&nWorkFlashLargeSectors=48.
|
|
&nWorkFlashSmallSectors=256.
|
|
)
|
|
ELSE IF CPUIS(XMC7?00*K4*)
|
|
(
|
|
// 4MB
|
|
&nMainCodeLargeSectors=126. //32KB
|
|
&nMainCodeSmallSectors=16. // 8KB
|
|
|
|
// 256kB
|
|
&nWorkFlashLargeSectors=96. //2KB
|
|
&nWorkFlashSmallSectors=512. //128B
|
|
)
|
|
ELSE IF CPUIS(XMC7?00*K8*)
|
|
(
|
|
// 8MB
|
|
&nMainCodeLargeSectors=254. //32KB
|
|
&nMainCodeSmallSectors=32. // 8KB
|
|
|
|
// 256kB
|
|
&nWorkFlashLargeSectors=96. //2KB
|
|
&nWorkFlashSmallSectors=512. //128B
|
|
)
|
|
ELSE
|
|
(
|
|
PRINT %WARNING CPU()+" is not supported by "+OS.PPF()
|
|
ENDDO
|
|
)
|
|
|
|
; <MainCodeFlash>
|
|
IF TRUE()
|
|
(
|
|
; Single Bank
|
|
; large code
|
|
FLASH.Create 1. (0x10000000)++(&nMainCodeLargeSectors*0x8000-0x1) 0x8000 TARGET LONG
|
|
; small code
|
|
FLASH.Create 1. (0x10000000+&nMainCodeLargeSectors*0x8000)++(&nMainCodeSmallSectors*0x2000-0x1) 0x2000 TARGET LONG
|
|
)
|
|
ELSE
|
|
(
|
|
; Dual Bank
|
|
; large code
|
|
FLASH.Create 1. (0x10000000)++(&nMainCodeLargeSectors*0x8000/0x2-0x1) 0x8000 TARGET LONG
|
|
; small code
|
|
FLASH.Create 1. (0x10000000+&nMainCodeLargeSectors*0x8000/0x2)++(&nMainCodeSmallSectors*0x2000/0x2-0x1) 0x2000 TARGET LONG
|
|
; large code
|
|
FLASH.Create 1. (0x12000000)++(&nMainCodeLargeSectors*0x8000/0x2-0x1) 0x8000 TARGET LONG
|
|
; small code
|
|
FLASH.Create 1. (0x12000000+&nMainCodeLargeSectors*0x8000/0x2)++(&nMainCodeSmallSectors*0x2000/0x2-0x1) 0x2000 TARGET LONG
|
|
)
|
|
; </MainCodeFlash>
|
|
|
|
; <WorkFlash>
|
|
IF TRUE()
|
|
(
|
|
; Single Bank
|
|
; large
|
|
FLASH.Create 2. (0x14000000)++(&nWorkFlashLargeSectors*0x800-0x1) 0x800 TARGET LONG
|
|
; small
|
|
FLASH.Create 2. (0x14000000+&nWorkFlashLargeSectors*0x800)++(&nWorkFlashSmallSectors*0x80-0x1) 0x80 TARGET LONG
|
|
)
|
|
ELSE
|
|
(
|
|
; Dual Bank
|
|
; large
|
|
FLASH.Create 2. (0x14000000)++(&nWorkFlashLargeSectors*0x800/0x2-0x1) 0x800 TARGET LONG
|
|
; small
|
|
FLASH.Create 2. (0x14000000+&nWorkFlashLargeSectors*0x800/0x2)++(&nWorkFlashSmallSectors*0x80/0x2-0x1) 0x80 TARGET LONG
|
|
; large
|
|
FLASH.Create 2. (0x15000000)++(&nWorkFlashLargeSectors*0x800/0x2-0x1) 0x800 TARGET LONG
|
|
; small
|
|
FLASH.Create 2. (0x15000000+&nWorkFlashLargeSectors*0x800/0x2)++(&nWorkFlashSmallSectors*0x80/0x2-0x1) 0x80 TARGET LONG
|
|
)
|
|
; </WorkFlash>
|
|
|
|
IF (("¶m_dualport"!="1")||SYStem.ACCESS.DENIED())
|
|
FLASH.TARGET &nSRamBaseAddress+0x1000 &nSRamBaseAddress+0x2000 0x1000 ~~/demo/arm/flash/long/xmc7000.bin /STACKSIZE 0x800
|
|
ELSE
|
|
FLASH.TARGET &nSRamBaseAddress+0x1000 E:&nSRamBaseAddress+0x2000 0x1000 ~~/demo/arm/flash/long/xmc7000.bin /STACKSIZE 0x800 /DUALPORT
|
|
|
|
FLASH.CLOCK AUTO
|
|
RETURN
|
|
) |