Skip to content

Commit cfe71dc

Browse files
authored
Core Peripheral Viewer - Initial Iteration (#849)
* Add Core Peripherals dialog * Refactor for reuse * Get SCVD files from derived class * Add Core Peripherals SCVD files * Enable Core Peripherals with hidden setting "cmsis-debugger.corePeripherals.enabled": true, * Reduce redundant test code
1 parent e89e2d1 commit cfe71dc

20 files changed

Lines changed: 1201 additions & 274 deletions

__mocks__/vscode.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,13 @@ module.exports = {
121121
executeCommand: jest.fn(),
122122
// Default to all views in extension having been correctly loaded
123123
getCommands: jest.fn(() => Promise.resolve([
124+
// Real views in extension
124125
'cmsis-debugger.liveWatch.open',
125126
'cmsis-debugger.liveWatch.focus',
126127
'cmsis-debugger.componentViewer.open',
127128
'cmsis-debugger.componentViewer.focus',
129+
'cmsis-debugger.corePeripherals.open',
130+
'cmsis-debugger.corePeripherals.focus',
128131
])),
129132
registerCommand: jest.fn(),
130133
},

configs/core-peripherals/Memory_Protection_Unit.scvd

Lines changed: 208 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 185 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
Copyright 2026 Arm Limited
4+
5+
Licensed under the Apache License, Version 2.0 (the "License");
6+
you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
16+
-->
17+
<component_viewer schemaVersion="0.1" xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="Component_Viewer.xsd">
18+
<component name="NestedVectoredInterruptControllerComponent" version="1.0.0"/>
19+
<typedefs>
20+
<typedef name="Vector_t" size="4">
21+
<member name="INTLINESNUM" type="uint32_t" offset="0"/>
22+
<var name="Enable" type="uint8_t" size="256">
23+
<enum name="not enabled" value="0"/>
24+
<enum name="enabled" value="1"/>
25+
</var>
26+
<var name="Pending" type="uint8_t" size="256">
27+
<enum name="not pending" value="0"/>
28+
<enum name="pending" value="1"/>
29+
</var>
30+
<var name="Active" type="uint8_t" size="256">
31+
<enum name="not active" value="0"/>
32+
<enum name="active" value="1"/>
33+
</var>
34+
<var name="Priority" type="uint8_t" size="256"/>
35+
<var name="Displayed" type="uint8_t" size="256"/>
36+
<var name="Index" type="uint8_t" size="256">
37+
<enum name="Thread Mode" value="0"/>
38+
<enum name="Non-maskable Interrupt (NMI)" value="2"/>
39+
<enum name="Hard Fault (HARDFAULT)" value="3" />
40+
<enum name="Memory Management (MEMFAULT)" value="4" />
41+
<enum name="Bus Fault (BUSFAULT)" value="5" />
42+
<enum name="Usage Fault (USGFAULT)" value="6" />
43+
<enum name="Secure Fault (SECUREFAULT)" value="7" />
44+
<enum name="System Service Call (SVCALL)" value="11" />
45+
<enum name="Debug Monitor (MONITOR)" value="12" />
46+
<enum name="Pend System Service (PENDSV)" value="14" />
47+
<enum name="System Tick Timer (SYSTICK)" value="15" />
48+
</var>
49+
</typedef>
50+
</typedefs>
51+
<objects>
52+
<object name="NestedVectoredInterruptControllerObject">
53+
<var name="WithSecureExtension" type="uint8_t" value="1"/>
54+
<read name="SHCSR_value" type="uint32_t" offset="0xE000ED24"/>
55+
<read name="SHPR_values" type="uint32_t" size="3" offset="0xE000ED18"/>
56+
<read name="ICSR_value" type="uint32_t" offset="0xE000ED04"/>
57+
<read name="AIRCR_value" type="uint32_t" offset="0xE000ED0C"/>
58+
<read name="VTOR_value" type="uint32_t" offset="0xE000ED08"/>
59+
<read name="DEMCR_value" type="uint32_t" offset="0xE000EDFC"/>
60+
<read name="SYST_CSR_value" type="uint32_t" offset="0xE000E010"/>
61+
<read name="NVIC_ISER_values" type="uint32_t" size="8" offset="0xE000E100"/>
62+
<read name="NVIC_ISPR_values" type="uint32_t" size="8" offset="0xE000E200"/>
63+
<read name="NVIC_IABR_values" type="uint32_t" size="8" offset="0xE000E300"/>
64+
<read name="NVIC_IPR_values" type="uint32_t" size="60" offset="0xE000E400"/>
65+
<read name="Vectors" type="Vector_t" offset="0xE000E004"/>
66+
<var name="Count" type="uint32_t" value="0"/>
67+
<list name="Count" start="0" limit="Vectors.INTLINESNUM*32">
68+
<calc cond="1">
69+
Vectors.Index[Count]=Count;
70+
</calc>
71+
72+
<calc cond="0==( (Count==0) || (Count==1) || ( (Count==7) &amp;&amp; (0==WithSecureExtension) ) || (Count==8) || (Count==9) || (Count==10) || (Count==13) )">
73+
Vectors.Displayed[Count]=1;
74+
</calc>
75+
76+
<calc cond="(Count==2)" info="values for NMI">
77+
Vectors.Enable[Count]=1;
78+
Vectors.Pending[Count]=((ICSR_value&gt;&gt;31)&amp;0x1);
79+
Vectors.Active[Count]=((ICSR_value&gt;&gt;0)&amp;0x1F)==2;
80+
Vectors.Priority[Count]=-2;
81+
</calc>
82+
<!--
83+
-->
84+
<calc cond="( Count==3 )" info="values for HARDFAULT">
85+
Vectors.Enable[Count]=1;
86+
Vectors.Active[Count]=((ICSR_value&gt;&gt;0)&amp;0x1F)==3;
87+
Vectors.Pending[Count]=0;
88+
Vectors.Priority[Count]=-1;
89+
</calc>
90+
<calc cond="( Count==4 )" info="values for MEMFAULT">
91+
Vectors.Enable[Count]=((SHCSR_value&gt;&gt;16)&amp;0x1);
92+
Vectors.Active[Count]=((SHCSR_value&gt;&gt;0)&amp;0x1);
93+
Vectors.Pending[Count]=((SHCSR_value&gt;&gt;13)&amp;0x1);
94+
Vectors.Priority[Count]=((SHPR_values[0]&gt;&gt;0)&amp;0xFF);
95+
</calc>
96+
<calc cond="( Count==5 )" info="values for BUSFAULT">
97+
Vectors.Enable[Count]=((SHCSR_value&gt;&gt;17)&amp;0x1);
98+
Vectors.Active[Count]=((SHCSR_value&gt;&gt;1)&amp;0x1);
99+
Vectors.Pending[Count]=((SHCSR_value&gt;&gt;14)&amp;0x1);
100+
Vectors.Priority[Count]=((SHPR_values[0]&gt;&gt;8)&amp;0xFF);
101+
</calc>
102+
<calc cond="( Count==6 )" info="values for USGFAULT">
103+
Vectors.Enable[Count]=((SHCSR_value&gt;&gt;18)&amp;0x1);
104+
Vectors.Active[Count]=((SHCSR_value&gt;&gt;3)&amp;0x1);
105+
Vectors.Pending[Count]=((SHCSR_value&gt;&gt;12)&amp;0x1);
106+
Vectors.Priority[Count]=((SHPR_values[0]&gt;&gt;16)&amp;0xFF);
107+
</calc>
108+
<calc cond="( (Count==7) &amp;&amp; WithSecureExtension )" info="values for SECUREFAULT">
109+
Vectors.Enable[Count]=((SHCSR_value&gt;&gt;19)&amp;0x1);
110+
Vectors.Active[Count]=((SHCSR_value&gt;&gt;4)&amp;0x1);
111+
Vectors.Pending[Count]=((SHCSR_value&gt;&gt;20)&amp;0x1);
112+
Vectors.Priority[Count]=((SHPR_values[0]&gt;&gt;24)&amp;0xFF);
113+
</calc>
114+
<calc cond="( Count==11 )" info="values for SVCALL">
115+
Vectors.Enable[Count]=1;
116+
Vectors.Active[Count]=((SHCSR_value&gt;&gt;7)&amp;0x1);
117+
Vectors.Pending[Count]=((SHCSR_value&gt;&gt;15)&amp;0x1);
118+
Vectors.Priority[Count]=((SHPR_values[1]&gt;&gt;24)&amp;0xFF);
119+
</calc>
120+
<calc cond="( Count==12 )" info="values for MONITOR">
121+
Vectors.Enable[Count]=((DEMCR_value&gt;&gt;16)&amp;0x1);
122+
Vectors.Active[Count]=((SHCSR_value&gt;&gt;8)&amp;0x1);
123+
Vectors.Pending[Count]=((DEMCR_value&gt;&gt;17)&amp;0x1);
124+
Vectors.Priority[Count]=((SHPR_values[2]&gt;&gt;0)&amp;0xFF);
125+
</calc>
126+
<calc cond="( Count==14 )" info="values for PENDSV">
127+
Vectors.Enable[Count]=1;
128+
Vectors.Active[Count]=((SHCSR_value&gt;&gt;10)&amp;0x1);
129+
Vectors.Pending[Count]=((ICSR_value&gt;&gt;28)&amp;0x1);
130+
Vectors.Priority[Count]=((SHPR_values[2]&gt;&gt;16)&amp;0xFF);
131+
</calc>
132+
<calc cond="( Count==15 )" info="values for SYSTICK">
133+
Vectors.Enable[Count]=((SYST_CSR_value&gt;&gt;1)&amp;0x1);
134+
Vectors.Active[Count]=((SHCSR_value&gt;&gt;11)&amp;0x1);
135+
Vectors.Pending[Count]=((ICSR_value&gt;&gt;26)&amp;0x1);
136+
Vectors.Priority[Count]=((SHPR_values[2]&gt;&gt;24)&amp;0xFF);
137+
</calc>
138+
<!--Vectors.Priority[Count]=((SHPR_values[((Count-4)/4)]&gt;&gt;(((Count-4)&amp;3)*8))&amp;0xFF);-->
139+
140+
<calc cond="( Count&gt;15 )" info="values for EXTIRQn">
141+
Vectors.Enable[Count]=((NVIC_ISER_values[((Count-16)/32)]&gt;&gt;(((Count-16)&amp;0x1F)))&amp;0x1);
142+
Vectors.Active[Count]=((NVIC_IABR_values[((Count-16)/32)]&gt;&gt;(((Count-16)&amp;0x1F)))&amp;0x1);
143+
Vectors.Pending[Count]=((NVIC_ISPR_values[((Count-16)/32)]&gt;&gt;(((Count-16)&amp;0x1F)))&amp;0x1);
144+
Vectors.Priority[Count]=((NVIC_IPR_values[((Count-16)/4)]&gt;&gt;(((Count-16)&amp;0x3)*8))&amp;0xFF);
145+
</calc>
146+
</list>
147+
<out name="Nested Vectored Interrupt Controller">
148+
<!--
149+
<item property="values for debugging" value="">
150+
<item property="SHCSR_value&gt;&gt;16" value="%x[(SHCSR_value&gt;&gt;16)]"/>
151+
<item property="SHCSR_value" value="%x[(SHCSR_value)]"/>
152+
<item property="NVIC_ISER_values[0]" value="%x[NVIC_ISER_values[0]]"/>
153+
</item>
154+
-->
155+
<item property="INTLINESNUM" value="%d[Vectors.INTLINESNUM]"/>
156+
<item property="Interrupt Control and Status (ICSR)" value="%x[ICSR_value]">
157+
<item property="ISRPENDING" value="%d[(ICSR_value&gt;&gt;22)&amp;0x1]"/>
158+
<item property="VECTPENDING" value="%d[(ICSR_value&gt;&gt;12)&amp;0x1F]"/>
159+
<item property="RETTOBASE" value="%d[(ICSR_value&gt;&gt;11)&amp;0x1]"/>
160+
<item property="VECTACTIVE" value="%d[(ICSR_value&gt;&gt;0)&amp;0x1F]"/>
161+
</item>
162+
<item property="Application Interrupt and Reset Control (AIRCR)" value="%x[AIRCR_value]">
163+
<item property="ENDIANNESS" value="%d[(AIRCR_value&gt;&gt;15)&amp;0x1]"/>
164+
<item property="PRIGROUP" value="%d[(AIRCR_value&gt;&gt;8)&amp;0x7]"/>
165+
</item>
166+
<item property="Vector Table Offset (VTOR)" value="%x[VTOR_value]">
167+
<item property="TBLOFF" value="%x[(VTOR_value&gt;&gt;7)&amp;0x1FFFFFF]"/>
168+
</item>
169+
<item property="Vector Handlers" value="">
170+
<list name="Count" start="0" limit="Vectors.INTLINESNUM*32">
171+
<item>
172+
<print property="%E[Vectors.Index[Count]]" value="%E[Vectors.Enable[Count]], %E[Vectors.Pending[Count]], %E[Vectors.Active[Count]]" cond="Vectors.Displayed[Count]==1 &amp;&amp; Count&lt;16"/>
173+
<print property="External Interrupt %d[Count-16] (EXTIRQ%d[Count-16])" value="%E[Vectors.Enable[Count]], %E[Vectors.Pending[Count]], %E[Vectors.Active[Count]]" cond="Vectors.Displayed[Count]==1 &amp;&amp; Count&gt;15"/>
174+
<item property="Index" value="%d[Vectors.Index[Count]]"/>
175+
<item property="Enable" value="%d[Vectors.Enable[Count]]"/>
176+
<item property="Pending" value="%d[Vectors.Pending[Count]]"/>
177+
<item property="Active" value="%d[Vectors.Active[Count]]"/>
178+
<item property="Priority" value="%d[Vectors.Priority[Count]]"/>
179+
</item>
180+
</list>
181+
</item>
182+
</out>
183+
</object>
184+
</objects>
185+
</component_viewer>
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
Copyright 2026 Arm Limited
4+
5+
Licensed under the Apache License, Version 2.0 (the "License");
6+
you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
16+
-->
17+
<component_viewer schemaVersion="0.1" xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="Component_Viewer.xsd">
18+
<component name="SystemControlConfigComponent" version="1.0.0"/>
19+
<objects>
20+
<object name="SystemControlConfigObject">
21+
<read name="SCR_value" type="uint32_t" offset="0xE000ED10"/>
22+
<read name="CCR_value" type="uint32_t" offset="0xE000ED14"/>
23+
<out name="System Config and Control">
24+
<item property="System Config (SCR)" value="%x[SCR_value]">
25+
<item property="SEVONPEND" value="%d[(SCR_value&gt;&gt;4)&amp;0x1]"/>
26+
<item property="SLEEPDEEPS" value="%d[(SCR_value&gt;&gt;3)&amp;0x1]"/>
27+
<item property="SLEEPDEEP" value="%d[(SCR_value&gt;&gt;2)&amp;0x1]"/>
28+
<item property="SLEEPONEXIT" value="%d[(SCR_value&gt;&gt;1)&amp;0x1]"/>
29+
</item>
30+
<item property="Configuration and Control (CCR)" value="%x[CCR_value]">
31+
<item property="TRD" value="%d[(CCR_value&gt;&gt;20)&amp;0x1]"/>
32+
<item property="LOB" value="%d[(CCR_value&gt;&gt;19)&amp;0x1]"/>
33+
<item property="BP" value="%d[(CCR_value&gt;&gt;18)&amp;0x1]"/>
34+
<item property="IC" value="%d[(CCR_value&gt;&gt;17)&amp;0x1]"/>
35+
<item property="DC" value="%d[(CCR_value&gt;&gt;16)&amp;0x1]"/>
36+
<item property="STKOFHFNMIGN" value="%d[(CCR_value&gt;&gt;10)&amp;0x1]"/>
37+
<item property="BFHFNMIGN" value="%d[(CCR_value&gt;&gt;8)&amp;0x1]"/>
38+
<item property="DIV_0_TRP" value="%d[(CCR_value&gt;&gt;4)&amp;0x1]"/>
39+
<item property="UNALIGN_TRP" value="%d[(CCR_value&gt;&gt;3)&amp;0x1]"/>
40+
<item property="USERSETMPEND" value="%d[(CCR_value&gt;&gt;1)&amp;0x1]"/>
41+
</item>
42+
</out>
43+
</object>
44+
</objects>
45+
</component_viewer>
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
Copyright 2026 Arm Limited
4+
5+
Licensed under the Apache License, Version 2.0 (the "License");
6+
you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
16+
-->
17+
<component_viewer schemaVersion="0.1" xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="Component_Viewer.xsd">
18+
<component name="SystemTickTimerComponent" version="1.0.0"/>
19+
<typedefs>
20+
<typedef name="SysTick_t" size="0x10">
21+
<member name="CTRL" type="uint32_t" offset="0x00"/>
22+
<member name="LOAD" type="uint32_t" offset="0x04"/>
23+
<member name="VAL" type="uint32_t" offset="0x08"/>
24+
<member name="CALIB" type="uint32_t" offset="0x0C"/>
25+
</typedef>
26+
</typedefs>
27+
<objects>
28+
<object name="SystemTickTimerObject">
29+
<var name="SysTickBase" type="uint32_t" value="0xE000E010"/>
30+
<read name="SysTick" type="SysTick_t" offset="SysTickBase"/>
31+
<out name="System Tick Timer">
32+
<item property="SysTick" value="">
33+
<item property="CTRL" value="%x[SysTick.CTRL]">
34+
<item property="ENABLE" value="%d[(SysTick.CTRL&gt;&gt;0)&amp;0x1]"/>
35+
<item property="TICKINT" value="%d[(SysTick.CTRL&gt;&gt;1)&amp;0x1]"/>
36+
<item property="CLKSOURCE" value="%d[(SysTick.CTRL&gt;&gt;2)&amp;0x1]"/>
37+
<item property="COUNTFLAG" value="%d[(SysTick.CTRL&gt;&gt;16)&amp;0x1]"/>
38+
</item>
39+
<item property="LOAD" value="%x[SysTick.LOAD]"/>
40+
<item property="VAL" value="%x[SysTick.VAL]"/>
41+
<item property="CALIB" value="%x[SysTick.CALIB]">
42+
<item property="TENMS" value="%x[(SysTick.CALIB&gt;&gt;0)&amp;0xFFFFFF]"/>
43+
<item property="SKEW" value="%d[(SysTick.CALIB&gt;&gt;30)&amp;0x1]"/>
44+
<item property="NOREF" value="%d[(SysTick.CALIB&gt;&gt;31)&amp;0x1]"/>
45+
</item>
46+
</item>
47+
</out>
48+
</object>
49+
</objects>
50+
</component_viewer>

package.json

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,12 @@
6565
"id": "cmsis-debugger.componentViewer",
6666
"name": "Component Viewer",
6767
"icon": "media/trace-and-live-light.svg"
68+
},
69+
{
70+
"id": "cmsis-debugger.corePeripherals",
71+
"name": "Core Peripherals",
72+
"icon": "media/trace-and-live-light.svg",
73+
"when": "config.cmsis-debugger.corePeripherals.enabled"
6874
}
6975
]
7076
},
@@ -165,6 +171,32 @@
165171
"command": "vscode-cmsis-debugger.componentViewer.disablePeriodicUpdate",
166172
"title": "Disable Periodic Update",
167173
"category": "Component Viewer"
174+
},
175+
{
176+
"command": "vscode-cmsis-debugger.corePeripherals.lockComponent",
177+
"title": "Lock Component",
178+
"icon": "$(unlock)",
179+
"category": "Core Peripherals",
180+
"when": "config.cmsis-debugger.corePeripherals.enabled"
181+
},
182+
{
183+
"command": "vscode-cmsis-debugger.corePeripherals.unlockComponent",
184+
"title": "Unlock Component",
185+
"icon": "$(lock)",
186+
"category": "Core Peripherals",
187+
"when": "config.cmsis-debugger.corePeripherals.enabled"
188+
},
189+
{
190+
"command": "vscode-cmsis-debugger.corePeripherals.enablePeriodicUpdate",
191+
"title": "Enable Periodic Update",
192+
"category": "Core Peripherals",
193+
"when": "config.cmsis-debugger.corePeripherals.enabled"
194+
},
195+
{
196+
"command": "vscode-cmsis-debugger.corePeripherals.disablePeriodicUpdate",
197+
"title": "Disable Periodic Update",
198+
"category": "Core Peripherals",
199+
"when": "config.cmsis-debugger.corePeripherals.enabled"
168200
}
169201
],
170202
"menus": {
@@ -264,6 +296,22 @@
264296
{
265297
"command": "vscode-cmsis-debugger.componentViewer.disablePeriodicUpdate",
266298
"when": "true"
299+
},
300+
{
301+
"command": "vscode-cmsis-debugger.corePeripherals.lockComponent",
302+
"when": "false"
303+
},
304+
{
305+
"command": "vscode-cmsis-debugger.corePeripherals.unlockComponent",
306+
"when": "false"
307+
},
308+
{
309+
"command": "vscode-cmsis-debugger.corePeripherals.enablePeriodicUpdate",
310+
"when": "true"
311+
},
312+
{
313+
"command": "vscode-cmsis-debugger.corePeripherals.disablePeriodicUpdate",
314+
"when": "true"
267315
}
268316
],
269317
"view/title": [
@@ -350,6 +398,16 @@
350398
"command": "vscode-cmsis-debugger.componentViewer.unlockComponent",
351399
"when": "view == cmsis-debugger.componentViewer && viewItem == locked.parentInstance",
352400
"group": "inline@2"
401+
},
402+
{
403+
"command": "vscode-cmsis-debugger.corePeripherals.lockComponent",
404+
"when": "config.cmsis-debugger.corePeripherals.enabled && view == cmsis-debugger.corePeripherals && viewItem == parentInstance",
405+
"group": "inline@1"
406+
},
407+
{
408+
"command": "vscode-cmsis-debugger.corePeripherals.unlockComponent",
409+
"when": "config.cmsis-debugger.corePeripherals.enabled && view == cmsis-debugger.corePeripherals && viewItem == locked.parentInstance",
410+
"group": "inline@2"
353411
}
354412
]
355413
},

0 commit comments

Comments
 (0)