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

157 lines
3.9 KiB
Plaintext

; --------------------------------------------------------------------------------
; @Title: Generic script for Fujitsu MB9A130L and MB9A130LA series internal flash
;
; @Description:
; Example for flash declaration of Fujitsu MB9A130L and MB9A130LA series
; internal flash.
;
; Script arguments:
;
; DO mb9a130l [PREPAREONLY] [CPU=<cpu>]
;
; PREPAREONLY only declares flash but does not execute flash programming
;
; CPU=<cpu> selects CPU derivative <cpu>
;
; Example:
;
; DO ~~/demo/arm/flash/mb9a130l CPU=MB9AF132L PREPAREONLY
;
; List of MB9A130L and MB9A130LA series derivatives and their configuration:
;
; CPU-Type Derivatives FlashSize RamSize
; [kB] [kB]
; --------------------------------------------------------------------------------
; MB9AF131K MB9AF131KA 64. 8.
; MB9AF131L MB9AF131LA 64. 8.
; MB9AF132K MB9AF132KA 128. 8.
; MB9AF132L MB9AF132LA 128. 8.
;
; @Author: WRD
; @Copyright: (C) 1989-2022 Lauterbach GmbH, licensed for use with TRACE32(R) only
; @Chip: MB9AF13?L* MB9AF13?K*
; --------------------------------------------------------------------------------
; $Rev: 10516 $
; $Id: mb9a130l.cmm 10516 2022-02-02 11:39:30Z bschroefel $
LOCAL &parameters &param_prepareonly
ENTRY %LINE &parameters
&param_prepareonly=(STRing.SCAN(STRing.UPpeR("&parameters"),"PREPAREONLY",0)!=-1)
LOCAL &param_cpu
&param_cpu=STRing.SCANAndExtract(STRing.UPpeR("&parameters"),"CPU=","")
; ------------------------------------------------------------------------------
; Start debugging
IF SYStem.MODE()<5
(
Break.RESet
SYStem.RESet
IF "&param_cpu"!=""
SYStem.CPU &param_cpu
IF !CPUIS(MB9AF13?L*)&&!CPUIS(MB9AF13?K*)
SYStem.CPU MB9AF13*
IF CABLE.TWOWIRE()
SYStem.CONFIG.DEBUGPORTTYPE SWD
ELSE
SYStem.CONFIG.DEBUGPORTTYPE JTAG
SYStem.Option.ResBreak OFF
SYStem.Up
)
; ------------------------------------------------------------------------------
; Flash declaration
FLASH.RESet
GOSUB FlashDeclaration
; ------------------------------------------------------------------------------
; Flash programming example
; Flash script ends here if called with parameter PREPAREONLY
IF &param_prepareonly
ENDDO PREPAREDONE
DIALOG.YESNO "Program flash memory?"
LOCAL &progflash
ENTRY &progflash
IF &progflash
(
; Disable watchdogs
GOSUB disableWatchdog
; Program flash
FLASH.ReProgram.ALL /Erase
Data.LOAD.auto *
FLASH.ReProgram.off
; Reset device
SYStem.Down
SYStem.Up
)
ENDDO
; --------------------------------------------------------------------------------
; Flash declaration depending on selected CPU
FlashDeclaration:
LOCAL &FlashSize
IF CPUIS("MB9AF131L*")||CPUIS("MB9AF131K*")
(
&FlashSize=0x10000
)
ELSE IF CPUIS("MB9AF132L*")||CPUIS("MB9AF132K*")
(
&FlashSize=0x20000
)
ELSE
(
PRINT %ERROR "FLASH size of CPU type is unknown"
ENDDO
)
IF &FlashSize>=0x10000
(
FLASH.Create 1. 0x000000--0x000FFF 0x1000 TARGET Word
FLASH.Create 1. 0x001000--0x00FFFF 0xF000 TARGET Word
)
IF &FlashSize>=0x20000
(
FLASH.Create 1. 0x010000--0x01FFFF 0x10000 TARGET Word
)
FLASH.TARGET 0x20000000 0x20000800 0x1000 ~~/demo/arm/flash/word/fm3t3.bin
RETURN
; --------------------------------------------------------------------------------
; Disable hardware and software watchdog
disableWatchdog:
; Hardware watchdog
IF (Data.Byte(SD:0x40011008)&0x01)==0x01
(
Data.Set SD:0x40011C00 %Long 0x1ACCE551
Data.Set SD:0x40011C00 %Long 0xE5331AAE
Data.Set SD:0x40011008 %Byte 0x00
)
; Software watchdog
IF (Data.Byte(SD:0x40012008)&0x01)==0x01
(
Data.Set SD:0x40012C00 %Long 0x1ACCE551
Data.Set SD:0x40012008 %Byte 0x00
Data.Set SD:0x40012C00 %Long 0x00000000
)
RETURN