132 lines
3.4 KiB
Plaintext
132 lines
3.4 KiB
Plaintext
; --------------------------------------------------------------------------------
|
|
; @Title: Example for flash declaration of Atmel ATSAMHA1G internal flash
|
|
; @Description:
|
|
; Script arguments:
|
|
;
|
|
; DO atsamha [PREPAREONLY] [CPU=<cpu>]
|
|
;
|
|
; PREPAREONLY only declares flash but does not execute flash programming
|
|
;
|
|
; CPU=<cpu> selects CPU derivative <cpu>
|
|
;
|
|
; Example:
|
|
;
|
|
; DO ~~/demo/arm/flash/atsamha CPU=ATSAMHA1G16A PREPAREONLY
|
|
;
|
|
; List of ATSAMHA* derivatives and their configuration:
|
|
;
|
|
; CPU-Type Flash size Page size SRAM size
|
|
; [Byte] [Byte] [Byte]
|
|
; ATSAMHA1G14A 0x04000 0x40 0x1000
|
|
; ATSAMHA1G15A 0x08000 0x40 0x2000
|
|
; ATSAMHA1G16A 0x10000 0x40 0x4000
|
|
;
|
|
; @Author: STK
|
|
; @Chip: ATSAMHA1G*
|
|
; @Copyright: (C) 1989-2022 Lauterbach GmbH, licensed for use with TRACE32(R) only
|
|
; --------------------------------------------------------------------------------
|
|
; $Rev: 10516 $
|
|
; $Id: atsamha.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=","")
|
|
|
|
IF VERSION.BUILD.BASE()<83614.
|
|
(
|
|
PRINT %ERROR "Trace32 software version is to old, please request an update."
|
|
ENDDO
|
|
)
|
|
|
|
; ------------------------------------------------------------------------------
|
|
; Setup CPU
|
|
|
|
IF SYStem.MODE()<5
|
|
(
|
|
SYStem.RESet
|
|
|
|
IF "¶m_cpu"!=""
|
|
SYStem.CPU ¶m_cpu
|
|
IF !CPUIS(ATSAMHA1G*)
|
|
SYStem.CPU ATSAMHA1G*
|
|
SYStem.CONFIG.DEBUGPORTTYPE SWD
|
|
SYStem.Option.ResBreak OFF
|
|
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:
|
|
LOCAL &FlashSize &FlashDriver
|
|
|
|
IF CPUIS("ATSAMHA1G14*")
|
|
(
|
|
&FlashSize=0x04000
|
|
&FlashDriver="atsamd2.bin"
|
|
)
|
|
ELSE IF CPUIS("ATSAMHA1G15*")
|
|
(
|
|
&FlashSize=0x08000
|
|
&FlashDriver="atsamd2.bin"
|
|
)
|
|
ELSE IF CPUIS("ATSAMHA1G16*")
|
|
(
|
|
&FlashSize=0x10000
|
|
&FlashDriver="atsamd2.bin"
|
|
)
|
|
ELSE
|
|
(
|
|
PRINT %ERROR "FLASH size of CPU type is unknown"
|
|
ENDDO
|
|
)
|
|
|
|
IF &FlashSize>=0x4000
|
|
FLASH.Create 1. 0x00000000--0x00003FFF 0x100 TARGET Long
|
|
IF &FlashSize>=0x8000
|
|
FLASH.Create 1. 0x00004000--0x00007FFF 0x100 TARGET Long
|
|
IF &FlashSize>=0x10000
|
|
FLASH.Create 1. 0x00008000--0x0000FFFF 0x100 TARGET Long
|
|
IF &FlashSize>=0x20000
|
|
FLASH.Create 1. 0x00010000--0x0001FFFF 0x100 TARGET Long
|
|
IF &FlashSize>=0x40000
|
|
FLASH.Create 1. 0x00020000--0x0003FFFF 0x100 TARGET Long
|
|
|
|
FLASH.TARGET 0x20000000 0x20000400 0x400 ~~/demo/arm/flash/long/&FlashDriver
|
|
|
|
RETURN
|