151 lines
4.5 KiB
Plaintext
151 lines
4.5 KiB
Plaintext
; --------------------------------------------------------------------------------
|
|
; @Title: Flash declaration for ST Micro STM32WLxx (incl. WLEx) internal flash
|
|
; @Description:
|
|
; Script arguments:
|
|
; DO stm32wlxx [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/stm32wlxx 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 STM32WL derivatives and their configuration:
|
|
; CPU-Type Flash RamSize
|
|
; [byte] [byte]
|
|
; --------------------------------------------------------------------------------
|
|
; STM32WL54CC 256K 64K
|
|
; STM32WL54JC 256K 64K
|
|
; STM32WL55CC 256K 64K
|
|
; STM32WL55JC 256K 64K
|
|
; STM32WLE4CC 256K 64K
|
|
; STM32WLE4JC 256K 64K
|
|
; STM32WLE5C8 64K 20K
|
|
; STM32WLE5CB 128K 48K
|
|
; STM32WLE5CC 256K 64K
|
|
; STM32WLE5J8 64K 20K
|
|
; STM32WLE5JB 128K 48K
|
|
; STM32WLE5JC 256K 64K
|
|
;
|
|
; @Chip: STM32WL*
|
|
; @Author: BWR
|
|
; @Copyright: (C) 1989-2022 Lauterbach GmbH, licensed for use with TRACE32(R) only
|
|
; --------------------------------------------------------------------------------
|
|
; $Rev: 10516 $
|
|
; $Id: stm32wlxx.cmm 10516 2022-02-02 11:39:30Z 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(STM32WL5???-CM4*)&&!CPUIS(STM32WLE*)
|
|
SYStem.CPU STM32WL*
|
|
IF CPUIS(STM32WL5???-CM0+)
|
|
(
|
|
PRINT %ERROR "Flash programming only supported from CM4 core"
|
|
ENDDO
|
|
)
|
|
|
|
SYStem.MemAccess DAP
|
|
|
|
IF CABLE.TWOWIRE()
|
|
SYStem.CONFIG DEBUGPORTTYPE SWD
|
|
ELSE
|
|
SYStem.CONFIG DEBUGPORTTYPE JTAG
|
|
|
|
SYStem.Option.ResBreak OFF
|
|
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?"
|
|
LOCAL &progflash
|
|
ENTRY &progflash
|
|
IF &progflash
|
|
(
|
|
FLASH.ReProgram ALL
|
|
Data.LOAD.auto *
|
|
FLASH.ReProgram OFF
|
|
|
|
; Reset device
|
|
SYStem.Down
|
|
SYStem.Up
|
|
)
|
|
|
|
ENDDO
|
|
|
|
; --------------------------------------------------------------------------------
|
|
; 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 ¶m_dualport
|
|
PRIVATE &FlashDriver &FlashSize &FlashSizeUnsecured
|
|
|
|
IF (CPUIS(STM32WL????-CM4*)||CPUIS(STM32WLE*))
|
|
(
|
|
&FlashDriver="stm32wl.bin"
|
|
)
|
|
ELSE
|
|
(
|
|
PRINT "CPU not supported by this script"
|
|
ENDDO
|
|
)
|
|
|
|
&FlashSize=Data.Word(ASD:0x1FFF75E0)*0x400
|
|
|
|
IF CPUIS(STM32WLE*)
|
|
(
|
|
FLASH.Create 1. 0x08000000++(&FlashSize-0x1) 0x800 TARGET quad
|
|
)
|
|
ELSE IF CPUIS(STM32WL5*)
|
|
(
|
|
&FlashSizeUnsecured=(Data.Long(ASD:0x58004080)&0x7F)*0x800
|
|
|
|
FLASH.Create 1. 0x08000000++(&FlashSizeUnsecured-0x1) 0x800 TARGET quad
|
|
FLASH.Create 1. (0x08000000+&FlashSizeUnsecured)--(0x08000000+(&FlashSize-0x1)) 0x800 NOP quad /INFO "Secured flash"
|
|
)
|
|
|
|
IF (("¶m_dualport"!="1")||SYStem.ACCESS.DENIED())
|
|
FLASH.TARGET 0x20000000 0x20001000 0x1000 ~~/demo/arm/flash/byte/&FlashDriver
|
|
ELSE
|
|
FLASH.TARGET 0x20000000 E:0x20001000 0x1000 ~~/demo/arm/flash/byte/&FlashDriver /DualPort
|
|
|
|
RETURN
|
|
)
|