Files
Gen4_R-Car_Trace32/2_Trunk/demo/arm/flash/sr6p7g7.cmm
2025-10-14 09:52:32 +09:00

247 lines
7.7 KiB
Plaintext

; --------------------------------------------------------------------------------
; @Title: Flash declaration for ST SR6P7G7 internal flash
; @Description:
; Script arguments:
; DO sr6p7g7 [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
; SKIPPARITYRESET skips the default behavior of zeroing SRAM to avoid faults
;
; Example:
; DO ~~/demo/arm/flash/sr6p7g7 PREPAREONLY SKIPPARITYRESET
;
; 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 SR6x7 derivatives and their configuration:
; CPU-Type Flash Code/Data Ram
; --------------------------------------------------------------------------------
; SR6P7x 19 MB/512 KB 3.8 MB
; SR6G7x 19 MB/512 KB 3.3 MB
;
; Flash is divided into NVM0--2, UTest (one-time-programmable), and HSM NVM
; RAM is divided into 512/560 KB system RAM global memory 0 at 0x64000000
; global memory 1 at 0x64000000
; 2304/2816 KB Cluster local RAM at 0x60000000
; 576 KB Local Core RAM
;
; @Chip: SR6P7*
; @Author: PHI, BWR
; @Keywords: SR6P7G7 FLASH
; @Copyright: (C) 1989-2022 Lauterbach GmbH, licensed for use with TRACE32(R) only
; --------------------------------------------------------------------------------
; $Rev: 13228 $
; $Id: sr6p7g7.cmm 13228 2024-03-20 15:07:23Z bschroefel $
PRIVATE &parameters
ENTRY %LINE &parameters
PRIVATE &param_prepareonly &param_cpu &param_dualport &skip_parity_reset
&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")
&param_skipparityreset=(STRing.SCAN("&parameters","SKIPPARITYRESET",0)!=-1)
; --------------------------------------------------------------------------------
; Initialize and start the debugger
IF !SYStem.Up()
(
SYStem.RESet
IF "&param_cpu"!=""
SYStem.CPU &param_cpu
ELSE
SYStem.CPU SR6P7-G7
CORE.ASSIGN 1.
SYStem.Option WaitDBGREG ON
Trace.DISable
SYStem.Up
)
IF !CPUIS(SR6P7*)
(
PRINT "Wrong CPU"
ENDDO
)
IF STATE.RUN()
Break.direct
IF (&param_skipparityreset)
(
Data.Set NAXI:0x60000000--0x600023FF %Quad 0x0 ; Allocate for flash binary
)
ELSE
(
; Initialize all RAM to ensure parity checking
Data.Set NAXI:0x60000000--0x6007FFFF %Quad 0x0
Data.Set NAXI:0x60400000--0x6047FFFF %Quad 0x0
Data.Set NAXI:0x60800000--0x6085FFFF %Quad 0x0
Data.Set NAXI:0x60C00000--0x60C5FFFF %Quad 0x0
Data.Set NAXI:0x61000000--0x6103FFFF %Quad 0x0
Data.Set NAXI:0x61400000--0x6143FFFF %Quad 0x0
)
GOSUB DisableWatchdog
GOSUB WatchdogDisabled
; --------------------------------------------------------------------------------
; Flash declaration
FLASH.RESet
GOSUB FlashDeclaration "&param_dualport"
; Deny write accesses by software breakpoints on NVM read port to avoid errors.
; Deny read accesses on NVWM write port to avoid errors.
MAP.BOnchip 0x28000000--0x2FFFFFFF
MAP.DenyAccess 0x30000000--0x337FFFFF
; 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
; --------------------------------------------------------------------------------
; 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 &FlashDriver
PRIVATE &RamAddress
PRIVATE &NVM_0 &NVM_0_UT &NVM_1 &NVM_2
&NVM_0=0x711BC000
&NVM_0_UT=0x711BC001
&NVM_1=0x717BC000
&NVM_2=0x711C4000
&RamAddress=0x60000000 // Cluster_0 Local RAM
IF CPUIS(SR6P7*)
(
&FlashDriver="sr6p7.bin"
)
// RWW partition 0 = Cluster 0_0
FLASH.Create 1. 0x28000000--0x2800FFFF 0x4000 TARGET quad &NVM_0
FLASH.Create 1. 0x28010000--0x2801FFFF 0x8000 TARGET quad &NVM_0
FLASH.Create 1. 0x28020000--0x2803FFFF 0x10000 TARGET quad &NVM_0
FLASH.Create 1. 0x28040000--0x281BFFFF 0x40000 TARGET quad &NVM_0
// RWW partition 1 = Cluster 0_0
FLASH.Create 2. 0x281C0000--0x283BFFFF 0x40000 TARGET quad &NVM_0
// RWW partition 2 = Cluster 0_1
FLASH.Create 3. 0x28400000--0x2840FFFF 0x4000 TARGET quad &NVM_0
FLASH.Create 3. 0x28410000--0x2841FFFF 0x8000 TARGET quad &NVM_0
FLASH.Create 3. 0x28420000--0x2843FFFF 0x10000 TARGET quad &NVM_0
FLASH.Create 3. 0x28440000--0x285BFFFF 0x40000 TARGET quad &NVM_0
// RWW partition 3 = Cluster 0_1
FLASH.Create 4. 0x285C0000--0x287BFFFF 0x40000 TARGET quad &NVM_0
// RWW partition 4 = Cluster 1_0
FLASH.Create 5. 0x28800000--0x2880FFFF 0x4000 TARGET quad &NVM_1
FLASH.Create 5. 0x28810000--0x2881FFFF 0x8000 TARGET quad &NVM_1
FLASH.Create 5. 0x28820000--0x2883FFFF 0x10000 TARGET quad &NVM_1
FLASH.Create 5. 0x28840000--0x289FFFFF 0x40000 TARGET quad &NVM_1
// RWW partition 5 = Cluster 1_0
FLASH.Create 6. 0x28A00000--0x28BFFFFF 0x40000 TARGET quad &NVM_1
// RWW partition 6 = Cluster 1_1
FLASH.Create 7. 0x28C00000--0x28C0FFFF 0x4000 TARGET quad &NVM_1
FLASH.Create 7. 0x28C10000--0x28C1FFFF 0x8000 TARGET quad &NVM_1
FLASH.Create 7. 0x28C20000--0x28C3FFFF 0x10000 TARGET quad &NVM_1
FLASH.Create 7. 0x28C40000--0x28DFFFFF 0x40000 TARGET quad &NVM_1
// RWW partition 7 = Cluster 1_1
FLASH.Create 8. 0x28E00000--0x28FFFFFF 0x40000 TARGET quad &NVM_1
// RWW partition 8 = Cluster 2_0
FLASH.Create 9. 0x29000000--0x2900FFFF 0x4000 TARGET quad &NVM_2
FLASH.Create 9. 0x29010000--0x2901FFFF 0x8000 TARGET quad &NVM_2
FLASH.Create 9. 0x29020000--0x2903FFFF 0x10000 TARGET quad &NVM_2
FLASH.Create 9. 0x29040000--0x291FFFFF 0x40000 TARGET quad &NVM_2
// RWW partition 9 = Cluster 2_1
FLASH.Create 10. 0x29400000--0x2940FFFF 0x4000 TARGET quad &NVM_2
FLASH.Create 10. 0x29410000--0x2941FFFF 0x8000 TARGET quad &NVM_2
FLASH.Create 10. 0x29420000--0x2943FFFF 0x10000 TARGET quad &NVM_2
FLASH.Create 10. 0x29440000--0x295FFFFF 0x40000 TARGET quad &NVM_2
// RWW partition 10 = EEPROM Data
FLASH.Create 11. 0x29E00000--0x29E7FFFF 0x10000 TARGET quad &NVM_0 /INFO "EEPROM Data"
// UTest (RWW partition 1)
FLASH.Create 12. 0x29F80000--0x29F87DFF NOP quad &NVM_0_UT /INFO "UTEST"
// Boot record (RWW partition 1)
FLASH.Create 12. 0x29F87E00--0x29F87FFF 0x200 TARGET quad &NVM_0_UT /INFO "Boot records"
// BCS (RWW partition 1)
FLASH.Create 13. 0x29FB8000--0x29FBBFFF NOP quad &NVM_0_UT /INFO "BCS"
IF ("&param_dualport"!="1")
FLASH.TARGET &RamAddress &RamAddress+0x1000 0x1000 ~~/demo/arm/flash/quad/&FlashDriver
ELSE
(
SYStem.MemAccess AXI
FLASH.TARGET &RamAddress E:&RamAddress+0x1000 0x1000 ~~/demo/arm/flash/quad/&FlashDriver /DualPort
)
RETURN
)
DisableWatchdog:
(
PRIVATE &cr
//Disable SWT_SYS_0 Watchdog
&cr=Data.Long(EAXI:0x70F40000)
Data.Set EAXI:0x70F40010 %Long 0xC520
Data.Set EAXI:0x70F40010 %Long 0xD928
Data.Set EAXI:0x70F40000 %Long &cr&~0x1
RETURN
)
WatchdogDisabled:
(
IF (Data.Long(EAXI:0x70F40000)&0x1)==0x1
(
PRINT "SWT_SYS_0: Watchdog couldn't be disabled !"
STOP
)
RETURN
)