Skip to content

Commit dc251f7

Browse files
Merge pull request #2072 from madeline-underwood/Run-and-debug
Run and debug FVP linux [JA to review]
2 parents 05630a4 + a90d518 commit dc251f7

File tree

7 files changed

+136
-95
lines changed

7 files changed

+136
-95
lines changed

content/learning-paths/embedded-and-microcontrollers/linux-on-fvp/_index.md

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,20 @@
11
---
2-
title: Run and Debug a Linux Software Stack on Arm Virtual Platforms
2+
title: Debug Trusted Firmware-A and the Linux kernel on Arm FVP with Arm Development Studio
33

4-
minutes_to_complete: 180
4+
minutes_to_complete: 60
55

6-
who_is_this_for: This introductory topic is designed for developers interested in running Linux on Arm Fixed Virtual Platforms (FVPs) and debugging Trusted Firmware-A and the Linux Kernel using Arm Development Studio.
6+
who_is_this_for: This topic is for developers who want to run Linux on Arm Fixed Virtual Platforms (FVPs) and debug both Trusted Firmware-A and the Linux kernel using Arm Development Studio.
77

88
learning_objectives:
9-
- Run a Linux software stack using Arm Fixed Virtual Platforms.
10-
- Debug the firmware and Linux kernel using Arm Development Studio.
11-
9+
- Boot and run a Linux software stack on an Arm Fixed Virtual Platform (FVP).
10+
- Debug Trusted Firmware-A and the Linux kernel using Arm Development Studio.
1211
prerequisites:
13-
- A Linux computer with Arm Development Studio installed (works only on x86-64).
14-
- Basic knowledge of Assembly and C language.
12+
- A Linux-based x86-64 host computer with Arm Development Studio installed.
13+
- Basic understanding of Assembly and C programming.
14+
1515

1616
author: Qixiang Xu
1717

18-
draft: true
19-
cascade:
20-
draft: true
21-
2218
### Tags
2319
skilllevels: Introductory
2420
subjects: Embedded Linux

content/learning-paths/embedded-and-microcontrollers/linux-on-fvp/_next-steps.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
# FIXED, DO NOT MODIFY THIS FILE
44
# ================================================================================
55
weight: 21 # Set to always be larger than the content in this path to be at the end of the navigation.
6-
title: "Next Steps" # Always the same, html page title.
6+
title: "Next steps" # Always the same, html page title.
77
layout: "learningpathall" # All files under learning paths have this same wrapper for Hugo processing.
88
---

content/learning-paths/embedded-and-microcontrollers/linux-on-fvp/debug.md

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
---
2-
title: Debug Software Stack
2+
title: Debug the software stack
33
weight: 6
44

55
### FIXED, DO NOT MODIFY
66
layout: learningpathall
77
---
88

9-
## Debug the Software Stack with Arm Development Studio
9+
## Debug the software stack with Arm Development Studio
1010

1111
Once your software stack is running on the FVP, you can debug Trusted Firmware-A and the Linux kernel using Arm Development Studio (Arm DS).
1212

13-
### Step 1: Install Arm Development Studio
13+
## Install Arm Development Studio
1414

1515
Download and install the latest version from the [Arm Development Studio download page](https://developer.arm.com/downloads/view/DS000B).
1616

17-
DWARF 5 is enabled by default in GCC 11 and later. Arm DS v2022.2 or newer is recommended to support DWARF 5 debug information.
17+
DWARF 5 is enabled by default in GCC 11 and later. Arm DS v2022.2 or later is recommended to support DWARF 5 debug information.
1818

1919

2020

@@ -24,11 +24,14 @@ Launch Arm DS:
2424
```
2525

2626

27-
### Step 2: Create a Debug Configuration
28-
1. Open Arm DS, go to Run > Debug Configurations.
29-
2. Select Generic Arm C/C++ Application and create a new configuration.
30-
3. In the Connection tab:
31-
- Choose your FVP model (e.g., Base_A55x4).
27+
## Create a debug configuration
28+
29+
To create a debug configuration, follow these steps:
30+
31+
1. Open Arm DS, go to **Run** > **Debug Configurations**.
32+
2. Select **Generic Arm C/C++ Application** and create a new configuration.
33+
3. In the **Connection** tab:
34+
- Choose your FVP model (for example, Base_A55x4)
3235
- Enter model parameters:
3336

3437
```output
@@ -50,29 +53,29 @@ Launch Arm DS:
5053
--data cluster0.cpu0=<SRC_PATH>/output/aemfvp-a/aemfvp-a/fvp-base-revc.dtb@0x83000000
5154
```
5255

53-
### Step 3: Load Debug Symbols
56+
## Load debug symbols
5457

55-
In the Debugger tab:
56-
- Select Connect only to the target.”
57-
- Enable Execute debugger commands and add:
58+
In the **Debugger** tab:
59+
- Select **Connect only to the target**.
60+
- Enable Execute debugger commands, and add:
5861
```output
5962
add-symbol-file "~/arm/sw/cpufvp-a/arm-tf/build/fvp/debug/bl1/bl1.elf" EL3:0
6063
add-symbol-file "~/arm/sw/cpufvp-a/arm-tf/build/fvp/debug/bl2/bl2.elf" EL1S:0
6164
add-symbol-file "~/arm/sw/cpufvp-a/arm-tf/build/fvp/debug/bl31/bl31.elf" EL3:0
6265
add-symbol-file "~/arm/sw/cpufvp-a/linux/out/aemfvp-a/defconfig/vmlinux" EL2N:0
6366
```
6467

65-
Click Apply and then Close.
68+
Select **Apply** and then **Close**.
6669

67-
### Step 4: Start Debugging
70+
## Start debugging
6871

69-
1. In the Debug Control view, double-click your new configuration.
70-
2. Wait for the target to connect and symbols to load.
72+
1. In the **Debug Control** view, double-click your new configuration.
73+
2. Wait for the target to connect and the symbols to load.
7174
3. Set breakpoints, step through code, and inspect registers or memory.
7275

73-
You might get the following error when starting the debug connection.
76+
You might get the following error when starting the debug connection:
7477

75-
![Connection Failed Screen #center](failed.png)
78+
![Connection Failed Screen #center](failed.png "Connection Failed error message")
7679

7780
This means your Arm FVP is not provided by default in the Arm DS installation. Set the `PATH` in this case:
7881

@@ -86,4 +89,4 @@ Ensure your FVP instance is running and matches the model and parameters selecte
8689

8790
After these steps, you can debug the software stack as shown in the following figure:
8891

89-
![FVP running #center](Select_target.png)
92+
![FVP running #center](Select_target.png "Debug interface in GUI")

content/learning-paths/embedded-and-microcontrollers/linux-on-fvp/intro.md

Lines changed: 37 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,41 +6,60 @@ weight: 2
66
layout: learningpathall
77
---
88

9-
Arm Fixed Virtual Platforms (FVPs) are simulation models that let you run and test full software stacks on Arm systems before physical hardware is available. They replicate the behavior of Arm CPUs, memory, and peripherals using fast binary translation.
9+
## What are Arm Fixed Virtual Platforms (FVPs)?
1010

11-
### Why Use FVPs?
12-
FVPs are useful for developers who want to:
13-
- Prototype software before silicon availability
14-
- Debug firmware and kernel issues
15-
- Simulate multicore systems
11+
Arm Fixed Virtual Platforms (FVPs) are fast, functional simulation models of Arm hardware. They give you the ability to develop, test, and debug full software stacks. This includes firmware, bootloaders, and operating systems - all without the need for access to physical Arm silicon. FVPs replicate Arm CPU behavior, memory, and peripherals using fast binary translation.
1612

17-
FVPs provide a programmer's view of the hardware, making them ideal for system bring-up, kernel porting, and low-level debugging.
13+
## Why use FVPs?
14+
FVPs are ideal for early software development and system debugging.
1815

19-
### Freely Available Arm Ecosystem FVPs
20-
Several pre-built Armv8-A FVPs can be downloaded for free from the [Arm Ecosystem Models](https://developer.arm.com/Tools%20and%20Software/Fixed%20Virtual%20Platforms#Downloads) page. Categories include:
16+
Developers can use FVPs to do the following tasks:
17+
18+
- Prototype firmware and OS code before silicon is available
19+
- Debug complex boot sequences and kernel issues
20+
- Simulate multi-core systems to analyze performance and thread scheduling
21+
22+
FVPs provide a programmer's view of the hardware, making them ideal for the following:
23+
24+
* System bring-up
25+
* Kernel porting
26+
* Low-level debug tasks
27+
28+
## How can I get access to the Arm FVPs?
29+
30+
You can download prebuilt Armv8-A FVPs at no cost from the [Arm Ecosystem Models](https://developer.arm.com/Tools%20and%20Software/Fixed%20Virtual%20Platforms#Downloads) page.
31+
32+
Available categories include:
2133
- Architecture
2234
- Automotive
2335
- Infrastructure
2436
- IoT
2537

26-
A popular model is the **AEMv8-A Base Platform RevC**, which supports Armv8.7 and Armv9-A. The [Arm reference software stack](https://gitlab.arm.com/arm-reference-solutions/arm-reference-solutions-docs/-/blob/master/docs/aemfvp-a/user-guide.rst) is designed for this model.
38+
A popular model is AEMv8-A Base Platform RevC, which simulates generic Armv8.7-A and Armv9-A CPUs and is fully supported by Arm's open-source [reference software stack](https://gitlab.arm.com/arm-reference-solutions/arm-reference-solutions-docs/-/blob/master/docs/aemfvp-a/user-guide.rst).
2739

28-
### CPU-Specific Arm Base FVPs
29-
Other FVPs target specific CPU types and come pre-configured with a fixed number of cores. These are often called **CPU FVPs**.
40+
## CPU-specific Arm-based FVPs
41+
Some FVPs target specific CPU implementations and include fixed core counts. These are known as CPU FVPs.
3042

31-
Here are some examples:
43+
Examples include:
3244
- FVP_Base_Cortex-A55x4
3345
- FVP_Base_Cortex-A72x4
3446
- FVP_Base_Cortex-A78x4
3547
- FVP_Base_Cortex-A510x4+Cortex-A710x4
3648

3749
To use these, request access via [[email protected]](mailto:[email protected]).
3850

39-
### Setting Up Your Environment
40-
This Learning Path uses the [Arm reference software stack](https://gitlab.arm.com/arm-reference-solutions/arm-reference-solutions-docs/-/blob/master/docs/aemfvp-a/user-guide.rst).
51+
## Set up your environment
52+
This Learning Path uses the open-source Arm reference software stack, which includes the following:
53+
54+
* Prebuilt Linux images
55+
* Firmware
56+
* Configuration files
4157

4258
To get started:
43-
1. Follow the software user guide to download the stack.
44-
2. Set up the required toolchain and environment variables.
4559

46-
Once configured, you’ll be ready to run and debug Linux on your selected Arm FVP model.
60+
* Follow the [software user guide](https://gitlab.arm.com/arm-reference-solutions/arm-reference-solutions-docs/-/blob/master/docs/aemfvp-a/user-guide.rst) to download the stack.
61+
* Set up your toolchain
62+
* Export environment variables
63+
* Verify your build dependencies
64+
65+
Once setup is complete, you’ll be ready to boot and debug Linux on your selected Arm FVP model.

content/learning-paths/embedded-and-microcontrollers/linux-on-fvp/modify.md

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,45 @@
11
---
2-
title: Modify device tree for Linux
2+
title: Modify the device tree for CPU FVPs
33
weight: 4
44

55
### FIXED, DO NOT MODIFY
66
layout: learningpathall
77
---
88

9-
## Modify the Device Tree for CPU FVPs
9+
## Ensure the device tree matches your FVP model
1010

11-
To run Linux on Arm CPU FVPs, you need to adjust the device tree to match the hardware features of these platforms. This involves removing unsupported nodes (like SMMU (System Memory Management Unit)and PCI (Peripheral Component Interconnect)) and ensuring CPU affinity values are set correctly.
11+
To run Linux on Arm CPU FVPs, you need to adjust the device tree to match the hardware features of these platforms. This involves removing unsupported nodes, such as the System Memory Management Unit (SMMU) and Peripheral Component Interconnect (PCI), and ensuring that the CPU affinity values are set correctly.
1212

13-
### Step 1: Remove PCI and SMMU Nodes
13+
### Remove PCI and SMMU nodes
1414

15-
CPU FVPs don't support PCI and SMMU. If you don't remove these nodes, Linux will crash at boot with a kernel panic.
15+
CPU FVPs don't support PCI or SMMU. If you leave these nodes in the device tree, Linux will crash at boot with a kernel panic.
16+
17+
So to workaround this, you need to remove PCI and SMMU nodes:
18+
19+
Open the device tree file in a text editor:
1620

17-
1. Open the device tree file in a text editor:
1821
```bash
1922
vim linux/arch/arm64/boot/dts/arm/fvp-base-revc.dts
2023
```
21-
2. Delete the following two blocks:
24+
Remove the following nodes:
25+
2226
- `pci@40000000`
2327
- `iommu@2b400000`
2428

25-
{{% notice warning %}}
26-
If you skip this, you’ll get an error like:
29+
{{% notice Warning %}}
30+
If you skip this step, you might encounter an error like:
2731

2832
```output
2933
Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
3034
```
3135
{{% /notice %}}
3236

33-
### Step 2: Set CPU Affinity Values
37+
### Set CPU affinity values
38+
39+
Each FVP model uses specific CPU affinity values. If these don’t match the values in the device tree, some of the CPU cores won’t boot.
40+
41+
Find the correct affinities:
3442

35-
Each FVP model uses specific CPU affinity values. If these don’t match what’s in the device tree, some CPU cores won’t boot.
36-
1. Find the correct affinities:
3743
```bash
3844
FVP_Base_Cortex-A55x4 -l | grep pctl.CPU-affinities
3945
```
@@ -43,19 +49,19 @@ Example output:
4349
pctl.CPU-affinities=0.0.0.0, 0.0.1.0, 0.0.2.0, 0.0.3.0
4450
```
4551

46-
2. Convert each to hex for the reg field:
52+
Convert each to hex for the `reg` field:
4753

4854
```output
4955
0x0, 0x0100, 0x0200, 0x0300
5056
```
5157

52-
3. Update the CPU nodes in your device tree file to use these reg values.
58+
Update the CPU nodes in your device tree file to use these `reg` values.
5359

54-
{{% notice tip %}}
55-
To avoid boot errors like psci: failed to boot CPUx (-22), make sure every cpu@xxx entry matches the FVP layout.
60+
{{% notice Tip %}}
61+
To avoid boot errors such as `psci: failed to boot CPUx (-22)`, make sure every `cpu@xxx` entry matches the FVP layout.
5662
{{% /notice %}}
5763

58-
### Step 3: Rebuild Linux
64+
### Rebuild Linux
5965

6066
After editing the device tree, rebuild Linux:
6167

content/learning-paths/embedded-and-microcontrollers/linux-on-fvp/run.md

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,26 @@
11
---
2-
title: Run Software Stack
2+
title: Run the Linux software stack on an FVP
33
weight: 5
44

55
### FIXED, DO NOT MODIFY
66
layout: learningpathall
77
---
88

99

10-
## Run the Linux Software Stack on an FVP
10+
## Launch the Linux software stack on an FVP
1111

1212
Once you've built the Linux stack with the correct configuration, you're ready to run it on an Arm CPU Fixed Virtual Platform (FVP).
1313

14-
### Step 1: Verify the Build Output
14+
Replace <SRC_PATH> with the root path to your workspace, and <PATH_TO_LOG> with the location where you want to save the UART output logs.
15+
16+
## Verify the build output
1517

1618
After building, check the output directory to make sure the expected files were generated:
1719

1820
```bash
1921
tree output/aemfvp-a/aemfvp-a/
2022
```
21-
Expected output:
23+
The expected output is:
2224

2325
```output
2426
output/aemfvp-a/aemfvp-a/
@@ -35,9 +37,10 @@ output/aemfvp-a/aemfvp-a/
3537
└── uefi.bin -> ../components/aemfvp-a/uefi.bin
3638
```
3739

38-
### Step 2: Run the Software Stack
40+
## Run the software stack
3941

4042
To launch the software stack on the FVP, use a command like the following:
43+
4144
```bash
4245
FVP_Base_Cortex-A55x4 \
4346
-C pctl.startup=0.0.0.0 \
@@ -59,15 +62,19 @@ FVP_Base_Cortex-A55x4 \
5962
```
6063
This will boot Trusted Firmware-A, UEFI/U-Boot, Linux, and BusyBox in sequence.
6164

62-
### Step 3: Troubleshoot FVP Launch Issues
65+
## Troubleshoot FVP launch issues
6366

64-
Different FVP models use different CPU instance names. If you see an error like:
67+
Different FVP models use different CPU instance names.
68+
69+
If you see an error like:
6570

6671
```output
67-
Warning: target instance not found: 'FVP_Base_Cortex_A65AEx4_Cortex_A76AEx4.cluster0.cpu0' (data: 'output/aemfvp-a/aemfvp-a/fvp-base-revc.dtb')
72+
Warning: target instance not found: 'FVP_Base_Cortex_A65AEx4_Cortex_A76AEx4.cluster0.cpu0' (data: 'output/aemfvp-a/aemfvp-afvp-base-revc.dtb')
6873
```
6974

70-
You need to identify the correct instance name for your platform. Run:
75+
Identify the correct instance name for your platform.
76+
77+
Run:
7178

7279
```bash
7380
FVP_Base_Cortex-A65AEx4+Cortex-A76AEx4 -l | grep RVBARADDR | grep cpu0
@@ -86,12 +93,12 @@ Update your --data parameters accordingly:
8693
--data cluster0.subcluster0.cpu0.thread0=<SRC_PATH>/output/aemfvp-a/aemfvp-a/fvp-base-revc.dtb@0x83000000
8794
```
8895

89-
{{% notice tip %}}
90-
Always confirm the CPU instance name when switching between different FVP models.
96+
{{% notice Tip %}}
97+
Always check the name of the CPU instance when switching between different FVP models.
9198
{{% /notice %}}
9299

93-
### Optional: Use the GUI
100+
## Use the GUI (optional)
94101

95102
You can also run the FVP using its graphical user interface:
96103

97-
![GUI #center](FVP.png)
104+
![GUI #center](FVP.png "View of the FVP GUI")

0 commit comments

Comments
 (0)