; -------------------------------------------------------------------------------- ; @Title: Example for flash declaration of Maxim Integrated MAX32620 internal flash. ; ; @Description: ; Script arguments: ; ; DO max32620 [PREPAREONLY] [CPU=] [DUALPORT=0|1] ; ; PREPAREONLY only declares flash but does not execute flash programming ; ; CPU= selects CPU derivative ; ; 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/max32620 PREPAREONLY DUALPORT=1 CPU=MAX32620 ; ; CPU-Type Flash size SRAM size ; [Byte] [Byte] ; -------------------------------------------------------------------------------- ; MAX32620 0x200000 0x40000 ; MAX32625 0x80000 0x28000 ; MAX32626 0x80000 0x28000 ; ; The internal flash is located at 0x00000000 ; The internal SRAM is located at 0x20000000 ; ; @Author: FLC ; @Copyright: (C) 1989-2022 Lauterbach GmbH, licensed for use with TRACE32(R) only ; -------------------------------------------------------------------------------- ; $Rev: 11410 $ ; $Id: max32620.cmm 11410 2022-10-17 09:57:24Z nzouari $ LOCAL ¶meters ENTRY %LINE ¶meters LOCAL ¶m_prepareonly ¶m_dualport ¶m_cpu ¶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") ; ------------------------------------------------------------------------------ ; Setup CPU IF SYStem.MODE()<5 ( SYStem.RESet IF "¶m_cpu"!="" SYStem.CPU ¶m_cpu IF !CPUIS(MAX3262*) SYStem.CPU MAX3262* SYStem.CONFIG.DEBUGPORTTYPE SWD 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?" LOCAL &progflash ENTRY &progflash IF &progflash ( FLASH.ReProgram.ALL /Erase Data.LOAD.auto * FLASH.ReProgram.off ) ENDDO ; -------------------------------------------------------------------------------- ; Flash declaration depending on selected CPU FlashDeclaration: LOCAL &DualPort ENTRY &DualPort LOCAL &FlashSize LOCAL &PageSize IF CPUIS("MAX32620") ( &FlashSize=0x200000 &PageSize=0x2000 ) ELSE IF CPUIS("MAX32625")||CPUIS("MAX32626") ( &FlashSize=0x80000 &PageSize=0x2000 ) ELSE ( PRINT %ERROR "FLASH size of CPU type is unknown" ENDDO ) ; Program Flash FLASH.Create 1. 0x00000000--(&FlashSize-1) &PageSize TARGET Long FLASH.CLocK.AUTO IF &DualPort==0 FLASH.TARGET 0x20000000 0x20001000 0x2000 ~~/demo/arm/flash/long/max32620.bin ELSE FLASH.TARGET 0x20000000 EAHB:0x20001000 0x2000 ~~/demo/arm/flash/long/max32620.bin /DualPort RETURN