; -------------------------------------------------------------------------------- ; @Title: FDX Tracing Demo for ARM7/9/11, XSCALE, CortexA/R/M (32/64-bit) ; @Description: ; This script shows how to use the FDX communication on ARM. ; The demo code is compiled as position independent code and should run on ; every ARM platform. Per default we use DCC as transfer channel. As e.g. ; CortexM does not support DCC, we use the RunTimeMemoryAccess to ; demonstrate FDX on CortexM. ; For more information about FDX, please refer to general_ref_f.pdf ; ; Prerequisites: ; * System is connected ; * RAM is accessible Read/Write/Execute ; ; Usage: ; DO ~~/demo/arm/fdx/fdxtrace ; e.g. DO ~~/demo/arm/fdx/fdxtrace 0x1000 ; @Author: MAZ AME ; @Keywords: Trace ; @Copyright: (C) 1989-2022 Lauterbach GmbH, licensed for use with TRACE32(R) only ; -------------------------------------------------------------------------------- ; $Id: fdxtrace.cmm 18850 2022-01-26 18:41:29Z bschroefel $ ; clear windows WinCLEAR FDXOC WinCLEAR FDXIC PRIVATE ¶m &offset ENTRY ¶m // Prerequisites: Simulator? Connected? RemoteAPI activated? IF INTERFACE.SIM() ( PRINT %ERROR "Error: This demo does not work with the simulator." ENDDO FALSE() ) IF !SYSTEM.UP() ( PRINT %ERROR "Error: Please connect to the CPU first." ENDDO FALSE() ) GOSUB ParseParameters ¶m ENTRY &offset IF (CPU.FEATURE(SPR)) ( ; AArch64 capable CPU ; detect AArch mode by checking bit4 of the M field of CPSR IF ((Register(M)&0x10)==0x0) ( Data.LOAD.Elf ~~~~/fdxtrace_pic_aarch64.elf &offset /RelPATH /Verify ) ELSE IF (((Register(M)&0x10)!=0x0)&&Register(E)==0.) ( ; AArch32 mode IF Register(T)==0. Data.LOAD.Elf ~~~~/fdxtrace_pic_arm11_cortex.elf &offset /RelPATH /Verify ELSE Data.LOAD.Elf ~~~~/fdxtrace_pic_thumb_ii_v7.elf &offset /RelPATH /Verify ) ELSE ( PRINT %ERROR "Error: Coretype not supported by this script." ENDDO FALSE() ) ) ELSE IF (STRing.SCAN(CORENAME(),"ARM7",0)>=0)||(STRing.SCAN(CORENAME(),"ARM9",0)>=0) ( Data.LOAD.Elf ~~~~/fdxtrace_pic_arm7_arm9.elf &offset /RelPATH /Verify ) ELSE IF (STRing.SCAN(CORENAME(),"ARM11",0)>=0)||(STRing.SCAN(CORENAME(),"CORTEXA",0)>=0) ( Data.LOAD.Elf ~~~~/fdxtrace_pic_arm11_cortex.elf &offset /RelPATH /Verify ) ELSE IF (STRing.SCAN(CORENAME(),"CORTEXM0",0)>=0)||(STRing.SCAN(CORENAME(),"CORTEXM1",0)>=0) ( Data.LOAD.Elf ~~~~/fdxtrace_pic_thumb_v6m.elf &offset /RelPATH /Verify ) ELSE IF (STRing.SCAN(CORENAME(),"CORTEXM3",0)>=0)||(STRing.SCAN(CORENAME(),"CORTEXM4",0)>=0)||(STRing.SCAN(CORENAME(),"CORTEXM7",0)>=0) ( Data.LOAD.Elf ~~~~/fdxtrace_pic_thumb_ii_v7m.elf &offset /RelPATH /Verify ) ELSE IF (STRing.SCAN(CORENAME(),"XSCALE",0)>=0) ( Data.LOAD.Elf ~~~~/fdxtrace_pic_xscale.elf &offset /RelPATH /Verify ) ELSE IF (STRing.SCAN(CORENAME(),"CORTEXR",0)>=0) ( IF ((Data.Long(C15:0x1)&0x80000000)!=0x0) Data.LOAD.Elf ~~~~/fdxtrace_pic_arm11_cortex_be.elf &offset /RelPATH /Verify ELSE Data.LOAD.Elf ~~~~/fdxtrace_pic_arm11_cortex.elf &offset /RelPATH /Verify ) ELSE ( PRINT %ERROR "Error: Coretype not supported by this script." ENDDO FALSE() ) ; preboot executable - run to *main* Go main WAIT !STATE.RUN() ; fdx transfer method configuration ; as CortexM has no DCC, check if the T32_TsMon_ReceiveStatus is available ; yes -> use DCC ; no -> use Memory Buffer with RuntimeMemory Access FDX.RESet IF sYmbol.EXIST(T32_TsMon_ReceiveStatus) ( ; settings must match the T32_FDX_DCCx and T32_FDX_??COMPRESSED defines FDX.METHOD DCC4 FDX.Mode COMPRESS ON FDX.SIZE 100000. FDX.TraceChannel FDX.OFF ) ELSE ( SYStem.MemAccess DAP ; settings must match the T32_FDX_??COMPRESSED and T32_FDX_TRACE_BUFSIZE defines FDX.METHOD BUFFERE FDX.Mode COMPRESS ON FDX.SIZE 100000. FDX.TraceChannel FdxTraceSendBuffer FDX.OFF ) ; select FDX as default trace method Trace.METHOD FDX ; show windows WinPOS 0% 0% List.auto WinPOS 60% 0% Trace.List WinPOS 60% 40% FDX.state ENDDO TRUE() ; -------------------------------------------------------------------------------- ; SUBROUTINES ; ParseParameters: ;(param) LOCAL ¶m &offset ENTRY ¶m &offset=STRing.SCANAndExtract("¶m","0x","") IF "&offset"=="" ( PRINT %ERROR "Error: Missing Argument - Usage DO fdxtrace.cmm 0x " ENDDO FALSE() ) ; ensure parameter is HEX and round down to the nearest LONG &offset="0x&offset" &offset=(&offset)&~0x3 IF !SYStem.Up() ( PRINT %ERROR "Error: Not connected to target. - Please use SYStem.Up before." ENDDO FALSE() ) RETURN &offset