; ; @Title: Example for flash declaration of EnergyMicro EFM32 Pearl Gecko internal flash. ; ; @Description: ; Script arguments: ; ; DO efm32pg1 [PREPAREONLY] [CPU=] ; ; PREPAREONLY only declares flash but does not execute flash programming ; ; CPU= selects CPU derivative ; ; Example: ; ; DO ~~/demo/arm/flash/efm32pg1 CPU=EFM32PG12B500F1024 PREPAREONLY ; ; List of EFM32 Pearl Gecko derivatives and their configuration: ; ; CPU FlashSize RamSize ; Derivative [kB] [kB] ; -------------------------------------------------------------------------------- ; EFM32PG1B100F128 128. 32. ; EFM32PG1B200F128 128. 32. ; EFM32PG1B100F256 128. 32. ; EFM32PG1B200F256 256. 32. ; EFM32PG12B500F1024 1024. 256. ; ; @Author: MAM ; @Copyright: (C) 1989-2022 Lauterbach GmbH, licensed for use with TRACE32(R) only ; @Chip: EFM32PG1* ; -------------------------------------------------------------------------------- ; $Rev: 12717 $ ; $Id: efm32pg1.cmm 12717 2023-11-14 13:09:03Z mschaeffner $ LOCAL ¶meters ¶m_prepareonly ENTRY %LINE ¶meters ¶m_prepareonly=(STRing.SCAN(STRing.UPpeR("¶meters"),"PREPAREONLY",0)!=-1) LOCAL ¶m_cpu ¶m_cpu=STRing.SCANAndExtract("¶meters","CPU=","") LOCAL &FlashSize ; ------------------------------------------------------------------------------ ; Start debugging IF SYStem.MODE()<5 ( SYStem.RESet IF "¶m_cpu"!="" SYStem.CPU ¶m_cpu IF !CPUIS(EFM32PG1*) SYStem.CPU EFM32PG1* SYStem.Option.ResBreak OFF IF CABLE.TWOWIRE() ( SYStem.CONFIG.DEBUGPORTTYPE SWD ) ELSE ( PRINT %ERROR "Serial Wire Debug (SWD) not supported by debug cable" ENDDO ) SYStem.JtagClock 500Khz SYStem.Up ; After SYStem.Up the JTAG clock can be set to higher frequency. SYStem.JtagClock 10Mhz ) ; ------------------------------------------------------------------------------ ; Flash declaration IF CPUIS(*F128*) &FlashSize=0x20000 ELSE IF CPUIS(*F256*) &FlashSize=0x40000 ELSE IF CPUIS(*F1024*) &FlashSize=0x100000 ELSE ( PRINT %ERROR "FLASH size of CPU type is not supported by the script" ENDDO ) FLASH.RESet FLASH.Create 1. 0x00000000++(&FlashSize-1) 0x800 TARGET Byte FLASH.TARGET 0x10000000 0x10001000 0x800 ~~/demo/arm/flash/long/efm32.bin ; 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