; -------------------------------------------------------------------------------- ; @Title: Example for flash declaration of Ambiq Apollo3 internal flash ; @Description: ; Script arguments: ; ; DO apollo3 [PREPAREONLY] [CPU=] ; ; PREPAREONLY only declares flash but does not execute flash programming ; ; CPU= selects CPU derivative ; ; Example: ; ; DO ~~/demo/arm/flash/apollo3 CPU=AMA3B1KK PREPAREONLY ; ; List of Apollo3 derivatives and their configuration: ; ; CPU-Type Flash size SRAM size ; [Byte] [Byte] ; AMA3B1KK 0x100000 0x60000 ; AMAP31KK 0x100000 0x60000 ; AMA3B2KK 0x200000 0xC0000 ; ; @Author: BWR ; @Chip: AMA3B1KK, AMAP31KK, AMA3B2KK ; @Copyright: (C) 1989-2022 Lauterbach GmbH, licensed for use with TRACE32(R) only ; -------------------------------------------------------------------------------- ; $Rev: 10516 $ ; $Id: apollo3.cmm 10516 2022-02-02 11:39:30Z bschroefel $ LOCAL ¶meters ENTRY %LINE ¶meters LOCAL ¶m_prepareonly ¶m_cpu ¶m_prepareonly=(STRing.SCAN(STRing.UPpeR("¶meters"),"PREPAREONLY",0)!=-1) ¶m_cpu=STRing.SCANAndExtract(STRing.UPpeR("¶meters"),"CPU=","") ; ------------------------------------------------------------------------------ ; Setup CPU IF !SYStem.Up() ( SYStem.RESet IF "¶m_cpu"!="" SYStem.CPU ¶m_cpu IF !CPUIS(AMA3*)&&!CPUIS(AMAP3*) SYStem.CPU AMA* SYStem.CONFIG.DEBUGPORTTYPE SWD SYStem.JtagClock 5MHz SYStem.Up ) ; ------------------------------------------------------------------------------ ; Flash declaration FLASH.RESet GOSUB FlashDeclaration ; 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 Data.LOAD.auto * FLASH.ReProgram.off ; Reset device SYStem.Down SYStem.Up ) ENDDO ; -------------------------------------------------------------------------------- ; Flash declaration depending on selected CPU FlashDeclaration: ( PRIVATE &FlashSize &FlashDriver IF CPUIS("AMA3B1KK")||CPUIS("AMAP31KK") ( &FlashSize=0x00100000 &FlashDriver="apollo3.bin" ) ELSE IF CPUIS("AMA3B2KK") ( &FlashSize=0x00200000 &FlashDriver="apollo3.bin" ) ELSE ( PRINT %ERROR "FLASH size of CPU type is unknown" ENDDO ) ; The first writable sector is beyond the secure bootloader range FLASH.Create 1. 0x0000C000--(&FlashSize-1.-0x0000C000) 0x2000 TARGET Long FLASH.TARGET 0x10000000 0x10000800 0x400 ~~/demo/arm/flash/long/&FlashDriver RETURN )