138 lines
4.1 KiB
Plaintext
138 lines
4.1 KiB
Plaintext
; --------------------------------------------------------------------------------
|
|
; @Title: Internal FLASH Programming Script of ST STM32C0xx Derivatives
|
|
|
|
; @Description:
|
|
; Script arguments:
|
|
; DO stm32c0xx [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/stm32c0xx 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 STM32C0* derivatives and their configuration:
|
|
; CPU-Type FlashSize RamSize
|
|
; [KB] [KB]
|
|
; ------------------------------------------
|
|
; STM32C011D6 32. 12.
|
|
; STM32C011F4 16. 12.
|
|
; STM32C011F6 32. 12.
|
|
; STM32C011J4 16. 12.
|
|
; STM32C011J6 32. 12.
|
|
; STM32C031C4 16. 12.
|
|
; STM32C031C6 32. 12.
|
|
; STM32C031F4 16. 12.
|
|
; STM32C031F6 32. 12.
|
|
; STM32C031G4 16. 12.
|
|
; STM32C031G6 32. 12.
|
|
; STM32C031K4 16. 12.
|
|
; STM32C031K6 32. 12.
|
|
;
|
|
; @Chip: STM32C0*
|
|
; @Author: NEZ
|
|
; @Copyright: (C) 1989-2024 Lauterbach GmbH, licensed for use with TRACE32(R) only
|
|
; --------------------------------------------------------------------------------
|
|
; $Rev: 13527 $
|
|
; $Id: stm32c0xx.cmm 13527 2024-06-05 09:29:00Z nzouari $
|
|
|
|
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=","1")
|
|
|
|
; --------------------------------------------------------------------------------
|
|
; Initialize and start the debugger
|
|
IF !SYStem.Up()
|
|
(
|
|
SYStem.RESet
|
|
|
|
IF "¶m_cpu"!=""
|
|
SYStem.CPU ¶m_cpu
|
|
IF (!CPUIS(STM32C0*))
|
|
SYStem.CPU STM32C0*
|
|
|
|
SYStem.MemAccess DAP
|
|
|
|
IF CABLE.TWOWIRE()
|
|
SYStem.CONFIG.DEBUGPORTTYPE SWD
|
|
ELSE
|
|
SYStem.CONFIG.DEBUGPORTTYPE JTAG
|
|
|
|
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
|
|
;
|
|
; 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 &SRAMAddress &FlashDriver &FlashSize &SectorSize
|
|
|
|
IF CPUIS("STM32C0???4")
|
|
&FlashSize=0x4000
|
|
ELSE IF CPUIS("STM32C0???6")
|
|
&FlashSize=0x8000
|
|
ELSE
|
|
(
|
|
PRINT %ERROR "FLASH size of CPU type is unknown"
|
|
ENDDO
|
|
)
|
|
|
|
&FlashDriver="stm32c0.bin"
|
|
&SectorSize=0x800
|
|
|
|
FLASH.Create 1. 0x08000000++(&FlashSize-1) &SectorSize TARGET Byte
|
|
|
|
IF (("¶m_dualport"!="1")||SYStem.ACCESS.DENIED())
|
|
FLASH.TARGET 0x20000000++0xFFF 0x20001000++0xFFF ~~/demo/arm/flash/byte/&FlashDriver
|
|
ELSE
|
|
FLASH.TARGET E:0x20000000++0xFFF 0x20001000++0xFFF ~~/demo/arm/flash/byte/&FlashDriver /DualPort
|
|
|
|
RETURN
|
|
)
|
|
|