Flashing TK1 custom board stuck at Performing RAM repair (SOLVED)

We are trying to bring up a custom TK1 board, with basically the same eMMC & DDR3 design as Jetson TK1. When we flash our TK1 board, flash.sh would be stuck at “waiting for bootloader to initialize”.

*** Flashing target device started. ***
./nvflash --boardid 0x177 0x00 0x03 --bct PM375_Hynix_2GB_H5TC4G63AFR_RDA_792MHz.cfg --setbct --configfile flash.cfg  --create --bl fastboot.bin --odmdata 0x6009C000 --go
Nvflash 4.13.0000 started
BR_CID: 0x340010017410b1040000000003040500
rcm version 0X400001
Skipping BoardID read at miniloader level
System Information:
   chip name: unknown
   chip id: 0x40 major: 1 minor: 1
   chip sku: 0x0
   chip uid: 0x000000017410b1040000000003040500
   macrovision: disabled
   hdcp: disabled
   jtag: disabled
   sbk burned: false
   board id: 0
   warranty fuse: 0
   dk burned: false
   boot device: emmc
   operating mode: 3
   device config strap: 0
   device config fuse: 0
   sdram config strap: 0

RCM communication completed
auxInfo->NCTBoardInfo->proc_board_id is 375
auxInfo->NCTBoardInfo->proc_sku is 0
auxInfo->NCTBoardInfo->proc_fab is 3
BCT sent successfully
sending file: tegra124-jetson_tk1-pm375-000-c00-00.dtb
- 59637/59637 bytes sent
tegra124-jetson_tk1-pm375-000-c00-00.dtb sent successfully
odm data: 0x6009c000
downloading bootloader -- load address: 0x83d88000 entry point: 0x83d88000
sending file: fastboot.bin
- 594363/594363 bytes sent
fastboot.bin sent successfully
waiting for bootloader to initialize
[stuck forever...]

And UART log is also stuck at “Performing RAM repair”:

[0000.000] [TegraBoot] (version UNDEF_BUILD)
[0000.004] Reset reason: power on reset
[0000.008] Processing in recovery mode
[0000.011] Established communication link with host
[0001.093] Downloaded bct successfully
[0001.097] No Battery Present
[0001.101] Sdram initialization is successful
[0001.112] Downloaded DTB successfully
[0001.118] No Battery Present
[0001.188] Downloaded bootloader successfully
[0001.192] CPU-bootloader entry address: 0x83d88000
[0001.197] BoardId: 375
[0001.199] Vpr Carveout Base=0x0f4600000 Size=0x00ba00000
[0001.204] Tsec Carveout Base=0x0f2600000 Size=0x002000000
[0001.209] Lp0 Carveout Base=0x0f25ff000 Size=0x000001000
[0001.214] Xusb Carveout Base=0x0f2300000 Size=0x000200000
[0001.219] Platform-DebugCarveout: 0
[0001.246] CPU power rail is up
[0001.249] Performing RAM repair

Any suggestions about what we should look into? Thanks in advance.

For the record, we just had this issue resolved. It was a hardware problem. On our TK1 engineering samples, JTAG_TRST_N was shorted to GND by mistake. eMMC could be flashed normally after we fixed that.