; -------------------------------------------------------------------------------- ; @Title: Flash declaration for Zhixin Z20K148M internal flash ; @Description: ; Script arguments: ; DO z20k148m [PREPAREONLY] [CPU=] [DUALPORT=<0|1>] ; PREPAREONLY only declares flash but does not execute flash programming ; CPU= selects CPU derivative ; DUALPORT=<0|1> use dual port memory access, default 0 ; ; Example: ; DO ~~/demo/arm/flash/z20k148m 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 z20k148m derivatives and their configuration: ; CPU-Type ProgFlash DataFlash IFRFlash ; [Byte] [Byte] [Byte] ; -------------------------------------------------------------------------------- ; Z20K148M 2048KB 128KB 8KB ; ; @Chip: Z20K148M ; @Author: STK ; @Copyright: (C) 1989-2022 Lauterbach GmbH, licensed for use with TRACE32(R) only ; -------------------------------------------------------------------------------- ; $Rev: 12043 $ ; $Id: z20k148m.cmm 12043 2023-04-18 07:45:17Z skrausse $ PRIVATE ¶meters ¶m_prepareonly ¶m_cpu ¶m_dualport 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(STRing.UPpeR("¶meters"),"DUALPORT=","0") ; ------------------------------------------------------------------------------ ; Start debugging IF !SYStem.Up() ( SYStem.RESet IF "¶m_cpu"!="" SYStem.CPU ¶m_cpu IF !CPUIS(Z20K148M) SYStem.CPU Z20K148M IF CABLE.TWOWIRE() SYStem.CONFIG DEBUGPORTTYPE SWD ELSE SYStem.CONFIG DEBUGPORTTYPE JTAG SYStem.Up ; Initialize ECC Data.Set 0x1FFE0000--0x1FFE3FFF %Long 0x0 ; init SRAM with 0 ) GOSUB DisableWatchdog ; ------------------------------------------------------------------------------ ; 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 ; ; Please do NOT modify the TRACE32 flash declaration. ; ; Modifications can result in unpredictable behavior. ; Please contact support@lauterbach.com for any changes. FlashDeclaration: ( PARAMETERS &DualPort PRIVATE &FlashDriver &PFlashSize &DFlashSize &IFRFlashSize &PFlashSectorSize &DFlashSectorSize &IFRFlashSectorSize &FlashDriver="z20k148m.bin" &PFlashSize=0x200000 &DFlashSize=0x20000 &IFRFlashSize=0x8000 &PFlashSectorSize=0x2000 &DFlashSectorSize=0x2000 &IFRFlashSectorSize=0x2000 FLASH.Create 1. 0x00000000++(&PFlashSize-0x1) &PFlashSectorSize TARGET Long FLASH.Create 2. 0x01000000++(&DFlashSize-0x1) &DFlashSectorSize TARGET Long FLASH.Create 3. 0x02000000++(&IFRFlashSize-0x1) &IFRFlashSectorSize TARGET Long IF "&DualPort"=="0" FLASH.TARGET 0x1FFE0000 0x1FFE1000 0x1000 ~~/demo/arm/flash/long/&FlashDriver ELSE FLASH.TARGET 0x1FFE0000 EAHB:0x1FFE1000 0x1000 ~~/demo/arm/flash/long/&FlashDriver /DualPort RETURN ) DisableWatchdog: ( LOCAL &tmp1 &tmp2 &tmp1=Data.Long(ST:0x20000000) &tmp2=Data.Long(ST:0x20000004) Register.SWAP Data.Assemble ST:0x20000000 str r1,[r0] Data.Assemble , str r3,[r2] Data.Assemble , str r5,[r4] Data.Assemble , bkpt #0 Register.Set PC 0x20000000 Register.Set SP 0x20001000 Register.Set R0 0x40052014 Register.Set R1 0xB0D9A1C4 Register.Set R2 0x40052014 Register.Set R3 0x1A1E3B0F Register.Set R4 0x40052008 Register.Set R5 0x01040040 Go.direct WAIT !STATE.RUN() Data.Set ST:0x20000000 %Long &tmp1 Data.Set ST:0x20000004 %Long &tmp2 Register.SWAP RETURN )