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

143 lines
3.8 KiB
Plaintext

; --------------------------------------------------------------------------------
; @Title: Setup script for flash declaration of Infineon XMC1300 internal flash.
;
; @Description:
; Synopsis:
;
; DO ~~/demo/arm/flash/xmc1300 [PREPAREONLY] [CPU=<cpu>]
;
; 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.
;
; Example:
;
; DO ~~/demo/arm/flash/xmc1300 CPU=XMC1302-X0200 PREPAREONLY
;
; List of XMC1300 derivatives and their configuration:
;
; CPU-Type Flash
; ----------------------------
; XMC1301-F0008 8kB
; XMC1301-F0016 16kB
; XMC1301-F0032 32kB
; XMC1301-F0064 64kB
; XMC1302-X0008 8kB
; XMC1302-X0016 16kB
; XMC1302-X0032 32kB
; XMC1302-X0064 64kB
; XMC1302-X0128 128kB
; XMC1302-X0200 200kB
;
; Memories:
;
; 00000000--00000AFF BROM (user readable)
; 00000B00--00001FFF BROM (non-user readable)
; 10000000--10000DFF Flash Sector 0 (non-user readable)
; 10000E00--10000FFF Flash Sector 0 (user readable)
; 10001000--10032FFF Flash (200 kByte)
; 20000000--20003FFF SRAM Block 0..3
;
; @Author: WRD
; @Copyright: (C) 1989-2022 Lauterbach GmbH, licensed for use with TRACE32(R) only
; @Chip: xmc130*
; --------------------------------------------------------------------------------
; $Id: xmc1300.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=","")
; --------------------------------------------------------------------------------
; Setup CPU
IF SYStem.MODE()<5
(
SYStem.RESet
IF "&param_cpu"!=""
SYStem.CPU &param_cpu
IF !CPUIS(XMC130*)
SYStem.CPU XMC130*
IF CABLE.TWOWIRE()
SYStem.CONFIG.DEBUGPORTTYPE SWD
ELSE
SYStem.CONFIG.DEBUGPORTTYPE JTAG
SYStem.CONFIG.CONNECTOR MIPI20T
SYStem.Option.ResBreak OFF
SYStem.Up
)
; --------------------------------------------------------------------------------
; Flash declaration
FLASH.RESet
GOSUB FlashDeclaration
; 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:
FLASH.Create 1. 0x10000000--0x10000FFF 0x100 NOP Long ; Sector 0
IF CPUIS(XMC130*0008)
FLASH.Create 2. 0x10001000--0x10002FFF 0x100 TARGET Long
ELSE IF CPUIS(XMC130*0016)
FLASH.Create 2. 0x10001000--0x10004FFF 0x100 TARGET Long
ELSE IF CPUIS(XMC130*0032)
FLASH.Create 2. 0x10001000--0x10008FFF 0x100 TARGET Long
ELSE IF CPUIS(XMC130*0064)
FLASH.Create 2. 0x10001000--0x10010FFF 0x100 TARGET Long
ELSE IF CPUIS(XMC130*0128)
FLASH.Create 2. 0x10001000--0x10020FFF 0x100 TARGET Long
ELSE IF CPUIS(XMC130*0200)
FLASH.Create 2. 0x10001000--0x10032FFF 0x100 TARGET Long
ELSE
(
PRINT %ERROR "FLASH size of CPU type is not supported by the script"
ENDDO
)
FLASH.TARGET 0x20001000 0x20002000 0x400 ~~/demo/arm/flash/long/xmc1000.bin
RETURN