; -------------------------------------------------------------------------------- ; @Title: Flash declaration for NXP KW45 Cortex-M33 internal flash ; @Description: ; Reprogam internal Flash of NXP KW45. ; Script arguments: ; DO kw45 [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 1 ; Example: ; DO ~~/demo/arm/flash/kw45 CPU=KW45B41Z82AFT PREPAREONLY ; Note : Flash programming must be done from a Cortex-M33 ; 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 KW45 derivatives and their configuration: ; CPU-Type Flash RamSize ; [kB] [kB] ; -------------------------------------------------------------------------------- ; KW45B41Z53AFT 512 128 ; KW45B41Z53AFP 512 128 ; KW45B41Z52AFT 512 128 ; KW45B41Z52AFP 512 128 ; KW45B41Z83AFT 1024 128 ; KW45B41Z82AFT 1024 128 ; KW45B41Z83AFP 1024 128 ; KW45B41Z82AFP 1024 128 ; KW45Z41053AFT 1024 128 ; KW45Z41052AFT 1024 128 ; KW45Z41053AFP 1024 128 ; KW45Z41052AFP 1024 128 ; ; @Chip: KW45* ; @Author: STK ; @Copyright: (C) 1989-2022 Lauterbach GmbH, licensed for use with TRACE32(R) only ; -------------------------------------------------------------------------------- ; $Rev: 11767 $ ; $Id: kw45.cmm 11767 2023-01-24 16:36:38Z skrausse $ PRIVATE ¶meters ENTRY %LINE ¶meters PRIVATE ¶m_prepareonly ¶m_cpu ¶m_dualport ¶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=","1") ; -------------------------------------------------------------------------------- ; Initialize and start the debugger IF !SYStem.Up() ( SYStem.RESet IF "¶m_cpu"!="" SYStem.CPU ¶m_cpu IF !CPUIS(KW45*) SYStem.CPU KW45* SYStem.CONFIG DEBUGPORTTYPE SWD SYStem.MemAccess DAP SYStem.JtagClock 10MHz SYStem.Up ) ; ------------------------------------------------------------------------------ ; 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?" PRIVATE &progflash ENTRY &progflash IF &progflash ( FLASH.Erase.ALL FLASH.ReProgram.ALL Data.LOAD.auto * /Long FLASH.ReProgram.off ) ENDDO ; -------------------------------------------------------------------------------- ; SUBROUTINES ; -------------------------------------------------------------------------------- ; 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: ;(param_dualport) ( PARAMETERS ¶m_dualport PRIVATE &FlashSize &FlashDriver &FlashDriver="kw45.bin" IF CPUIS("KW45?41?5*") //this check must be first! ( &FlashSize=0x080000 ) ELSE IF CPUIS("KW45?41?8*") ( &FlashSize=0x100000 ) ELSE ( PRINT %ERROR "FLASH size of CPU type is unknown" ENDDO ) FLASH.Create 1. 0x00000000--(&FlashSize-1) 0x2000 TARGET Long FLASH.Create 2. 0x02000000++7FFF 0x2000 NOP Long /INFO "IFR0" FLASH.Create 3. 0x02100000++7FFF 0x2000 NOP Long /INFO "IFR1" FLASH.CreateALIAS 0x10000000++(&FlashSize-1) 0x00000000 /INFO "Secure" IF (("¶m_dualport"=="0")||SYStem.ACCESS.DENIED()) FLASH.TARGET 0x30000000 0x30001000 0x1000 ~~/demo/arm/flash/long/&FlashDriver /STACKSIZE 0x200 ELSE FLASH.TARGET E:0x30000000 0x30001000 0x1000 ~~/demo/arm/flash/long/&FlashDriver /DualPort /STACKSIZE 0x200 RETURN )