Skip to content

Commit 137c3f6

Browse files
Ready for review
1 parent e089ca2 commit 137c3f6

File tree

8 files changed

+247
-17
lines changed

8 files changed

+247
-17
lines changed

content/learning-paths/automotive/zenacssdebug/_index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ learning_objectives:
1717
prerequisites:
1818
- Ubuntu 22.04 host machine
1919
- Arm Development Studio 2024.1 (or later) and an appropriate license
20-
- A basic understanding of the Arm Zena CSS software stack
20+
- A basic understanding of the Arm Zena CSS software stack and Arm processors
2121

2222
author: Ronan Synnott
2323

content/learning-paths/automotive/zenacssdebug/config.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ Debug Configurations are stored in a configuration database. You must first crea
3030

3131
Navigate to `File` > `New` > `Other`, and then select `Configuration Database` > `Configuration Database` from the drop-down list.
3232

33-
![New Configuration Database](configdb.png)
34-
3533
Click `Next`. Give the Database a meaningful name, and click `Finish`.
3634

3735
## Debug Configuration

content/learning-paths/automotive/zenacssdebug/connect.md

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ weight: 5 # 1 is first, 2 is second, etc.
88
layout: "learningpathall"
99
---
1010

11+
## Debug Connections
12+
1113
You are now ready to create debug connections for each of the sub-systems within Zena CSS. This section will create the connections, which will be subsequently enhanced in the following section. You may prefer to fully set up one such connection before moving to others.
1214

1315
Development Studio has full support for Heterogeneous systems such as Zena CSS, and so you can connect to all processors simultaneously.
@@ -18,7 +20,7 @@ It may be sensible to create a project to store these connections (`.launch` fil
1820

1921
Select `File` > `New...` > `Project` > `General` > `Project`, and give it a meaningful name (`Connections`).
2022

21-
## RSE (Cortex-M55)
23+
### RSE (Cortex-M55)
2224

2325
Runtime Security Engine (RSE) is based on [Cortex-M55](https://developer.arm.com/Processors/Cortex-M55) core and is a security subsystem fulfilling the role of Root of Trust.
2426

@@ -41,27 +43,33 @@ As we shall be later launching the FVP with the software stack loaded, select `C
4143
Assuming the same host will be running both the FVP and the debugger, specify the `Connection address` as the default `127.0.0.1:7100`.
4244

4345
{{% notice Note %}}
44-
`127.0.0.1` is the same as `localhost`. It is also possible to connect to a remote host by specifying appropriate address.
46+
`127.0.0.1` is the same as `localhost`, that is the same host machine as is running the FVP.
47+
48+
It is also possible to connect to a remote host by specifying appropriate IP address, and launching FVP with the `-A` option.
4549

4650
`7100` is the default port number. You may need to change this if necessary.
4751
{{% /notice %}}
4852

4953
Click `Apply` to save the connection information, and `Close`. Observe that `RSE.launch` is created inside the `Connections` project.
5054

51-
## Safety Island (Cortex-R82AE)
55+
### Safety Island (Cortex-R82AE)
5256

5357
The Safety Island is a subsystem based on [Cortex-R82AE](https://developer.arm.com/Processors/Cortex-R82AE) core. The software running on the Safety Island is responsible for power, clock and CMN control.
5458

5559
The procedure to create this connection is very similar to the above, other than to select `Bare Metal Debug` > `Arm_Cortex-R82AE` from the pull down.
5660

57-
You can copy-and-paste `RSE.launch` as `SI.launch` and open to change the CPU.
61+
{{% notice %}}
62+
For convenience you can copy-and-paste `RSE.launch` as `SI.launch` and simply modify the CPU.
63+
{{% /notice %}}
5864

59-
## Primary Compute (Cortex-A720AE)
65+
### Primary Compute (Cortex-A720AE)
6066

6167
The Primary Compute consists of four processor clusters to run a rich OS such as Linux. Each processor cluster includes four [Cortex-A720AE](https://developer.arm.com/Processors/Cortex-A720AE) cores and a [DSU-120AE](https://developer.arm.com/Processors/DSU-120AE) DynamIQ Shared Unit.
6268

6369
The application processors will be debugged in an SMP configuration with Linux Kernel awareness.
6470

65-
As above, create `Primary.launch` connection and scroll to `Linux Kernel Debug` > `ARM_Cortex-A720AEx16 SMP Cluster 1`.
71+
As above, create `Primary_init.launch` connection and scroll to `Bare Metal Debug` > `ARM_Cortex-A720AE_0`. This will connect to just CPU0, leaving the other CPUs free to run.
72+
73+
To debug the Linux kernel we can make use of the [OS awareness](https://developer.arm.com/documentation/101470/latest/Debugging-Embedded-Systems/About-OS-awareness) feature of the Arm Debugger.
6674

67-
This will connect to all Cortex-A720AE processors present in the FVP, though only cores 0-3 are used.
75+
Create `Primary_Linux.launch` connection and scroll to `Linux Kernel Debug` > `ARM_Cortex-A720AEx16 SMP Cluster 1`. This will connect to all 16 `Cortex-A720AE` processors present in the FVP, though only cores 0-3 are used.
145 KB
Loading

content/learning-paths/automotive/zenacssdebug/launch.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,28 @@ weight: 3 # 1 is first, 2 is second, etc.
88
layout: "learningpathall"
99
---
1010

11-
From the [documentation](https://arm-auto-solutions.docs.arm.com/en/v2.0/rd-aspen/user_guide/reproduce.html#run-the-fvp) the default command to launch the FVP with the software stack loaded is:
11+
## Launch FVP
12+
13+
From the [documentation](https://arm-auto-solutions.docs.arm.com/en/v2.0/rd-aspen/user_guide/reproduce.html#run-the-fvp) the default command to launch the FVP (within the virtual environment) with the software stack loaded is:
1214

1315
```command
1416
kas shell -c "../layers/meta-arm/scripts/runfvp -t tmux --verbose"
1517
```
1618

17-
However this does not enable the Iris debug server inside the model, and so will not be debuggable. Additional command options are necessary.
19+
It is sensible to continue to use this method to launch the FVP whilst debugging. However this command as shown does not enable the Iris debug server inside the model, and so will not be debuggable.
20+
21+
Additional command options are necessary.
1822

1923
We will use the following. See output of `FVP_RD_Aspen --help` for full list and explanation. Options are case-sensitive.
2024

2125
| Option | Alias | Notes |
2226
|---------------------- |--------- |---------------------------------------------- |
23-
| \-\-iris-server | -I | Start Iris Debug Server |
24-
| \-\-iris-port | | Specify a port number (default = `7100`) |
25-
| \-\-run | -R | Run simulation when debug server started |
26-
| \-\-iris-allow-remote | -A | Allow remote connections (if different hosts) |
27+
| `--iris-server` | `-I` | Start Iris Debug Server |
28+
| `--iris-port` | | Specify a port number (default = `7100`) |
29+
| `--run` | `-R` | Run simulation when debug server started |
30+
| `--iris-allow-remote` | `-A` | Allow remote connections (if different hosts) |
2731

28-
## Launch FVP with additional options
32+
### Launch FVP with additional options
2933

3034
To launch the FVP with additional options, modify the above command by adding `--` and then the options.
3135

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
---
2+
# User change
3+
title: "Debug Primary Compute and Linux OS"
4+
5+
weight: 8 # 1 is first, 2 is second, etc.
6+
7+
# Do not modify these elements
8+
layout: "learningpathall"
9+
---
10+
11+
## Debug Primary Compute
12+
13+
The Primary Compute application processors (`Cortex-A720AE`) are the final processors to be enabled.
14+
15+
As before we can connect whilst powered down and monitor the point that they are enabled.
16+
17+
You can debug the initialization code and/or the final operating system threads.
18+
19+
### Connect debugger to target
20+
21+
Use the following debugger commands in the `Primary_init.launch` to load the symbols for the `BL2` initialization code, setting a breakpoint at `bl2_entrypoint`.
22+
23+
Note that an address "offset" is used to specify the exception level that the image are relevant to. If code changes exception level, debug info would need to also be loaded to the corresponding EL address space.
24+
25+
For example the processors start in `EL3` and moves to `EL2N` when the Linux kernel is enabled.
26+
27+
``` text
28+
stop
29+
30+
add-symbol-file /arm-auto-solutions/build/tmp_baremetal/work/fvp_rd_aspen-poky-linux/trusted-firmware-a/2.11.0+git/image/firmware/bl2.elf EL3:0x0
31+
32+
tbreak bl2_entrypoint
33+
```
34+
35+
Run the code to the `bl2_entrypoint` and you can debug as expected.
36+
37+
### Debug Linux kernel modules
38+
39+
To make use of the OS awareness, disconnect `Primary_init` and connect to `Primary_Linux` as created previously. Load the symbols from `vmlinux` image.
40+
41+
``` text
42+
stop
43+
44+
add-symbol-file /arm-auto-solutions/build/tmp_baremetal/work/fvp_rd_aspen-poky-linux/linux-yocto/6.6.54+git/linux-fvp_rd_aspen-standard-build/vmlinux EL2N:0x0
45+
46+
set substitute-path /usr/src/kernel/ /arm-auto-solutions/build/tmp_baremetal/work-shared/fvp-rd-aspen/kernel-source/
47+
```
48+
Run the FVP until the OS prompt appears.
49+
50+
{{% notice %}}
51+
If only interested in kernel debug, modify the launch command for the FVP to include `--run` to start execution immediately.
52+
53+
``` command
54+
kas shell -c "../layers/meta-arm/scripts/runfvp -t tmux --verbose -- --iris-server --iris-port 7100 --run"
55+
```
56+
{{% /notice %}}
57+
58+
You can now enable the `Threads` view in the `Debug Control` pane.
59+
60+
Right-click on the connection, and select `Display Threads`. You can also do this by entering `thread` in the `Command` pane.
61+
62+
The view will then change from listing the 16 application processors to the OS threads.
63+
64+
{{% notice Note %}}
65+
A warning of the form:
66+
``` text
67+
WARNING(ROS60): Could not enable OS support as the OS does not appear to be initialized. This might be caused by a mismatch between the loaded symbols and the code on the target or because the OS is not up and running. Enabling OS support will be re-attempted when the target next stops.
68+
```
69+
may be emitted if the OS is not booted when you connect. It can safely be ignored.
70+
{{% /notice %}}
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
---
2+
# User change
3+
title: "Debug RSE from reset"
4+
5+
weight: 6 # 1 is first, 2 is second, etc.
6+
7+
# Do not modify these elements
8+
layout: "learningpathall"
9+
---
10+
11+
## Debug RSE from reset
12+
13+
Let us start by debugging the initial code that executes on the Cortex-M55 within the RSE block.
14+
15+
### Launch FVP
16+
17+
Start a new `tmux` session for the FVP (if necessary):
18+
```command
19+
tmux new-session -s arm-auto-solutions
20+
```
21+
and navigate to your code repository.
22+
23+
To debug from reset, launch the FVP with the Iris server but do not run. This will hold the FVP in the initial reset condition.
24+
25+
```command
26+
kas shell -c "../layers/meta-arm/scripts/runfvp -t tmux --verbose -- --iris-server --iris-port 7100"
27+
```
28+
The FVP will start and emit various informational messages. Once initialized you should see something similar to:
29+
30+
```output
31+
...
32+
Info: RD_Aspen: RD_Aspen.css.smb.rse_flashloader: FlashLoader: Saved 64MB to file '~/arm-auto-solutions/build/tmp_baremetal/deploy/images/fvp-rd-aspen/rse-flash-image.img'
33+
34+
Info: RD_Aspen: RD_Aspen.ros.flash_loader: FlashLoader: Saved 128MB to file '~/arm-auto-solutions/build/tmp_baremetal/deploy/images/fvp-rd-aspen/ap-flash-image.img'
35+
```
36+
37+
Note that execution has not started.
38+
39+
### Connect the debugger
40+
41+
Using the `RSE` connection created in the previous section, connect the debugger to the FVP. Observe that the processor is stopped before the first instruction has been executed.
42+
43+
In fact, the FVP is configured to have the vector table (`VTOR_S`) start at `0x11000000`, and it you inspect memory at that address the vector table will be populated. However no debug information is visible. Debug information must be loaded.
44+
45+
In the `Debug Pane`, select `Load...` from the pane menu, and select `Add Symbols file`.
46+
47+
Browse to the `bl1_1.axf` file which is likely at:
48+
49+
``` bash
50+
/arm-auto-solutions/build/tmp_baremetal/work/fvp_rd_aspen-poky-linux/trusted-firmware-m/2.1.0/build/bin/bl1_1.axf
51+
```
52+
Debug symbols will be loaded, but likely no source will be displayed. This is because the build was performed within the virtual environment but the debugger is running outside of that.
53+
54+
You will be prompted to enter a path substitution to locate the sources. You can refer to the lowest common path so that all subsequent source files will also be located successfully.
55+
56+
``` bash
57+
/usr/src/debug/trusted-firmware-m/2.1.0/
58+
/arm-auto-solutions/build/tmp_baremetal/work/fvp_rd_aspen-poky-linux/trusted-firmware-m/2.1.0/git/tfm/"
59+
```
60+
Finally, to perform a single instruction step (`stepi`) to allow the processor to fetch the address of the `Reset_Handler` and stop there.
61+
62+
You can now step through the code, set breakpoints, and inspect the target as the code proceeds.
63+
64+
### Automate setup
65+
66+
For convenience, it is possible to automate these actions every time you connect by entering them as `Debugger Commands` in the `.launch` configuration.
67+
68+
Open (double-click) the `.launch` file, and navigate to the `Debugger` pane.
69+
70+
Enable `Execute debugger commands`, and enter the following (note pathing for your setup). You can copy the exact commands from the `Command` or `History` pane whilst performing the above GUI configuration.
71+
72+
It is recommended to have an explicit `stop` command as symbols cannot be loaded whilst the target is running.
73+
74+
``` text
75+
stop
76+
77+
add-symbol-file /arm-auto-solutions/build/tmp_baremetal/work/fvp_rd_aspen-poky-linux/trusted-firmware-m/2.1.0/build/bin/bl1_1.axf
78+
79+
set substitute-path /usr/src/debug/trusted-firmware-m/2.1.0/ /arm-auto-solutions/build/tmp_baremetal/work/fvp_rd_aspen-poky-linux/trusted-firmware-m/2.1.0/git/tfm/
80+
81+
stepi
82+
```
83+
![Debugger pane](debugger_commands.png)
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
---
2+
# User change
3+
title: "Debug Safety Island code"
4+
5+
weight: 7 # 1 is first, 2 is second, etc.
6+
7+
# Do not modify these elements
8+
layout: "learningpathall"
9+
---
10+
## Debug Safety Island code from beginning
11+
12+
The Safety Island (Cortex-R82AE) is released from reset by the RSE code, and so the RSE code must proceed to that point before the Safety Island core can execute.
13+
14+
### Launch FVP
15+
16+
If necessary, restart the FVP in the reset state as before, and reconnect `RSE`.
17+
18+
```command
19+
kas shell -c "../layers/meta-arm/scripts/runfvp -t tmux --verbose -- --iris-server --iris-port 7100"
20+
```
21+
22+
Set up the `SI` connection in a similar way as the `RSE` connection. Use the following commands in the `Debugger` pane. This will load debug symbols and performing the necessary path substitution. You can then set a breakpoint on the entry point of the `SI` code, `arch_exception_reset`.
23+
24+
``` text
25+
stop
26+
27+
add-symbol-file /arm-auto-solutions/build/tmp_baremetal/deploy/images/fvp-rd-aspen/si0_ramfw.elf
28+
29+
set substitute-path /usr/src/debug/scp-firmware/2.14.0/ /arm-auto-solutions/build/tmp_baremetal/work/fvp_rd_aspen-poky-linux/scp-firmware/2.14.0/git/
30+
31+
b arch_exception_reset
32+
```
33+
34+
### Start execution
35+
36+
Select the `RSE` connection in the `Debug Control` pane, and start execution (this will be unavailable in the `SI` connection, as that is currently powered down).
37+
38+
The `RSE` code will run until the point that the `SI` is enabled. This is reflected in the output log.
39+
40+
``` output
41+
[INF] BL2: SI CL0 post load start
42+
```
43+
44+
#### Full output log
45+
46+
``` output
47+
Trying ::1...
48+
Trying 127.0.0.1...
49+
Connected to localhost.
50+
Escape character is '^]'.
51+
[INF] Starting TF-M BL1_1
52+
[INF] Jumping to BL1_2
53+
[INF] Starting TF-M BL1_2
54+
[INF] Attempting to boot image 0
55+
[INF] BL2 image decrypted successfully
56+
[INF] BL2 image validated successfully
57+
[INF] Jumping to BL2
58+
[INF] Starting bootloader
59+
[INF] PSA Crypto init done, sig_type: EC-P256
60+
[INF] BL2: SI CL0 pre load start
61+
[INF] BL2: SI CL0 pre load complete
62+
[INF] Primary slot: version=0.0.7+0
63+
[INF] Secondary slot: version=0.0.7+0
64+
[INF] Image 3 RAM loading to 0x70083c00 is succeeded.
65+
[INF] Image 3 loaded from the primary slot
66+
[INF] BL2: SI CL0 post load start
67+
```

0 commit comments

Comments
 (0)