Files
2025-10-14 09:52:32 +09:00

142 lines
3.6 KiB
Plaintext

; --------------------------------------------------------------------------------
; @Title: Setup script for flash declaration of Infineon XMC1400 internal flash.
;
; @Description:
; Synopsis:
;
; DO ~~/demo/arm/flash/xmc1400 [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/xmc1400 CPU=XMC1402-X0200 PREPAREONLY
;
; List of XMC1400 derivatives and their configuration:
;
; CPU-Type Flash
; ----------------------------
; XMC1401-X0064 64kB
; XMC1401-X0128 128kB
; XMC1402-X0032 32kB
; XMC1402-X0064 64kB
; XMC1402-X0128 128kB
; XMC1402-X0200 200kB
; XMC1403-X0064 64kB
; XMC1403-X0128 128kB
; XMC1403-X0200 200kB
; XMC1404-X0064 64kB
; XMC1404-X0128 128kB
; XMC1404-X0200 200kB
;
; Memories:
;
; 00000000--00000CFF BROM (user readable)
; 00000D00--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: AME
; @Copyright: (C) 1989-2022 Lauterbach GmbH, licensed for use with TRACE32(R) only
; @Chip: xmc140*
; --------------------------------------------------------------------------------
; $Id: xmc1400.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.Up()
(
SYStem.RESet
IF "&param_cpu"!=""
SYStem.CPU &param_cpu
IF !CPUIS(XMC140*)
SYStem.CPU XMC140*
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(XMC140*0032)
FLASH.Create 2. 0x10001000--0x10008FFF 0x100 TARGET Long
ELSE IF CPUIS(XMC140*0064)
FLASH.Create 2. 0x10001000--0x10010FFF 0x100 TARGET Long
ELSE IF CPUIS(XMC140*0128)
FLASH.Create 2. 0x10001000--0x10020FFF 0x100 TARGET Long
ELSE IF CPUIS(XMC140*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
)