Files
2025-10-14 09:52:32 +09:00

164 lines
4.9 KiB
Plaintext

; --------------------------------------------------------------------------------
; @Title: Flash declaration for Renesas RA2A internal flash derivatives
; @Description:
; Script arguments:
; DO ra2a [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/ra2a 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 RA2A* derivatives and their configuration:
; CPU-Type Code Flash Data Flash RamSize
; [KB] [KB] [KB]
; --------------------------------------------------------------------------------
; R7FA2A1AB* 256 8 32
; R7FA2A2* 512 8 48
;
; @Chip: R7FA2A1*
; @Author: NEZ
; @Copyright: (C) 1989-2023 Lauterbach GmbH, licensed for use with TRACE32(R) only
; --------------------------------------------------------------------------------
; $Rev: 13479 $
; $Id: ra2a.cmm 13479 2024-05-24 11:51:51Z mtrabelsi $
PRIVATE &parameters
ENTRY %LINE &parameters
PRIVATE &param_prepareonly &param_cpu &param_dualport
&parameters=STRing.UPpeR("&parameters")
&param_prepareonly=(STRing.SCAN("&parameters","PREPAREONLY",0)!=-1)
&param_cpu=STRing.SCANAndExtract("&parameters","CPU=","")
&param_dualport=STRing.SCANAndExtract("&parameters","DUALPORT=","1")
; --------------------------------------------------------------------------------
; Initialize and start the debugger
IF !SYStem.Up()
(
SYStem.RESet
IF "&param_cpu"!=""
SYStem.CPU &param_cpu
IF (!CPUIS(R7FA2A*))
SYStem.CPU R7FA2A*
SYStem.MemAccess DAP
Trace.DISable
IF CABLE.TWOWIRE()
SYStem.CONFIG.DEBUGPORTTYPE SWD
ELSE
SYStem.CONFIG.DEBUGPORTTYPE JTAG
SYStem.Up
)
; --------------------------------------------------------------------------------
; Flash declaration
FLASH.RESet
GOSUB FlashDeclaration "&param_dualport"
; Flash script ends here if called with parameter PREPAREONLY
IF &param_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 &param_dualport
PRIVATE &SRAMAddress &FlashDriver &CodeFlashSize &DataFlashSize &CodeSectorSize &DataSectorSize &flash1_opt &flash2_opt
&CodeSectorSize=0x800
&DataSectorSize=0x400
IF CPUIS(R7FA2A1AB*)
(
&FlashDriver="mf3.bin"
&SRAMAddress=0x20000000
&CodeFlashSize=0x40000
)
ELSE IF CPUIS(R7FA2A2*)
(
&FlashDriver="ra2a2.bin"
&SRAMAddress=0x20004000
&CodeFlashSize=0x80000
)
ELSE
(
PRINT %ERROR "Code FLASH size of CPU type is not supported by the script"
ENDDO
)
; Determine data flash size
IF (CPUIS(R7FA2A1AB*) || CPUIS(R7FA2A2*))
&DataFlashSize=0x2000
ELSE
(
PRINT %ERROR "Data FLASH size of CPU type is not supported by the script"
ENDDO
)
; Determine the location of the option setting memory inside the program flash
&flash1_opt=""
&flash2_opt=""
IF (Data.Long(ASD:0x01010010)&0x80000000)==0x80000000 ; AWS.BTFLG
&flash1_opt="/CENSORSHIP 0x0400--0x07FF"
ELSE
&flash2_opt="/CENSORSHIP 0x2400--0x243B"
FLASH.Create 1. 0x00000000--0x00001FFF &CodeSectorSize TARGET Long &flash1_opt
FLASH.Create 1. 0x00002000--0x00003FFF &CodeSectorSize TARGET Long &flash2_opt
FLASH.Create 1. 0x00004000--(&CodeFlashSize-1) &CodeSectorSize TARGET Long
FLASH.Create 2. 0x01010008++0x3 NOP Long /INFO "AWSC"
FLASH.Create 2. 0x01010010++0x3 NOP Long /INFO "AWS"
FLASH.Create 2. 0x01010018++0x3 NOP Long /INFO "OSIS"
FLASH.Create 2. 0x01010020++0x3 NOP Long /INFO "OSIS"
FLASH.Create 2. 0x01010028++0x3 NOP Long /INFO "OSIS"
FLASH.Create 2. 0x01010030++0x3 NOP Long /INFO "OSIS"
FLASH.Create 3. 0x40100000++(&DataFlashSize-1) &DataSectorSize TARGET Long
IF (("&param_dualport"!="1")||SYStem.ACCESS.DENIED())
FLASH.TARGET &SRAMAddress &SRAMAddress+0x1000 0x1000 ~~/demo/arm/flash/long/&FlashDriver
ELSE
FLASH.TARGET &SRAMAddress E:&SRAMAddress+0x1000 0x1000 ~~/demo/arm/flash/long/&FlashDriver /DualPort
RETURN
)