; -------------------------------------------------------------------------------- ; @Title: Flash declaration for NXP LPC55xx Cortex-M33 internal flash ; @Description: ; Reprogam internal Flash of NXP LPC55xx. ; Script arguments: ; DO lpc54xx [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/lpc55xx CPU=LPC55S69JBD100-CPU0 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 LPC55xx derivatives and their configuration: ; CPU-Type Flash RamSize ; [kB] [kB] ; -------------------------------------------------------------------------------- ; LPC5502JBD64 64 48 ; LPC5502JHI48 64 48 ; LPC5504JBD64 128 80 ; LPC5504JHI48 128 80 ; LPC5506JBD64 256 96 ; LPC5506JHI48 256 96 ; LPC5512JBD100 64 48 ; LPC5512JBD64 64 48 ; LPC5514JBD100 128 80 ; LPC5514JBD64 128 80 ; LPC5516JBD100 256 96 ; LPC5516JBD64 256 96 ; LPC5516JEV98 256 96 ; LPC5526JBD100 256 144 ; LPC5526JBD64 256 144 ; LPC5526JEV98 256 144 ; LPC5528JBD100 512 256 ; LPC5528JBD64 512 256 ; LPC5528JEV98 512 256 ; LPC5534JBD100 128 96 ; LPC5534JBD64 128 96 ; LPC5534JHI48 128 96 ; LPC5536JBD100 256 128 ; LPC5536JBD64 256 112 ; LPC5536JHI48 256 96 ; LPC55S04JBD64 128 80 ; LPC55S04JHI48 128 80 ; LPC55S06JBD64 256 96 ; LPC55S06JHI48 256 96 ; LPC55S14JBD100 128 80 ; LPC55S14JBD64 128 80 ; LPC55S16JBD100 256 96 ; LPC55S16JBD64 256 96 ; LPC55S16JEV98 256 96 ; LPC55S26JBD100 256 144 ; LPC55S26JBD64 256 144 ; LPC55S26JEV98 256 144 ; LPC55S28JBD100 512 256 ; LPC55S28JBD64 512 256 ; LPC55S28JEV98 512 256 ; LPC55S66JBD100 256 144 ; LPC55S66JBD64 256 144 ; LPC55S66JEV98 256 144 ; LPC55S69JBD100 640 320 ; LPC55S69JBD64 640 320 ; LPC55S69JEV98 640 320 ; ; @Chip: LPC55* ; @Author: MAM ; @Copyright: (C) 1989-2022 Lauterbach GmbH, licensed for use with TRACE32(R) only ; -------------------------------------------------------------------------------- ; $Rev: 12931 $ ; $Id: lpc55xx.cmm 12931 2024-01-12 18:32:50Z 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(LPC55*) SYStem.CPU LPC55* SYStem.CONFIG.DEBUGPORTTYPE SWD SYStem.MemAccess DAP SYStem.JtagClock 1MHz SYStem.Option WaitReset 20ms IF COMPonent.AVAILABLE("ETM") ETM.OFF IF COMPonent.AVAILABLE("ITM") ITM.OFF Trace.DISable SYStem.Up ) ; ------------------------------------------------------------------------------ ; Flash declaration FLASH.RESet GOSUB FlashDeclaration "¶m_dualport" ; Flash script ends here if called with parameter PREPAREONLY &PFRSize=0x3000 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 &PFRStart &PFRSize &FlashDriver IF CPUIS("LPC55S?9*") //this check must be first! ( &FlashSize=0xA0000 &PFRStart=0x9D800 &PFRSize=0x2800 ) ELSE IF CPUIS("LPC55?8*")||CPUIS("LPC55S?8*") ( &FlashSize=0x80000 &PFRStart=0x9D800 &PFRSize=0x2800 ) ELSE IF (CPUIS("LPC55?6*")||CPUIS("LPC55S?6*")) ( &FlashSize=0x40000 &PFRStart=0x3DC00 ; Read from target via FLASH_Init() call &PFRSize=0x2400 ) ELSE IF CPUIS("LPC55?4*")||CPUIS("LPC55S?4*") ( &FlashSize=0x20000 &PFRStart=0x3D000 ; LPC553xRM attachment: 0x3DC00 &PFRSize=0x3000 ) ELSE IF CPUIS("LPC55?2*")||CPUIS("LPC55S?2*") ( &FlashSize=0x10000 &PFRStart=0x3DE00 ; UM11424, UM11295, AN12949, AN12278 &PFRSize=0x2200 ) ELSE ( PRINT %ERROR "FLASH size of CPU type is unknown" ENDDO ) IF CPUIS("LPC550*")||CPUIS("LPC55S0*") ( &FlashDriver="lpc550x.bin" ) ELSE IF CPUIS("LPC551*")||CPUIS("LPC55S1*") ( &FlashDriver="lpc551x.bin" ) ELSE IF CPUIS("LPC552*")||CPUIS("LPC55S2*") ( &FlashDriver="lpc552x.bin" ) ELSE IF CPUIS("LPC553*")||CPUIS("LPC55S3*") ( &FlashDriver="lpc553x.bin" ) ELSE IF CPUIS("LPC55S6*") ( &FlashDriver="lpc556x.bin" ) ELSE ( PRINT %ERROR "FLASH driver for CPU type is unknown" ENDDO ) FLASH.Create 1. 0x00000000--(&FlashSize-0x8000-1) 0x8000 TARGET Long FLASH.Create 2. (&FlashSize-0x8000)--(&FlashSize-&PFRSize-1) (0x8000-&PFRSize) TARGET Long FLASH.Create 3. &PFRStart++(&PFRSize-1) &PFRSize NOP Long /INFO "PFR" IF CPUIS("LPC55S*") ( FLASH.CreateALIAS 0x10000000++(&FlashSize-1) 0x00000000 /INFO "Secure" ) IF CPUIS("LPC55S*") ( 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 ) ELSE ( IF (("¶m_dualport"=="0")||SYStem.ACCESS.DENIED()) FLASH.TARGET 0x20000000 0x20001000 0x1000 ~~/demo/arm/flash/long/&FlashDriver /STACKSIZE 0x200 ELSE FLASH.TARGET E:0x20000000 0x20001000 0x1000 ~~/demo/arm/flash/long/&FlashDriver /DualPort /STACKSIZE 0x200 ) RETURN )