; -------------------------------------------------------------------------------- ; @Title: Example script for flash declaration of Infineon XMC4800 internal flash. ; ; @Description: ; Synopsis: ; ; DO xmc4800 [PREPAREONLY] [CPU=] [DUALPORT=0|1] ; ; Description: ; ; Script arguments are not case sensitive. ; ; PREPAREONLY only declares flash but does not execute flash programming ; ; CPU= selects CPU derivative . 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/xmc4800 CPU=XMC4800-X1024 DUALPORT=1 PREPAREONLY ; ; List of XMC4800 derivatives and their configuration: ; ; CPU-Type Flash ; -------------------------------------------------------------------------------- ; XMC4800-X1024 1MB ; XMC4800-X1536 1.5MB ; XMC4800-X2048 2MB ; ; Memories: ; ; 00000000--00003FFF BROM (PMU ROM) ; 08000000--080FFFFF PMU/FLASH (cached) ; 0C000000--0C0FFFFF PMU/FLASH (uncached) ; 1FFE8000--1FFFFFFF 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: xmc4800* ; -------------------------------------------------------------------------------- ; $Rev: 10516 $ ; $Id: xmc4800.cmm 10516 2022-02-02 11:39:30Z bschroefel $ ; LOCAL ¶meters ENTRY %LINE ¶meters LOCAL ¶m_prepareonly ¶m_prepareonly=(STRing.SCAN(STRing.UPpeR("¶meters"),"PREPAREONLY",0)!=-1) LOCAL ¶m_cpu ¶m_cpu=STRing.SCANAndExtract(STRing.UPpeR("¶meters"),"CPU=","") LOCAL ¶m_dualport ¶m_dualport=0 IF VERSION.BUILD.BASE()>=43441. ¶m_dualport=STRing.SCANAndExtract(STRing.UPpeR("¶meters"),"DUALPORT=","0") ; ------------------------------------------------------------------------------ ; Start debugging IF SYStem.MODE()<5 ( SYStem.RESet IF "¶m_cpu"!="" SYStem.CPU ¶m_cpu IF !CPUIS(XMC480*) SYStem.CPU XMC480* IF CABLE.TWOWIRE() SYStem.CONFIG.DEBUGPORTTYPE SWD ELSE SYStem.CONFIG.DEBUGPORTTYPE JTAG SYStem.CONFIG.CONNECTOR MIPI20T SYStem.Option.ResBreak OFF SYStem.Up ; Initialize internal SRAM Data.Set 0x1FFE8000--0x2001FFFF %Long 0x0 ) ; ------------------------------------------------------------------------------ ; Flash declaration FLASH.RESet GOSUB FlashDeclaration ¶m_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 /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(XMC4800-X1024) &FlashSize=0x100000 ELSE IF CPUIS(XMC4800-X1536) &FlashSize=0x180000 ELSE IF CPUIS(XMC4800-X2048) &FlashSize=0x200000 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>=0x100000 ( 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--0x0C0FFFFF 0x40000 TARGET Long ) IF &FlashSize>=0x180000 FLASH.Create 5. 0x0C100000--0x0C17FFFF 0x40000 TARGET Long IF &FlashSize>=0x200000 FLASH.Create 6. 0x0C180000--0x0C1FFFFF 0x40000 TARGET Long FLASH.CreateALIAS 0x08000000--0x080FFFFF 0x0C000000 IF &DualPort==0 FLASH.TARGET 1FFE8000 0x20000000 0x4000 ~~/demo/arm/flash/long/xmc4000.bin ELSE FLASH.TARGET 1FFE8000 EAHB:0x20000000 0x1000 ~~/demo/arm/flash/long/xmc4000.bin /DualPort RETURN