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

171 lines
4.7 KiB
Plaintext

; --------------------------------------------------------------------------------
; @Title: Example script for flash declaration of Infineon XMC4500 internal flash.
;
; @Description:
; Synopsis:
;
; DO xmc4500 [PREPAREONLY] [CPU=<cpu>] [DUALPORT=0|1]
;
; Description:
;
; Script arguments are not case sensitive.
;
; PREPAREONLY only declares flash but does not execute flash programming
;
; CPU=<cpu> selects CPU derivative <cpu>. <cpu> can be CPU name out of the
; table listed below. For these derivatives the flash declaration
; is done by the script.
;
; DUALPORT default value is 0 (disabled). If DualPort mode is enabled
; flash algorithm stays running until flash programming is
; finished. Data is tranferred via dual port memory access.
;
; Example:
;
; DO ~~/demo/arm/flash/xmc4500 CPU=XMC4500-X1024 DUALPORT=1 PREPAREONLY
;
; List of XMC4500 derivatives and their configuration:
;
; CPU-Type Flash RAM
; --------------------------------------------------------------------------------
; XMC4500-X768 768kB 160kB
; XMC4500-X1024 1MB 160kB
; XMC4502-X768 768kB 160kB
; XMC4504-X512 512kB 128kB
;
; Memories:
;
; 00000000--00003FFF BROM (PMU ROM)
; 08000000--080FFFFF PMU/FLASH (cached)
; 0C000000--0C0FFFFF PMU/FLASH (uncached)
; 10000000--1000FFFF PSRAM (code)
; 20000000--2000FFFF DSRAM1 (system)
; 30000000--30007FFF DSRAM2 (comm) - only available with 160kB RAM
;
; @Author: WRD
; @Copyright: (C) 1989-2022 Lauterbach GmbH, licensed for use with TRACE32(R) only
; @Chip: xmc4500*
; --------------------------------------------------------------------------------
; $Rev: 10516 $
; $Id: xmc4500.cmm 10516 2022-02-02 11:39:30Z bschroefel $
;
LOCAL &parameters
ENTRY %LINE &parameters
LOCAL &param_prepareonly
&param_prepareonly=(STRing.SCAN(STRing.UPpeR("&parameters"),"PREPAREONLY",0)!=-1)
LOCAL &param_cpu
&param_cpu=STRing.SCANAndExtract(STRing.UPpeR("&parameters"),"CPU=","")
LOCAL &param_dualport
&param_dualport=0
IF VERSION.BUILD.BASE()>=43441.
&param_dualport=STRing.SCANAndExtract(STRing.UPpeR("&parameters"),"DUALPORT=","0")
; ------------------------------------------------------------------------------
; Start debugging
IF SYStem.MODE()<5
(
SYStem.RESet
IF "&param_cpu"!=""
SYStem.CPU &param_cpu
IF !CPUIS(XMC450*)
SYStem.CPU XMC450*
IF CABLE.TWOWIRE()
SYStem.CONFIG.DEBUGPORTTYPE SWD
ELSE
SYStem.CONFIG.DEBUGPORTTYPE JTAG
SYStem.CONFIG.CONNECTOR MIPI20T
SYStem.Option.ResBreak OFF
SYStem.Up
; Initialize 128 kByte of internal SRAM
Data.Set 0x10000000--0x1000FFFF %Long 0x0
Data.Set 0x20000000--0x2000FFFF %Long 0x0
)
; ------------------------------------------------------------------------------
; Flash declaration
FLASH.RESet
GOSUB FlashDeclaration &param_dualport
; Flash script ends here if called with parameter PREPAREONLY
IF &param_prepareonly
ENDDO PREPAREDONE
; ------------------------------------------------------------------------------
; Flash programming example
DIALOG.YESNO "Program flash memory?"
LOCAL &progflash
ENTRY &progflash
IF &progflash
(
FLASH.ReProgram.ALL /Erase
Data.LOAD.auto *
FLASH.ReProgram.off
; Reset device
SYStem.Down
SYStem.Up
)
ENDDO
; --------------------------------------------------------------------------------
; Flash declaration depending on selected CPU
FlashDeclaration:
LOCAL &DualPort
ENTRY &DualPort
LOCAL &FlashSize
&FlashSize=0x0
IF CPUIS(XMC450?-X512)
&FlashSize=0x80000
ELSE IF CPUIS(XMC450?-X768)
&FlashSize=0xC0000
ELSE IF CPUIS(XMC450?-X1024)
&FlashSize=0x100000
ELSE
(
IF VERSION.BUILD()<42853.
(
PRINT %ERROR "Trace32 software version is to old, please request an update"
ENDDO
)
PRINT %ERROR "FLASH size of CPU type is not supported by the script"
ENDDO
)
IF &FlashSize>=0x80000
(
FLASH.Create 1. 0x0C000000--0x0C00FFFF 0x4000 TARGET Long
FLASH.Create 2. 0x0C010000--0x0C01FFFF 0x4000 TARGET Long
FLASH.Create 3. 0x0C020000--0x0C03FFFF 0x20000 TARGET Long
FLASH.Create 4. 0x0C040000--0x0C07FFFF 0x40000 TARGET Long
)
IF &FlashSize>=0xC0000
FLASH.Create 5. 0x0C080000--0x0C0BFFFF 0x40000 TARGET Long
IF &FlashSize>=0x100000
FLASH.Create 6. 0x0C0C0000--0x0C0FFFFF 0x40000 TARGET Long
FLASH.CreateALIAS 0x08000000--0x081FFFFF 0x0C000000
IF &DualPort==0
FLASH.TARGET 0x10000000 0x20000000 0x4000 ~~/demo/arm/flash/long/xmc4000.bin
ELSE
FLASH.TARGET 0x10000000 EAHB:0x20000000 0x1000 ~~/demo/arm/flash/long/xmc4000.bin /DualPort
RETURN