; -------------------------------------------------------------------------------- ; @Title: Flash declaration for Renesas RA2E internal flash derivativs ; @Description: ; Script arguments: ; DO ra2e [PREPAREONLY] [CPU=] [DUALPORT=<0|1>] ; PREPAREONLY only declares flash but does not execute flash programming ; CPU= selects CPU derivative ; DUALPORT=<0|1> use dual port memory access, default 1 ; Example: ; DO ~~/demo/arm/flash/ra2e 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 RA2E* derivatives and their configuration: ; CPU-Type Code Flash Data Flash RamSize ; [KB] [KB] [KB] ; -------------------------------------------------------------------------------- ; R7FA2E1A5* 32 4 16 ; R7FA2E1A7* 64 4 16 ; R7FA2E1A9* 128 4 16 ; R7FA2E307* 64 2 16 ; R7FA2E305* 32 2 16 ; ; @Chip: R7FA2E1*, R7FA2E3* ; @Author: NEZ ; @Copyright: (C) 1989-2023 Lauterbach GmbH, licensed for use with TRACE32(R) only ; -------------------------------------------------------------------------------- ; $Rev: 13479 $ ; $Id: ra2e.cmm 13479 2024-05-24 11:51:51Z mtrabelsi $ 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(R7FA2E*)) SYStem.CPU R7FA2E* 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 "¶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 &CodeFlashSize &DataFlashSize &CodeSectorSize &DataSectorSize &flash1_opt &flash2_opt &FlashDriver="ra2e1.bin" &CodeSectorSize=0x800 &DataSectorSize=0x400 &SRAMAddress=0x20004000 IF CPUIS(R7FA2E1A5*) &CodeFlashSize=0x8000 ELSE IF CPUIS(R7FA2E1A7*) &CodeFlashSize=0x10000 ELSE IF CPUIS(R7FA2E1A9*) &CodeFlashSize=0x20000 ELSE IF CPUIS(R7FA2E307*) &CodeFlashSize=0x10000 ELSE IF CPUIS(R7FA2E305*) &CodeFlashSize=0x8000 ELSE ( PRINT %ERROR "Code FLASH size of CPU type is not supported by the script" ENDDO ) ; Determine data flash size IF CPUIS(R7FA2E1A*) &DataFlashSize=0x1000 ELSE IF CPUIS(R7FA2E30*) &DataFlashSize=0x800 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--0x043B" 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. 0x01010010++0x3 NOP Long /INFO "AWS" FLASH.Create 2. 0x01010018++0x3 NOP Long /INFO "OCDID0" FLASH.Create 2. 0x01010020++0x3 NOP Long /INFO "OCDID1" FLASH.Create 2. 0x01010028++0x3 NOP Long /INFO "OCDID2" FLASH.Create 2. 0x01010030++0x3 NOP Long /INFO "OCDID3" FLASH.Create 3. 0x40100000++(&DataFlashSize-1) &DataSectorSize TARGET Long IF (("¶m_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 )