Files
Gen4_R-Car_Trace32/2_Trunk/demo/coverage/mcdc/measure_mcdc.cmm
2025-10-14 09:52:32 +09:00

203 lines
4.4 KiB
Plaintext

; --------------------------------------------------------------------------------
; @Title: Measure MC/DC
; @Description:
; Measure MC/DC for sample application using imported ECA data. Code coverage
; can be measured without, with full or targeted instrumentation.
;
; @Author: CSA
; @Board: RM57, LA-3854, T2080QDS, TWR-K70F120, DIGILENTARTIX7ARTY, SEAD A211
; @Chip: RM57L843-ZWT, MK70FN1M0VMJ12, MPC5646C, T2080, TC399XE, RV32, M14K
; @Keywords: coverage mc/dc eca
; @Copyright: (C) 1989-2024 Lauterbach GmbH, licensed for use with TRACE32(R) only
; --------------------------------------------------------------------------------
; $Id: measure_mcdc.cmm 22897 2024-06-07 14:46:42Z csax $
WinCLEAR
PMACRO.EXPLICIT
; --------------------------------------------------------------------------------
; Check TRACE32 version
; --------------------------------------------------------------------------------
PRIVATE &min_build
&min_build=165518.
IF VERSION.BUILD.BASE()<&min_build
(
DIALOG.OK "Sorry, the script" """"+OS.PPF()+"""" "requires at least TRACE32 build "+FORMAT.Decimal(1,&min_build)+"."
ENDDO FALSE()
)
RESet
SYStem.RESet
GOSUB menu
GOSUB dialog
PRIVATE &mode
RETURNVALUES &mode
; mode:
; 1: no instrumentation
; 2: full instrumentation
; 3: targeted instrumentation
GOSUB setup "&mode"
IF &mode==2.
(
sYmbol.ECA.BINary.ControlFlowMode.INSTR ON
)
ELSE IF &mode==3.
(
sYmbol.ECA.BINary.ControlFlowMode.INSTR ON
)
ELSE
(
sYmbol.ECA.BINary.ControlFlowMode.INSTR OFF
)
Go main
WAIT !RUN()
Break.Set sYmbol.EXIT(TestObcDiffersMcdc)
Var.Break.Set RunCoverageDemo\tic /Write
Mode.Hll
GOSUB RestoreWindows
sYmbol.SourceLOAD
sYmbol.ECA.LOAD \coverage
COVerage.Option.SourceMetric MCDC
ENDDO TRUE()
; --------------------------------------------------------------------------------
; Display windows for HLL coverage
; --------------------------------------------------------------------------------
RestoreWindows:
(
WinCLEAR
WinPOS 0.0 0.0 125. 33. 28. 1. W001
List /COVerage
WinPOS 0.0 41.667 125. 35. 27. 1. W002
List.Mix /COVerage /Track
WinPOS 132.57 0.083333 108. 33. 26. 1. W004
COVerage.ListFunc.sYmbol \coverage
WinPOS 194.43 41.5 64. 21. 0. 0. W003
Trace
WinPOS 135.57 45.333 45. 16. 0. 0. W000
COVerage
RETURN
)
; --------------------------------------------------------------------------------
; Add main menu entry
; --------------------------------------------------------------------------------
SUBROUTINE menu
(
MENU.ReProgram
(
ADD
MENU
(
MENUITEM "DEMO" "DO ~~~~/measure_mcdc"
)
)
RETURN
)
; --------------------------------------------------------------------------------
; Start dialog
; --------------------------------------------------------------------------------
SUBROUTINE dialog
(
LOCAL &measure_mode
DIALOG.view
(
ICON "[:report]"
HEADER "Demo: Measurement of MC/DC"
POS 0. 0. 30.
LTEXT "Demo: Measurement of MC/DC"
POS 0. 1. 80. 2.
INFOTEXT "This demo showcases the measurement of the MC/DC criterion."+" Use with one of the supported Arm, PowerPC, TriCore or RISC-V targets or the TRACE32 Instruction Set Simulator."+" To start the demo please select the measurement mode:"
POS 1. 3.5 2.
STATIC "[:flasherase]"
POS 3.5 3.5 15.
BUTTON "Non-Intrusive"
(
&measure_mode=1.
CONTinue
)
POS 21. 3.5 2.
STATIC "[:flashprogram]"
POS 23.5 3.5 15.
BUTTON "Full Instrumentation"
(
&measure_mode=2.
CONTinue
)
POS 41. 3.5 2.
STATIC "[:flashreprogram]"
POS 43.5 3.5 15.
BUTTON "Targeted Instrumentation"
(
&measure_mode=3.
CONTinue
)
POS 1. 5. 0.5
TEXT ""
)
STOP
RETURN "&measure_mode"
)
; --------------------------------------------------------------------------------
; Run setup steps
; --------------------------------------------------------------------------------
SUBROUTINE setup
(
PARAMETERS &mode
IF CPUFAMILY()=="ARM"
(
DO ~~~~/scripts/setup_arm "&mode"
)
ELSE IF CPUFAMILY()=="POWERPC"
(
DO ~~~~/scripts/setup_ppc "&mode"
)
ELSE IF CPUFAMILY()=="TRICORE"
(
DO ~~~~/scripts/setup_tricore "&mode"
)
ELSE IF CPUFAMILY()=="RISCV"
(
DO ~~~~/scripts/setup_riscv "&mode"
)
ELSE IF CPUFAMILY()=="MIPS"
(
DO ~~~~/scripts/setup_mips "&mode"
)
ELSE
(
PRINT %ERROR "Architecture is not supported. Aborting..."
END
)
RETURN
)