mirror of https://github.com/wolfSSL/wolfBoot.git
107 lines
3.3 KiB
Plaintext
107 lines
3.3 KiB
Plaintext
;; e247_debug.cmm
|
|
;;
|
|
;; Connect TRACE32 to the NXP MCXE247 (FRDM-MCXE247) and halt the CPU at the
|
|
;; reset vector, then load the wolfBoot and test-app symbols.
|
|
;; Usage: DO e247_debug.cmm ["<MCUXpresso SDK dir>"]
|
|
;; The SDK dir is only used to find the fsl_enet and PHY driver sources of a
|
|
;; test-app built with ENABLE_WOLFIP=1. It defaults to the MCUXPRESSO path in
|
|
;; mcxe247.config (../NXP/mcuxpresso-sdk/mcuxsdk, next to the checkout).
|
|
;;
|
|
;; Board setup (UM12286):
|
|
;; - Lauterbach 10-pin cable on J14 (SWD/JTAG 2x5 header)
|
|
;; - JP4 SHORTED: disables the onboard MCU-Link SWD so it does not fight
|
|
;; the external probe on SWDIO/SWCLK
|
|
;; - JP3 open: keeps the MCU-Link VCOM console (LPUART2, 115200 8N1)
|
|
;;
|
|
;; Notes:
|
|
;; - TRACE32 R2024.09 has no MCXE247 entry. The S32K148 is the same part for
|
|
;; debug purposes (NXP AN14731: same core, pinout and flash controller).
|
|
;; - All output, including errors, is logged to ~~/e247_debug.log
|
|
;; - The ELF files are loaded from the wolfBoot checkout this script is in.
|
|
|
|
PARAMETERS &sdkdir
|
|
|
|
; wolfBoot root: three levels above this script
|
|
&basedir=OS.PPD()+"\..\..\.."
|
|
IF "&sdkdir"==""
|
|
&sdkdir="&basedir\..\NXP\mcuxpresso-sdk\mcuxsdk"
|
|
|
|
AREA.OPEN A000 "~~/e247_debug.log" /Create /NoFileCache
|
|
PRINT "e247_debug.cmm " DATE.DATE() " " DATE.TIME()
|
|
|
|
RESet
|
|
SYStem.RESet
|
|
SYStem.CPU S32K148
|
|
SYStem.CONFIG.DEBUGPORTTYPE SWD
|
|
SYStem.Option DUALPORT ON
|
|
SYStem.MemAccess DAP
|
|
Trace.DISable
|
|
|
|
; reset and halt at the reset vector, retrying with a slow debug clock
|
|
SYStem.JtagClock 10MHz
|
|
PRINT "[1] SYStem.Up @ 10MHz"
|
|
ON ERROR CONTinue
|
|
SYStem.Up
|
|
ON ERROR inherit
|
|
|
|
IF !SYStem.Up()
|
|
(
|
|
PRINT "[2] SYStem.Up @ 1MHz"
|
|
SYStem.Down
|
|
SYStem.JtagClock 1MHz
|
|
ON ERROR CONTinue
|
|
SYStem.Up
|
|
ON ERROR inherit
|
|
)
|
|
|
|
IF !SYStem.Up()
|
|
(
|
|
PRINT %ERROR "MCXE247: connection failed (check JP4 shorted, cable on J14, board powered)"
|
|
AREA.CLOSE A000
|
|
ENDDO
|
|
)
|
|
|
|
IF STATE.RUN()
|
|
(
|
|
ON ERROR CONTinue
|
|
Break
|
|
ON ERROR inherit
|
|
)
|
|
|
|
IF STATE.RUN()
|
|
(
|
|
PRINT %ERROR "MCXE247: connected but CPU did not halt"
|
|
AREA.CLOSE A000
|
|
ENDDO
|
|
)
|
|
|
|
PRINT "MCXE247 halted, PC=0x"+FORMAT.HEX(8.,Register(PC))+" SP=0x"+FORMAT.HEX(8.,Register(SP))
|
|
AREA.CLOSE A000
|
|
|
|
mode.hll
|
|
|
|
IF OS.FILE("&basedir\wolfboot.elf")
|
|
data.load.elf "&basedir\wolfboot.elf" /nocode
|
|
IF OS.FILE("&basedir\test-app\image.elf")
|
|
data.load.elf "&basedir\test-app\image.elf" /nocode /noclear
|
|
; The ELF files hold the paths of the build machine. Look the sources up in
|
|
; this checkout instead, so it also works when TRACE32 runs on another host
|
|
; (e.g. Windows with the checkout in WSL).
|
|
; Sources are found by file name in these directories.
|
|
sYmbol.SourcePATH.SetBaseDir "&basedir"
|
|
&srcdirs="""&basedir"" ""&basedir\src"" ""&basedir\hal"" ""&basedir\test-app"""
|
|
&srcdirs="&srcdirs ""&basedir\lib\wolfssl\wolfcrypt\src"""
|
|
; wolfIP and its MCXE247 port (test-app built with ENABLE_WOLFIP=1)
|
|
&srcdirs="&srcdirs ""&basedir\lib\wolfip\src"" ""&basedir\lib\wolfip\src\tftp"""
|
|
&srcdirs="&srcdirs ""&basedir\lib\wolfip\src\port\nxp_mcxe_enet"""
|
|
; MCUXpresso SDK drivers used by the wolfIP port, if the SDK is there
|
|
IF OS.DIR("&sdkdir")
|
|
(
|
|
&srcdirs="&srcdirs ""&sdkdir\drivers\enet"" ""&sdkdir\drivers\common"""
|
|
&srcdirs="&srcdirs ""&sdkdir\devices\MCX\MCXE\MCXE247\drivers"""
|
|
&srcdirs="&srcdirs ""&sdkdir\components\phy\device\phylan8741"""
|
|
)
|
|
sYmbol.SourcePATH.Set &srcdirs
|
|
|
|
ENDDO
|