Files
2025-10-14 09:52:32 +09:00

149 lines
4.2 KiB
Plaintext

;
; @Title: Example for flash declaration of EnergyMicro EFM32 Pearl Gecko internal flash.
;
; @Description:
; Script arguments:
;
; DO efm32pg2 [PREPAREONLY] [CPU=<cpu>]
;
; PREPAREONLY only declares flash but does not execute flash programming
;
; CPU=<cpu> selects CPU derivative <cpu>
;
; Example:
;
; DO ~~/demo/arm/flash/efm32pg2 CPU=EFM32PG23B310F512 PREPAREONLY
;
; List of EFM32 Pearl Gecko derivatives and their configuration:
;
; CPU FlashSize RamSize
; Derivative [kB] [kB]
; --------------------------------------------------------------------------------
; EFM32PG22C200F32 32. 32.
; EFM32PG22C200F64 64. 32.
; EFM32PG22C200F128 128. 32.
; EFM32PG22C200F256 256. 32.
; EFM32PG22C200F512 512. 32.
; EFM32PG23B200F64 64. 32.
; EFM32PG23B200F128 128. 64.
; EFM32PG23B200F256 256. 64.
; EFM32PG23B200F512 512. 64.
; EFM32PG23B210F64 64. 32.
; EFM32PG23B210F128 128. 64.
; EFM32PG23B210F256 256. 64.
; EFM32PG23B210F512 512. 64.
; EFM32PG23B310F64 64. 32.
; EFM32PG23B310F128 128. 64.
; EFM32PG23B310F256 256. 64.
; EFM32PG23B310F512 512. 64.
; EFM32PG28B200F512 512. 128.
; EFM32PG28B210F1024 1024. 256.
; EFM32PG28B300F512 512. 128.
; EFM32PG28B310F1024 1024. 256.
;
; @Author: BWR
; @Copyright: (C) 1989-2022 Lauterbach GmbH, licensed for use with TRACE32(R) only
; @Chip: EFM32PG2*
; --------------------------------------------------------------------------------
; $Rev: 13437 $
; $Id: efm32pg2.cmm 13437 2024-05-13 14:40:13Z mtrabelsi $
LOCAL &parameters &param_prepareonly
ENTRY %LINE &parameters
&param_prepareonly=(STRing.SCAN(STRing.UPpeR("&parameters"),"PREPAREONLY",0)!=-1)
LOCAL &param_cpu
&param_cpu=STRing.SCANAndExtract("&parameters","CPU=","")
LOCAL &FlashSize
; ------------------------------------------------------------------------------
; Start debugging
IF SYStem.MODE()<5
(
SYStem.RESet
IF "&param_cpu"!=""
SYStem.CPU &param_cpu
IF !CPUIS(EFM32PG2*)
SYStem.CPU EFM32PG2*
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
)
; ------------------------------------------------------------------------------
; Power up MSC
Data.Set ZSD:0x50009068 %LE %Long 0x20000
; ------------------------------------------------------------------------------
; Flash declaration
IF CPUIS(*F32*)
&FlashSize=0x8000
ELSE IF CPUIS(*F64*)
&FlashSize=0x10000
ELSE IF CPUIS(*F128*)
&FlashSize=0x20000
ELSE IF CPUIS(*F256*)
&FlashSize=0x40000
ELSE IF CPUIS(*F512*)
&FlashSize=0x80000
ELSE IF CPUIS(*F1024*)
&FlashSize=0x100000
ELSE
(
PRINT %ERROR "FLASH size of CPU type is not supported by the script"
ENDDO
)
FLASH.RESet
IF CPUIS(EFM32PG22*)||CPUIS(EFM32PG23*)||CPUIS(EFM32PG28*)
(
FLASH.Create 1. 0x00000000++(&FlashSize-1) 0x2000 TARGET Byte
FLASH.TARGET 0x20000000 0x20001000 0x2000 ~~/demo/arm/flash/long/efm32pg23.bin
)
ELSE
(
PRINT %ERROR "FLASH of CPU type is not supported by the script"
ENDDO
)
; Flash script ends here if called with parameter PREPAREONLY
IF &param_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