115 lines
3.4 KiB
Plaintext
115 lines
3.4 KiB
Plaintext
; --------------------------------------------------------------------------------
|
|
; @Title: Flash declaration for Texas Instruments MSP432 family internal flash
|
|
; @Description:
|
|
; Script arguments:
|
|
;
|
|
; DO msp432 [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 0
|
|
; Example:
|
|
; DO ~~/demo/arm/flash/msp432 PREPAREONLY
|
|
;
|
|
; List of MSP432P401M derivatives and their configuration:
|
|
; CPU-Type Flash RamSize
|
|
; [KB] [KB]
|
|
; MSP432P401M 128 32
|
|
; MSP432P401R 256 64
|
|
;
|
|
; @Chip: MSP432*
|
|
; @Author: MAM
|
|
; @Copyright: (C) 1989-2022 Lauterbach GmbH, licensed for use with TRACE32(R) only
|
|
; --------------------------------------------------------------------------------
|
|
; $Rev: 12049 $
|
|
; $Id: msp432.cmm 12049 2023-04-20 12:32:16Z bschroefel $
|
|
|
|
PRIVATE ¶meters
|
|
ENTRY %LINE ¶meters
|
|
|
|
PRIVATE ¶m_prepareonly ¶m_cpu ¶m_dualport
|
|
¶meters=STRing.UPpeR("¶meters")
|
|
¶m_prepareonly=(STRing.SCAN("¶meters","PREPAREONLY",0)!=-1)
|
|
¶m_cpu=STRing.SCANAndExtract("¶meters","CPU=","")
|
|
¶m_dualport=STRing.SCANAndExtract("¶meters","DUALPORT=","0")
|
|
|
|
; --------------------------------------------------------------------------------
|
|
; Initialize and start the debugger
|
|
IF !SYStem.Up()
|
|
(
|
|
SYStem.RESet
|
|
|
|
IF "¶m_cpu"!=""
|
|
SYStem.CPU ¶m_cpu
|
|
IF !CPUIS(MSP432*)
|
|
SYStem.CPU MSP432*
|
|
|
|
SYStem.JtagClock 5Mhz
|
|
SYStem.CONFIG.DEBUGPORTTYPE SWD
|
|
SYStem.Option.WaitReset 10ms
|
|
SYStem.Up
|
|
)
|
|
|
|
; --------------------------------------------------------------------------------
|
|
; Flash declaration
|
|
FLASH.RESet
|
|
GOSUB FlashDeclaration "¶m_dualport"
|
|
|
|
; Flash script ends here if called with parameter PREPAREONLY
|
|
IF ¶m_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
|
|
)
|
|
|
|
ENDDO
|
|
|
|
; --------------------------------------------------------------------------------
|
|
; SUBROUTINES
|
|
|
|
; --------------------------------------------------------------------------------
|
|
; Flash declaration depending on selected CPU
|
|
FlashDeclaration: ;(param_dualport)
|
|
(
|
|
PARAMETERS ¶m_dualport
|
|
|
|
PRIVATE &FlashSectorSize
|
|
PRIVATE &FlashBase &FlashSize
|
|
PRIVATE &FlashInfoBase &FlashInfoSize
|
|
|
|
|
|
&FlashSectorSize=0x1000 // we use the smallet possible sector size of 4K
|
|
&FlashBase=0x00000000
|
|
&FlashSize=0x20000
|
|
&FlashInfoBase=0x200000
|
|
&FlashInfoSize=0x2000
|
|
|
|
|
|
FLASH.Create 1. &FlashBase++(&FlashSize-1) &FlashSectorSize TARGET Long 0x10000000 /AutoInc
|
|
FLASH.Create 3. &FlashInfoBase++(&FlashInfoSize-1) &FlashSectorSize TARGET Long 0x30000000 /AutoInc
|
|
IF CPUIS(MSP432P401R)
|
|
(
|
|
FLASH.Create 2. (&FlashBase+&FlashSize)++(&FlashSize-1) &FlashSectorSize TARGET Long 0x20000000 /AutoInc
|
|
FLASH.Create 4. (&FlashInfoBase+&FlashInfoSize)++(&FlashInfoSize-1) &FlashSectorSize TARGET Long 0x40000000 /AutoInc
|
|
)
|
|
|
|
IF "¶m_dualport"=="0"
|
|
FLASH.TARGET 0x01000000 0x01001000 0x1000 ~~/demo/arm/flash/long/msp432.bin
|
|
ELSE
|
|
FLASH.TARGET 0x01000000 E:0x01001000 0x1000 ~~/demo/arm/flash/long/msp432.bin /DualPort
|
|
|
|
RETURN
|
|
)
|