Skip to content

Commit d91ccb7

Browse files
Alan-19950616wangyanwen
andauthored
doc: Add nuclei cross trigger in openocd (#48)
* doc: Add nuclei cross trigger in openocd Signed-off-by: wangyanwen <wangyanwen@nucleisys.com> * doc: restoration issues Signed-off-by: wangyanwen <wangyanwen@nucleisys.com> --------- Signed-off-by: wangyanwen <wangyanwen@nucleisys.com> Co-authored-by: wangyanwen <wangyanwen@nucleisys.com>
1 parent 302056a commit d91ccb7

9 files changed

+169
-1
lines changed
Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
# OpenOCD 中 Nuclei 交叉触发功能使用指南
2+
3+
## 功能概述
4+
5+
为满足 AMP 多核调试中同步暂停(halt)与恢复(resume)的需求,Nuclei RISC-V CPU实现了 cross-trigger 功能,OpenOCD 已集成以下两种同步控制功能:
6+
7+
1. **同步暂停组 (halt_group)** - 组内任一核暂停时,其他成员自动同步暂停
8+
2. **同步恢复组 (resume_group)** - 组内任一核恢复运行时,其他成员自动同步恢复
9+
10+
基本命令格式:
11+
12+
```
13+
# add target to halt_group
14+
nuclei cti halt_group on $_TARGETNAME0 $_TARGETNAME1
15+
16+
# remove target from halt_group
17+
nuclei cti halt_group off $_TARGETNAME0 $_TARGETNAME1
18+
19+
# add target to resume_group
20+
nuclei cti resume_group on $_TARGETNAME0 $_TARGETNAME1
21+
22+
# remove target from resume_group
23+
nuclei cti resume_group off $_TARGETNAME0 $_TARGETNAME1
24+
```
25+
26+
## 配置文件示例
27+
28+
### 1. 同步暂停组配置
29+
30+
```tcl
31+
adapter_khz 1000
32+
33+
interface ftdi
34+
ftdi_vid_pid 0x0403 0x6010
35+
ftdi_oscan1_mode off
36+
37+
transport select jtag
38+
39+
ftdi_layout_init 0x0008 0x001b
40+
ftdi_layout_signal nSRST -oe 0x0020 -data 0x0020
41+
ftdi_layout_signal TCK -data 0x0001
42+
ftdi_layout_signal TDI -data 0x0002
43+
ftdi_layout_signal TDO -input 0x0004
44+
ftdi_layout_signal TMS -data 0x0008
45+
ftdi_layout_signal JTAG_SEL -data 0x0100 -oe 0x0100
46+
47+
set _CHIPNAME0 riscv0
48+
jtag newtap $_CHIPNAME0 cpu -irlen 5 -expected-id 0x10900a6d
49+
set _TARGETNAME0 $_CHIPNAME0.cpu
50+
target create $_TARGETNAME0 riscv -chain-position $_TARGETNAME0 -coreid 0
51+
52+
set _CHIPNAME1 riscv1
53+
jtag newtap $_CHIPNAME1 cpu -irlen 5 -expected-id 0x10900a6d
54+
set _TARGETNAME1 $_CHIPNAME1.cpu
55+
target create $_TARGETNAME1 riscv -chain-position $_TARGETNAME1 -coreid 0
56+
57+
init
58+
#reset
59+
60+
if {[ info exists pulse_srst]} {
61+
ftdi_set_signal nSRST 0
62+
ftdi_set_signal nSRST z
63+
}
64+
65+
# 添加目标到暂停组
66+
nuclei cti halt_group on $_TARGETNAME0 $_TARGETNAME1
67+
68+
foreach t [target names] {
69+
targets $t
70+
halt
71+
}
72+
```
73+
74+
### 2. 同步恢复组配置
75+
76+
```tcl
77+
adapter_khz 1000
78+
79+
interface ftdi
80+
ftdi_vid_pid 0x0403 0x6010
81+
ftdi_oscan1_mode off
82+
83+
transport select jtag
84+
85+
ftdi_layout_init 0x0008 0x001b
86+
ftdi_layout_signal nSRST -oe 0x0020 -data 0x0020
87+
ftdi_layout_signal TCK -data 0x0001
88+
ftdi_layout_signal TDI -data 0x0002
89+
ftdi_layout_signal TDO -input 0x0004
90+
ftdi_layout_signal TMS -data 0x0008
91+
ftdi_layout_signal JTAG_SEL -data 0x0100 -oe 0x0100
92+
93+
set _CHIPNAME0 riscv0
94+
jtag newtap $_CHIPNAME0 cpu -irlen 5 -expected-id 0x10900a6d
95+
set _TARGETNAME0 $_CHIPNAME0.cpu
96+
target create $_TARGETNAME0 riscv -chain-position $_TARGETNAME0 -coreid 0
97+
98+
set _CHIPNAME1 riscv1
99+
jtag newtap $_CHIPNAME1 cpu -irlen 5 -expected-id 0x10900a6d
100+
set _TARGETNAME1 $_CHIPNAME1.cpu
101+
target create $_TARGETNAME1 riscv -chain-position $_TARGETNAME1 -coreid 0
102+
103+
init
104+
#reset
105+
106+
if {[ info exists pulse_srst]} {
107+
ftdi_set_signal nSRST 0
108+
ftdi_set_signal nSRST z
109+
}
110+
111+
# add target to resume_group
112+
nuclei cti resume_group on $_TARGETNAME0 $_TARGETNAME1
113+
114+
foreach t [target names] {
115+
targets $t
116+
halt
117+
}
118+
```
119+
120+
## 命令行验证步骤
121+
122+
### 1. 同步暂停组验证
123+
124+
1. 配置文件中已添加目标到 `halt_group`
125+
2. 为两个核心分别加载不同固件
126+
3. 仅在 core0 的 `__amp_wait()` 函数设置断点
127+
4. 执行流程:先恢复 core1,再恢复 core0
128+
5. 验证结果:当 core0 触发断点暂停时,core1 同步暂停
129+
130+
![](asserts/images/25/halt-group-command-test.png)
131+
132+
### 2. 同步恢复组验证
133+
134+
1. 配置文件中已添加目标到 `resume_group`
135+
2. 为两个核心加载相同 helloworld 固件
136+
3. 仅向 core0 发送继续运行命令:
137+
4. 验证结果:串口输出显示两个核心同时运行
138+
139+
![](asserts/images/25/resume-group-command-test.png)
140+
141+
![](asserts/images/25/resume-group-command-test-log.png)
142+
143+
## IDE 验证步骤
144+
145+
### 1. 同步暂停组验证
146+
147+
1. 配置文件中已配置 `halt_group`
148+
2. 为两个核心加载不同固件
149+
3. 在 core0 的 `core_main.c` 第 152 行设置断点
150+
4. 操作顺序:
151+
- 先启动 core1 运行
152+
- 再启动 core0 运行
153+
5. 验证结果:core0 触发断点时,core1 同步暂停
154+
155+
![](asserts/images/25/halt-group-ide-test.png)
156+
157+
### 2. 同步恢复组验证
158+
159+
1. 配置文件中已配置 `resume_group`
160+
2. 为两个核心加载不同固件
161+
3. 仅启动 core0 运行
162+
4. 验证结果:串口输出显示两个核心同时运行
163+
164+
![](asserts/images/25/resume-group-ide-test.png)
165+
166+
![](asserts/images/25/resume-group-ide-test-log.png)

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Click [this link](https://doc.nucleisys.com/nuclei_studio_supply/) to see online
3030
3131
## Documents
3232

33-
> Generated by `python3 update.py` @ 2025-03-25 14:12:26
33+
> Generated by `python3 update.py` @ 2025-04-07 17:38:39
3434
3535
| Document | Description |
3636
|:---|:---|
@@ -58,4 +58,5 @@ Click [this link](https://doc.nucleisys.com/nuclei_studio_supply/) to see online
5858
| [22-example_for_adding_new_instructions_in_llvm.md](22-example_for_adding_new_instructions_in_llvm.md) | 在llvm中新增自定义汇编指令教程 |
5959
| [23-nuclei_debug_map_register_analyze.md](23-nuclei_debug_map_register_analyze.md) | 如何使用芯来提供的DebugMap寄存器分析错误现场 |
6060
| [24-example_for_adding_new_instructions_in_binutils.md](24-example_for_adding_new_instructions_in_binutils.md) | 在binutils中新增自定义汇编指令教程 |
61+
| [25-nuclei_cross_trigger_in_openocd.md](25-nuclei_cross_trigger_in_openocd.md) | OpenOCD 中 Nuclei 交叉触发功能使用指南 |
6162

107 KB
Loading
197 KB
Loading
61.1 KB
Loading
132 KB
Loading
71 KB
Loading
189 KB
Loading

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ nav:
2929
- 22-example_for_adding_new_instructions_in_llvm.md
3030
- 23-nuclei_debug_map_register_analyze.md
3131
- 24-example_for_adding_new_instructions_in_binutils.md
32+
- 25-nuclei_cross_trigger_in_openocd.md
3233
exclude_docs: |
3334
0-*.md
3435
theme:

0 commit comments

Comments
 (0)