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

123 lines
3.7 KiB
Plaintext

; ---------------------------------------------------------------------------------
; @Title: Flash declaration for Analog Devices ADuCM302x internal Flash derivatives
;
; @Description:
; Script arguments:
; DO aducm302x [PREPAREONLY] [CPU=<cpu>] [DUALPORT=<0|1>]
; PREPAREONLY only declares Flash but does not execute Flash programming
; CPU=<cpu> selects CPU derivative <cpu>
; DUALPORT=<0|1> use dual port memory access, default 1
; Example:
; DO ~~/demo/arm/flash/aducm302x PREPAREONLY
; Note:
; 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 ADuCM302* derivatives:
; CPU-Type Flash Size
; [KB]
; --------------------------------
; ADuCM3027 128
; ADuCM3029 256
;
; @Author: NEZ
; @Copyright: (C) 1989-2023 Lauterbach GmbH, licensed for use with TRACE32(R) only
; @Chip: ADuCM302*
; --------------------------------------------------------------------------------
; $Rev: 12164 $
; $Id: aducm302x.cmm 12164 2023-06-01 15:38:02Z nzouari $
PRIVATE &parameters
ENTRY %LINE &parameters
PRIVATE &param_prepareonly &param_cpu &param_dualport
&parameters=STRing.UPpeR("&parameters")
&param_prepareonly=(STRing.SCAN("&parameters","PREPAREONLY",0)!=-1)
&param_cpu=STRing.SCANAndExtract("&parameters","CPU=","")
&param_dualport=STRing.SCANAndExtract("&parameters","DUALPORT=","1")
; --------------------------------------------------------------------------------
; Initialize and start the debugger
IF !SYStem.Up()
(
SYStem.RESet
IF "&param_cpu"!=""
SYStem.CPU &param_cpu
IF (!CPUIS(ADUCM302*))
SYStem.CPU ADUCM302*
SYStem.Option.ResBreak OFF
SYStem.CONFIG.DEBUGPORTTYPE SWD
SYStem.JtagClock 1MHz
SYStem.Up
)
; --------------------------------------------------------------------------------
; Flash declaration
FLASH.RESet
GOSUB FlashDeclaration "&param_dualport"
; Flash script ends here if called with parameter PREPAREONLY
IF &param_prepareonly
ENDDO PREPAREDONE
; --------------------------------------------------------------------------------
; Flash programming example
DIALOG.YESNO "Program Flash memory?"
PRIVATE &progflash
ENTRY &progflash
IF &progflash
(
FLASH.ReProgram ALL /Erase
Data.LOAD.auto *
FLASH.ReProgram off
; Reset device
SYStem.Down
SYStem.Up
)
; --------------------------------------------------------------------------------
; 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 &param_dualport
PRIVATE &SRAMAddress &FlashSize &PageSize &FlashDriver
&FlashDriver="aducm3029.bin"
&PageSize=0x800 ;ERASEPAGE=2KB
; Determine Flash size
IF CPUIS(ADuCM3027)
&FlashSize=0x20000
ELSE IF CPUIS(ADuCM3029)
&FlashSize=0x40000
ELSE
(
PRINT %ERROR "FLASH size of CPU type is not supported by the script"
ENDDO
)
FLASH.RESet
FLASH.Create 1. 0x00000000--0x000007FF &PageSize NOP Quad /INFO "Info Space"
IF CPUIS(ADuCM3027)
FLASH.Create 2. 0x00000800--(&FlashSize-1) &PageSize TARGET Quad /CENSORSHIP 0x0001FFF0--0x0001FFFF /INFO "User Space"
ELSE
FLASH.Create 2. 0x00000800--(&FlashSize-1) &PageSize TARGET Quad /CENSORSHIP 0x0003FFF0--0x0003FFFF /INFO "User Space"
FLASH.TARGET 0x20000000 0x20000800 0x400 ~~/demo/arm/flash/quad/&FlashDriver
RETURN
)