149 lines
3.9 KiB
Plaintext
149 lines
3.9 KiB
Plaintext
; --------------------------------------------------------------------------------
|
|
; @Title: Example for flash declaration of TI Stellaris LM4F130 internal flash.
|
|
;
|
|
; @Description:
|
|
; Synopsis:
|
|
;
|
|
; do ~~/demo/arm/flash/lm4f130 [<cpu>] [PREPAREONLY]
|
|
;
|
|
; Description:
|
|
;
|
|
; Script arguments are not case sensitive.
|
|
;
|
|
; <cpu>
|
|
; is the CPU name argument out of the table listed below. If debug
|
|
; connection is not already established CPU name argument is used for
|
|
; CPU selection. Without CPU name argument and no LM4F130 CPU is
|
|
; selected the script is using default CPU selection LM4F132H5QD.
|
|
;
|
|
; PREPAREONLY only declares flash but does not execute flash programming
|
|
;
|
|
; Example:
|
|
;
|
|
; do ~~/demo/arm/flash/lm4f130 LM4F130C4QR PREPAREONLY
|
|
;
|
|
; List of LM4F130 derivatives and their configuration:
|
|
;
|
|
; CPU-Type ProgFlash EEPROM RamSize
|
|
; --------------------------------------------------------------------------------
|
|
; LM4F130C4QR 64kB 2kB 24kB
|
|
; LM4F130E5QR 128kB 2kB 32kB
|
|
; LM4F130H5QR 256kB 2kB 32kB
|
|
; LM4F131C4QR 64kB 2kB 24kB
|
|
; LM4F131E5QR 128kB 2kB 32kB
|
|
; LM4F131H5QR 256kB 2kB 32kB
|
|
; LM4F132C4QC 64kB 2kB 24kB
|
|
; LM4F132E5QC 128kB 2kB 32kB
|
|
; LM4F132H5QC 256kB 2kB 32kB
|
|
; LM4F132H5QD 256kB 2kB 32kB
|
|
;
|
|
; @Author: WRD
|
|
; @Copyright: (C) 1989-2022 Lauterbach GmbH, licensed for use with TRACE32(R) only
|
|
; @Chip: LM4F130*
|
|
; --------------------------------------------------------------------------------
|
|
; $Rev: 10516 $
|
|
; $Id: lm4f130.cmm 10516 2022-02-02 11:39:30Z bschroefel $
|
|
|
|
LOCAL ¶meters
|
|
ENTRY %LINE ¶meters
|
|
|
|
LOCAL ¶m_prepareonly
|
|
¶m_prepareonly=(STRing.SCAN(STRing.UPpeR("¶meters"),"PREPAREONLY",0)!=-1)
|
|
|
|
LOCAL &cpu
|
|
&cpu="LM4F13"+STRing.SCANAndExtract(STRing.UPpeR("¶meters"),"LM4F13","")
|
|
|
|
; Setup CPU selection for the case script is called without argument.
|
|
IF "&cpu"=="LM4F13"
|
|
(
|
|
IF CPUIS(LM4F13*)
|
|
&cpu=SYStem.CPU()
|
|
ELSE
|
|
&cpu="LM4F132H5QD"
|
|
)
|
|
|
|
; ------------------------------------------------------------------------------
|
|
; Start debugging
|
|
|
|
IF SYStem.MODE()<5
|
|
(
|
|
SYStem.RESet
|
|
SYStem.CPU &cpu
|
|
IF CABLE.TWOWIRE()
|
|
(
|
|
SYStem.CONFIG.DEBUGPORTTYPE SWD
|
|
)
|
|
ELSE
|
|
(
|
|
SYStem.CONFIG.DEBUGPORTTYPE JTAG
|
|
)
|
|
SYStem.Up
|
|
)
|
|
|
|
; ------------------------------------------------------------------------------
|
|
; Flash declaration
|
|
|
|
FLASH.RESet
|
|
GOSUB FlashDeclaration
|
|
|
|
; In case of empty flash disable RMCTL:BA (ROM Control register Boot
|
|
; Alias bit) to show flash contents at address 0x0
|
|
IF (Data.Long(ASD:0x400FE0F0)&0x01)==0x01
|
|
Data.Set ASD:0x400FE0F0 %Long 0x01
|
|
|
|
; 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
|
|
|
|
|
|
; --------------------------------------------------------------------------------
|
|
; Flash declaration depending on CPU selection
|
|
|
|
FlashDeclaration:
|
|
LOCAL &FlashSize
|
|
|
|
IF CPUIS("LM4F13?C?Q?")
|
|
(
|
|
&FlashSize=0x10000
|
|
)
|
|
ELSE IF CPUIS("LM4F13?E?Q?")
|
|
(
|
|
&FlashSize=0x20000
|
|
)
|
|
ELSE IF CPUIS("LM4F13?H?Q?")
|
|
(
|
|
&FlashSize=0x40000
|
|
)
|
|
ELSE
|
|
(
|
|
PRINT %ERROR "FLASH size of CPU type is not supported by the script"
|
|
ENDDO
|
|
)
|
|
|
|
;IF (Data.Long(SD:0x400FE358)&0x01)==0x01
|
|
; PRINT "EEPROM module is present"
|
|
|
|
FLASH.Create 1. 0x0++(&FlashSize-1) 0x400 TARGET Long
|
|
FLASH.TARGET 0x20000000 0x20000800 0x400 ~~/demo/arm/flash/long/lm4f.bin
|
|
|
|
RETURN
|