如何用代码使能和禁用jtag功能
一、使能jtag
Xil_Out32(0xffca0038,0x3F);
Xil_Out32(0xffca003C,0xFF);
Xil_Out32(0xffca0030,0x3);
Xil_Out32(0xFF5E00B0,0x01002002);
Xil_Out32(0xFF5E0240,0x0);
Xil_Out32(0xFFCA3000,0x1);
1. jtag_sec [0xffca0038]=0x3F
0011 1111
bit5:3 = 111
ssss_pltap_sec
Setting these bits disables the security gate for the PLTAP and allows the PSTAP to connect to the PL for bitstream loading and boundary scan operations. All bits must be set to 1 to release the security gate. (POR reset only)
bit2:0 = 111
ssss_dap_sec
Setting these bits disables the security gate for the Arm DAP and allows the PS TAP or PJTAG to connect to the DAP. All bits must be set to 1 for the security gate to be released. (POR reset only)
2. jtag_dap_cfg [0xffca003C]=0xFF
3. jtag_chain_cfg [0xffca0030]=0x3
0x3
bit1 = 1
bit0 = 1
4. DBG_LPD_CTRL [0xFF5E00B0]=0x01002002
0000 0001 0000 0000 0010 0000 0000 0010
bit2:0 = 010 IOPLL
bit13:8 = 100000 分频比32
bit24 = 1 Clock active control.
5. RST_LPD_DBG [0xFF5E0240]=0x0
6. pcap_prog [0xFFCA3000]=0x1
二、禁用jtag
对于用户希望在 FSBL 执行后禁用 DAP 访问的非安全用例,可以执行以下步骤。
比如在功能安全的应用中,用户不希望JTAG活动干扰处理器的代码执行。
禁用 DAP 的顺序如下所示:
Xil_Out32(0xffca0030, 0x0);
Xil_Out32(0xffca003C, 0x0);
Xil_Out32(0xffca0038, 0x0);
寄存器含义参考上面第一章的内容