移动了文件位置

This commit is contained in:
2026-04-18 09:16:58 +08:00
parent 2b49081589
commit 1575212f13
10236 changed files with 72 additions and 1436438 deletions

View File

@@ -0,0 +1,46 @@
/*********************************************************************
* (c) 1995 - 2019 SEGGER Microcontroller GmbH *
* The Embedded Experts *
* www.segger.com *
**********************************************************************
/*********************************************************************
*
* Global functions
*
**********************************************************************
*/
/*********************************************************************
*
* ConfigTargetSettings()
*
* Function description
* Called before InitTarget(). Mainly used to set some global DLL variables to customize the normal connect procedure.
* For ARM CoreSight devices this may be specifying the base address of some CoreSight components (ETM, ...)
* that cannot be automatically detected by J-Link due to erroneous ROM tables etc.
* May also be used to specify the device name in case debugger does not pass it to the DLL.
*
* Return value
* >= 0 O.K.
* < 0 Error
*
* Notes
* (1) May not, under absolutely NO circumstances, call any API functions that perform target communication.
* (2) Should only set some global DLL variables
*/
int ConfigTargetSettings(void) {
//
// Access Port map specfication
// Core type
// Access Port to use
// Specify core base address
// Specify CTI base address
JLINK_SYS_Report("----------------J-Link script: ConfigTargetSettings() For Semdrive D3 SF Cortex-R5---------------");
JLINK_CPU = CORTEX_R5;
//JLINK_CORESIGHT_IndexAPBAPToUse = 0;
JLINK_CORESIGHT_CoreBaseAddr = 0xF2081000;
return 0;
}
/*************************** end of file ****************************/

View File

@@ -0,0 +1,46 @@
/*********************************************************************
* (c) 1995 - 2019 SEGGER Microcontroller GmbH *
* The Embedded Experts *
* www.segger.com *
**********************************************************************
/*********************************************************************
*
* Global functions
*
**********************************************************************
*/
/*********************************************************************
*
* ConfigTargetSettings()
*
* Function description
* Called before InitTarget(). Mainly used to set some global DLL variables to customize the normal connect procedure.
* For ARM CoreSight devices this may be specifying the base address of some CoreSight components (ETM, ...)
* that cannot be automatically detected by J-Link due to erroneous ROM tables etc.
* May also be used to specify the device name in case debugger does not pass it to the DLL.
*
* Return value
* >= 0 O.K.
* < 0 Error
*
* Notes
* (1) May not, under absolutely NO circumstances, call any API functions that perform target communication.
* (2) Should only set some global DLL variables
*/
int ConfigTargetSettings(void) {
//
// Access Port map specfication
// Core type
// Access Port to use
// Specify core base address
// Specify CTI base address
JLINK_SYS_Report("----------------J-Link script: ConfigTargetSettings() For Semdrive D3 SP0 Cortex-R5---------------");
JLINK_CPU = CORTEX_R5;
//JLINK_CORESIGHT_IndexAPBAPToUse = 0;
JLINK_CORESIGHT_CoreBaseAddr = 0xF2082000;
return 0;
}
/*************************** end of file ****************************/

View File

@@ -0,0 +1,46 @@
/*********************************************************************
* (c) 1995 - 2019 SEGGER Microcontroller GmbH *
* The Embedded Experts *
* www.segger.com *
**********************************************************************
/*********************************************************************
*
* Global functions
*
**********************************************************************
*/
/*********************************************************************
*
* ConfigTargetSettings()
*
* Function description
* Called before InitTarget(). Mainly used to set some global DLL variables to customize the normal connect procedure.
* For ARM CoreSight devices this may be specifying the base address of some CoreSight components (ETM, ...)
* that cannot be automatically detected by J-Link due to erroneous ROM tables etc.
* May also be used to specify the device name in case debugger does not pass it to the DLL.
*
* Return value
* >= 0 O.K.
* < 0 Error
*
* Notes
* (1) May not, under absolutely NO circumstances, call any API functions that perform target communication.
* (2) Should only set some global DLL variables
*/
int ConfigTargetSettings(void) {
//
// Access Port map specfication
// Core type
// Access Port to use
// Specify core base address
// Specify CTI base address
JLINK_SYS_Report("----------------J-Link script: ConfigTargetSettings() For Semdrive D3 SP1 Cortex-R5---------------");
JLINK_CPU = CORTEX_R5;
//JLINK_CORESIGHT_IndexAPBAPToUse = 0;
JLINK_CORESIGHT_CoreBaseAddr = 0xF2083000;
return 0;
}
/*************************** end of file ****************************/

View File

@@ -0,0 +1,46 @@
/*********************************************************************
* (c) 1995 - 2019 SEGGER Microcontroller GmbH *
* The Embedded Experts *
* www.segger.com *
**********************************************************************
/*********************************************************************
*
* Global functions
*
**********************************************************************
*/
/*********************************************************************
*
* ConfigTargetSettings()
*
* Function description
* Called before InitTarget(). Mainly used to set some global DLL variables to customize the normal connect procedure.
* For ARM CoreSight devices this may be specifying the base address of some CoreSight components (ETM, ...)
* that cannot be automatically detected by J-Link due to erroneous ROM tables etc.
* May also be used to specify the device name in case debugger does not pass it to the DLL.
*
* Return value
* >= 0 O.K.
* < 0 Error
*
* Notes
* (1) May not, under absolutely NO circumstances, call any API functions that perform target communication.
* (2) Should only set some global DLL variables
*/
int ConfigTargetSettings(void) {
//
// Access Port map specfication
// Core type
// Access Port to use
// Specify core base address
// Specify CTI base address
JLINK_SYS_Report("----------------J-Link script: ConfigTargetSettings() For Semdrive D3 SX0 Cortex-R5---------------");
JLINK_CPU = CORTEX_R5;
//JLINK_CORESIGHT_IndexAPBAPToUse = 0;
JLINK_CORESIGHT_CoreBaseAddr = 0xF2084000;
return 0;
}
/*************************** end of file ****************************/

View File

@@ -0,0 +1,46 @@
/*********************************************************************
* (c) 1995 - 2019 SEGGER Microcontroller GmbH *
* The Embedded Experts *
* www.segger.com *
**********************************************************************
/*********************************************************************
*
* Global functions
*
**********************************************************************
*/
/*********************************************************************
*
* ConfigTargetSettings()
*
* Function description
* Called before InitTarget(). Mainly used to set some global DLL variables to customize the normal connect procedure.
* For ARM CoreSight devices this may be specifying the base address of some CoreSight components (ETM, ...)
* that cannot be automatically detected by J-Link due to erroneous ROM tables etc.
* May also be used to specify the device name in case debugger does not pass it to the DLL.
*
* Return value
* >= 0 O.K.
* < 0 Error
*
* Notes
* (1) May not, under absolutely NO circumstances, call any API functions that perform target communication.
* (2) Should only set some global DLL variables
*/
int ConfigTargetSettings(void) {
//
// Access Port map specfication
// Core type
// Access Port to use
// Specify core base address
// Specify CTI base address
JLINK_SYS_Report("----------------J-Link script: ConfigTargetSettings() For Semdrive D3 SX1 Cortex-R5---------------");
JLINK_CPU = CORTEX_R5;
//JLINK_CORESIGHT_IndexAPBAPToUse = 0;
JLINK_CORESIGHT_CoreBaseAddr = 0xF2085000;
return 0;
}
/*************************** end of file ****************************/

View File

@@ -0,0 +1,94 @@
## 简介
介绍通过j-link使用secure debug功能
该功能支持JTAG模式不支持SWD模式
芯片匹配debug key成功后开启debug接口
##硬件连接
- e3_gateway参考板
- Jlink debugger
##注意事项
- 确认板子JTAG功能正常对于e3 gateway参考板需要去掉TDO/TDI上的两个电阻。
- 需要通过fuse工具烧UID,debug key和使能secure debug。
- 确认sf.JLinkScript中SetupSecureDebug的操作被打开默认是关闭的。
- IAR工程下 接口如果是SWD,修改为JTAG。
- IAR工程下 如果 options->Debugger->Extra Options下没有指定sf.JLinkScript
增加command--jlink_script_file=$PROJ_DIR$\..\..\..\..\..\..\devices\script\JLINK\e3\sf.JLinkScript
- SES工程下 接口如果是SWD,修改为JTAG。
- SES工程下 如果 options->Debug->J-Link->Script File下没有选择sf.JLinkScript
则手动指定路径ssdk\devices\script\JLINK\e3\sf.JLinkScript
##测试方法
当板子以以下方式烧UID,debug key和使能secure debug.
Debug Key:
+-----------------------+------------+------------------+
| name | fuse addr | fuse value |
+-----------------------+------------+------------------+
| UID[0, 31] | 0x1010 | 0x12345678 |
| UID[32, 63] | 0x1014 | 0xABCDEF88 |
| SEC_DBG_CFG[31, 0] | 0x1280 | 0x74657374(key0) |
| SEC_DBG_CFG[63, 32] | 0x1284 | 0x6b657930(key1) |
| MSIC_CFG3/SDBG_MODE | 0x12b0 | 0x00800000 |
+-----------------------+------------+------------------+
IAR下执行attach通过脚本同时会返回UID
SES下可以通过执行connect确认
提供错误的debug key则无法执行通过。
##expected log
--------------SetupSecureDebug-----------------
UID: 0x12345678
UID: 0xABCDEF88
ID: 0x4BA00477
##流程说明
- 该流程涉及JTAG状态机的转化instruction和data的传入。
- key0, key1对应传入的debug key。v保存读出来的id。
- Note: key0 --> SEC_DBG_CFG[31, 0], key1 --> SEC_DBG_CFG[63, 32]!!
void SetupSecureDebug(void) {
int v;
int key0;
int key1;
int cmd;
cmd = 0xf;
key0 = 0x74657374;
key1 = 0x6b657930;
JLINK_SYS_Report("--------------SetupSecureDebug-----------------");
JLINK_SelectTIF(JLINK_TIF_JTAG);
CPU = CORTEX_R5;
//prototype:int JLINK_JTAG_Write(U32 tms, U32 tdi, U32 NumBits);
JLINK_JTAG_Write(0x1f, 0, 5); // goto Test-Logic Reset state
JLINK_JTAG_Write(0x6, 0, 5); //goto shift-ir state
JLINK_JTAG_Write(0x8, 0xf, 4); // shift in UID instruction, goto exit1-ir
JLINK_JTAG_Write(0x3, cmd, 4); //goto shift-dr state
JLINK_JTAG_Write(0x00000000, 0x0, 32); //shift in 64bit dummy code. shift out our uid
v = JLINK_JTAG_GetU32(0);
JLINK_SYS_Report1("UID: ", v);
JLINK_JTAG_Write(0x80000000, 0x0, 32); //shift in 64bit dummy code. shift out our uid, goto exit1-dr
v = JLINK_JTAG_GetU32(0);
JLINK_SYS_Report1("UID: ", v);
JLINK_JTAG_Write(0x1f, 0, 5); // goto Test-Logic Reset state
JLINK_JTAG_Write(0x2, 0x0, 4); // goto shift-dr state
JLINK_JTAG_Write(0x00000000, key0, 32); //shift in the corresponding key
JLINK_JTAG_Write(0x80000000, key1, 32); //shift in the corresponding key
JLINK_JTAG_Write(0x1f, 0, 5); // goto Test-Logic Reset state
JLINK_JTAG_Write(0x2, 0x0, 4); // goto shift-dr state
JLINK_JTAG_Write(0x80000000, 0x0, 32); // shift our IDCODE
v = JLINK_JTAG_GetU32(0);
JLINK_SYS_Report1("ID: ", v);
JLINK_JTAG_Write(0x1, 0, 2); // goto idle state
}

View File

@@ -0,0 +1,95 @@
/*********************************************************************
* (c) 1995 - 2019 SEGGER Microcontroller GmbH *
* The Embedded Experts *
* www.segger.com *
**********************************************************************
/*********************************************************************
*
* Global functions
*
**********************************************************************
*/
/*********************************************************************
*
* ConfigTargetSettings()
*
* Function description
* Called before InitTarget(). Mainly used to set some global DLL variables to customize the normal connect procedure.
* For ARM CoreSight devices this may be specifying the base address of some CoreSight components (ETM, ...)
* that cannot be automatically detected by J-Link due to erroneous ROM tables etc.
* May also be used to specify the device name in case debugger does not pass it to the DLL.
*
* Return value
* >= 0 O.K.
* < 0 Error
*
* Notes
* (1) May not, under absolutely NO circumstances, call any API functions that perform target communication.
* (2) Should only set some global DLL variables
*/
int ConfigTargetSettings(void) {
//
// Access Port map specfication
// Core type
// Access Port to use
// Specify core base address
// Specify CTI base address
JLINK_SYS_Report("----------------J-Link script: ConfigTargetSettings() For Semdrive E3 SF Cortex-R5---------------");
JLINK_CPU = CORTEX_R5;
//JLINK_CORESIGHT_IndexAPBAPToUse = 0;
JLINK_CORESIGHT_CoreBaseAddr = 0xF2081000;
return 0;
}
void SetupSecureDebug(void) {
int v;
int key0;
int key1;
int cmd;
cmd = 0xf;
key0 = 0x74657374; // key0 --> SEC_DBG_CFG[31, 0]!!
key1 = 0x6b657930; // key1 --> SEC_DBG_CFG[63, 32]!!
JLINK_SYS_Report("--------------SetupSecureDebug-----------------");
JLINK_SelectTIF(JLINK_TIF_JTAG);
CPU = CORTEX_R5;
//prototype:int JLINK_JTAG_Write(U32 tms, U32 tdi, U32 NumBits);
JLINK_JTAG_Write(0x1f, 0, 5); // goto Test-Logic Reset state
JLINK_JTAG_Write(0x6, 0, 5); //goto shift-ir state
JLINK_JTAG_Write(0x8, cmd, 4); // shift in UID instruction, goto exit1-ir
JLINK_JTAG_Write(0x3, 0x0, 4); //goto shift-dr state
JLINK_JTAG_Write(0x00000000, 0x0, 32); //shift in 64bit dummy code. shift out our uid
v = JLINK_JTAG_GetU32(0);
JLINK_SYS_Report1("UID: ", v);
JLINK_JTAG_Write(0x80000000, 0x0, 32); //shift in 64bit dummy code. shift out our uid, goto exit1-dr
v = JLINK_JTAG_GetU32(0);
JLINK_SYS_Report1("UID: ", v);
JLINK_JTAG_Write(0x1f, 0, 5); // goto Test-Logic Reset state
JLINK_JTAG_Write(0x2, 0x0, 4); // goto shift-dr state
JLINK_JTAG_Write(0x00000000, key0, 32); //shift in the corresponding key
JLINK_JTAG_Write(0x80000000, key1, 32); //shift in the corresponding key, goto exit1-ir
JLINK_JTAG_Write(0x1f, 0, 5); // goto Test-Logic Reset state
JLINK_JTAG_Write(0x2, 0x0, 4); // goto shift-dr state
JLINK_JTAG_Write(0x80000000, 0x0, 32); // shift our IDCODE
v = JLINK_JTAG_GetU32(0);
JLINK_SYS_Report1(" ID: ", v);
JLINK_JTAG_Write(0x1, 0, 2); // goto idle state
}
void InitTarget(void) {
// SetupSecureDebug();
}
/*************************** end of file ****************************/

View File

@@ -0,0 +1,46 @@
/*********************************************************************
* (c) 1995 - 2019 SEGGER Microcontroller GmbH *
* The Embedded Experts *
* www.segger.com *
**********************************************************************
/*********************************************************************
*
* Global functions
*
**********************************************************************
*/
/*********************************************************************
*
* ConfigTargetSettings()
*
* Function description
* Called before InitTarget(). Mainly used to set some global DLL variables to customize the normal connect procedure.
* For ARM CoreSight devices this may be specifying the base address of some CoreSight components (ETM, ...)
* that cannot be automatically detected by J-Link due to erroneous ROM tables etc.
* May also be used to specify the device name in case debugger does not pass it to the DLL.
*
* Return value
* >= 0 O.K.
* < 0 Error
*
* Notes
* (1) May not, under absolutely NO circumstances, call any API functions that perform target communication.
* (2) Should only set some global DLL variables
*/
int ConfigTargetSettings(void) {
//
// Access Port map specfication
// Core type
// Access Port to use
// Specify core base address
// Specify CTI base address
JLINK_SYS_Report("----------------J-Link script: ConfigTargetSettings() For Semdrive E3 SP0 Cortex-R5---------------");
JLINK_CPU = CORTEX_R5;
//JLINK_CORESIGHT_IndexAPBAPToUse = 0;
JLINK_CORESIGHT_CoreBaseAddr = 0xF2082000;
return 0;
}
/*************************** end of file ****************************/

View File

@@ -0,0 +1,46 @@
/*********************************************************************
* (c) 1995 - 2019 SEGGER Microcontroller GmbH *
* The Embedded Experts *
* www.segger.com *
**********************************************************************
/*********************************************************************
*
* Global functions
*
**********************************************************************
*/
/*********************************************************************
*
* ConfigTargetSettings()
*
* Function description
* Called before InitTarget(). Mainly used to set some global DLL variables to customize the normal connect procedure.
* For ARM CoreSight devices this may be specifying the base address of some CoreSight components (ETM, ...)
* that cannot be automatically detected by J-Link due to erroneous ROM tables etc.
* May also be used to specify the device name in case debugger does not pass it to the DLL.
*
* Return value
* >= 0 O.K.
* < 0 Error
*
* Notes
* (1) May not, under absolutely NO circumstances, call any API functions that perform target communication.
* (2) Should only set some global DLL variables
*/
int ConfigTargetSettings(void) {
//
// Access Port map specfication
// Core type
// Access Port to use
// Specify core base address
// Specify CTI base address
JLINK_SYS_Report("----------------J-Link script: ConfigTargetSettings() For Semdrive E3 SP1 Cortex-R5---------------");
JLINK_CPU = CORTEX_R5;
//JLINK_CORESIGHT_IndexAPBAPToUse = 0;
JLINK_CORESIGHT_CoreBaseAddr = 0xF2083000;
return 0;
}
/*************************** end of file ****************************/

View File

@@ -0,0 +1,46 @@
/*********************************************************************
* (c) 1995 - 2019 SEGGER Microcontroller GmbH *
* The Embedded Experts *
* www.segger.com *
**********************************************************************
/*********************************************************************
*
* Global functions
*
**********************************************************************
*/
/*********************************************************************
*
* ConfigTargetSettings()
*
* Function description
* Called before InitTarget(). Mainly used to set some global DLL variables to customize the normal connect procedure.
* For ARM CoreSight devices this may be specifying the base address of some CoreSight components (ETM, ...)
* that cannot be automatically detected by J-Link due to erroneous ROM tables etc.
* May also be used to specify the device name in case debugger does not pass it to the DLL.
*
* Return value
* >= 0 O.K.
* < 0 Error
*
* Notes
* (1) May not, under absolutely NO circumstances, call any API functions that perform target communication.
* (2) Should only set some global DLL variables
*/
int ConfigTargetSettings(void) {
//
// Access Port map specfication
// Core type
// Access Port to use
// Specify core base address
// Specify CTI base address
JLINK_SYS_Report("----------------J-Link script: ConfigTargetSettings() For Semdrive E3 SX0 Cortex-R5---------------");
JLINK_CPU = CORTEX_R5;
//JLINK_CORESIGHT_IndexAPBAPToUse = 0;
JLINK_CORESIGHT_CoreBaseAddr = 0xF2084000;
return 0;
}
/*************************** end of file ****************************/

View File

@@ -0,0 +1,46 @@
/*********************************************************************
* (c) 1995 - 2019 SEGGER Microcontroller GmbH *
* The Embedded Experts *
* www.segger.com *
**********************************************************************
/*********************************************************************
*
* Global functions
*
**********************************************************************
*/
/*********************************************************************
*
* ConfigTargetSettings()
*
* Function description
* Called before InitTarget(). Mainly used to set some global DLL variables to customize the normal connect procedure.
* For ARM CoreSight devices this may be specifying the base address of some CoreSight components (ETM, ...)
* that cannot be automatically detected by J-Link due to erroneous ROM tables etc.
* May also be used to specify the device name in case debugger does not pass it to the DLL.
*
* Return value
* >= 0 O.K.
* < 0 Error
*
* Notes
* (1) May not, under absolutely NO circumstances, call any API functions that perform target communication.
* (2) Should only set some global DLL variables
*/
int ConfigTargetSettings(void) {
//
// Access Port map specfication
// Core type
// Access Port to use
// Specify core base address
// Specify CTI base address
JLINK_SYS_Report("----------------J-Link script: ConfigTargetSettings() For Semdrive E3 SX1 Cortex-R5---------------");
JLINK_CPU = CORTEX_R5;
//JLINK_CORESIGHT_IndexAPBAPToUse = 0;
JLINK_CORESIGHT_CoreBaseAddr = 0xF2085000;
return 0;
}
/*************************** end of file ****************************/