Add FVP Base docs

This commit is contained in:
Mykola Hohsadze
2025-05-04 20:57:23 +03:00
parent 5fa9649ad9
commit cc940333d6
2 changed files with 168 additions and 0 deletions

View File

@@ -0,0 +1,80 @@
# Build and run Fixed Virtual Platform (FVP)
This guide introduces how to build and run little kernel on FVP Base platform
for Linux users.
Free-of-charge AEM FVPs can be downloaded from Arm Architecture Models on Arm
Developer without a license. They are available for Linux hosts only.
For details read [Introductions FVP
docs](https://developer.arm.com/documentation/100966/latest/Introduction-to-FVPs/Types-of-FVP)
1- Download FVP Base
[FVP_Base_RevC-2xAEMvA_11.xx_x_Linux64](https://developer.arm.com/Tools%20and%20Software/Fixed%20Virtual%20Platforms/Arm%20Architecture%20FVPs)
2- Clone the repo
```shell
git clone https://github.com/littlekernel/lk
cd lk
```
3- Download appropriate toolchain
```shell
# Fetches the latest aarch64-elf toolchain for your host.
scripts/fetch-toolchains.py --prefix aarch64-elf
```
4- Add toolchain to PATH
```shell
export PATH=$PWD/toolchain/aarch64-elf-14.2.0-Linux-x86_64/bin:$PATH
```
5- Build kernel
```shell
make fvp-base-test
```
6- Clone Trusted Firmware-A (TF-A)
```shell
cd ..
git clone https://github.com/ARM-software/arm-trusted-firmware.git
cd arm-trsuted-firmware
```
7- Build Trusted Firmware-A (TF-A)
```shell
make \
BL33=../lk/build-fvp-base-test/lk.bin \
DEBUG=1 \
FVP_USE_GIC_DRIVER=FVP_GICV2 \
LOG_LEVEL=40 \
MEASURED_BOOT=0 \
CROSS_COMPILE=aarch64-linux-gnu- \
PLAT=fvp all fip
```
For details of build options you can found at [TF-A build options](https://trustedfirmware-a.readthedocs.io/en/latest/getting_started/build-options.html)
8- Run FVP Base
```shell
/path/to/FVP_Base_RevC-2xAEMvA_11.xx_xx_Linux64/Base_RevC_AEMvA_pkg/models/Linux64_GCC-9.3/FVP_Base_RevC-2xAEMvA \
-C bp.ve_sysregs.exit_on_shutdown=1 \
-C cache_state_modelled=0 \
-C pctl.startup=0.0.0.0 \
-C gicv3.gicv2-only=1 \
-C bp.pl011_uart0.out_file=log.txt \
-C bp.secure_memory=1 \
-C cluster0.NUM_CORES=1 \
-C cluster0.has_arm_v8-4=1 \
-C cluster1.NUM_CORES=0 \
-C bp.secureflashloader.fname=path/to/arm-trusted-firmware/build/fvp/debug/bl1.bin \
-C bp.flashloader0.fname=path/to//arm-trusted-firmware/build/fvp/debug/fip.bin
```

88
docs/fvp-base/internal.md Executable file
View File

@@ -0,0 +1,88 @@
# FVP Base platform overview
### Boot sequence
FVP Base emulator is typically launched using both a secure flashloader and
a normal flashloader. The configuration looks like this:
```shell
-C bp.secureflashloader.fname=path/to/arm-trusted-firmware/build/fvp/debug/bl1.bin \
-C bp.flashloader0.fname=path/to/lk.bin
```
We use Arm Trusted Firmware (ATF) as the secure monitor running at S-EL3. It
initializes the system, sets up the secure world, and pass control to the
non-secure world.
#### The boot sequence works in the following way:
- BL1 (Secure ROM Bootloader) - Initializes trusted components and loads the
next stage (BL2).
- BL2 (Trusted Boot Firmware) - Verifies and loads the next stages: BL31 and
BL33.
- BL31 (EL3 Runtime Firmware) - Provides runtime services at EL3, including
PSCI (Power State Coordination Interface) and context switching between
secure and non-secure worlds.
- BL32 (Secure Payload) - optional secure-world component that runs at S-EL1.
It is used to provide Trusted Execution Environment (TEE). If not required,
this stage can be skipped, and BL31 will directly pass control to BL33. In our
case we do not use BL32.
- BL33 (Non-secure Payload) - The final stage of the boot chain, typically the
entry point to the non-secure kernel or bootloader. We use little kernel as
BL33.
#### Memory Usage (bytes) [RAM]
| Component | Start | Limit | Size | Free | Total |
|-----------|-----------|-----------|---------|---------|--------|
| BL1 | 0x4034000 | 0x4040000 | 0x7000 | 0x5000 | 0xc000 |
| BL2 | 0x4020000 | 0x4034000 | 0x10000 | 0x4000 | 0x14000|
| BL2U | 0x4020000 | 0x4034000 | 0xa000 | 0xa000 | 0x14000|
| BL31 | 0x4003000 | 0x4040000 | 0x22000 | 0x1b000 | 0x3d000|
#### Memory Usage (bytes) [ROM]
| Component | Start | Limit | Size | Free | Total |
|-----------|-----------|-----------|---------|-----------|----------|
| BL1 | 0x0000000 | 0x4000000 | 0x8bd0 | 0x3ff7430 | 0x4000000|
To check the memory layout, refer to [TF-A Memory Layout Tool
Documentation](https://trustedfirmware-a.readthedocs.io/en/latest/tools/memory-layout-tool.html)
#### Little kernel and DTB location
On the FVP platform, DTB start address and the BL33 entry point are both
configured in the platforms source files:
- **DTB base address**: `0x82000000 (32MB size)`
- **BL33 entry address**: `0x88000000`
You can find these settings in the `platform_def.h` header file:
- [DTB
address](https://github.com/ARM-software/arm-trusted-firmware/blob/v2.12.0/plat/arm/board/fvp/include/platform_def.h#L94-L100)
- [BL33 entry
address](https://github.com/ARM-software/arm-trusted-firmware/blob/v2.12.0/plat/arm/board/fvp/include/platform_def.h#L143)
DTS for FVP Base you can find at [fdts](
https://github.com/ARM-software/arm-trusted-firmware/tree/v2.12.0/fdts)
### Peripheral Address Map
The peripheral address map for the FVP Base platform can be found in the following documentation:
[Base Platform memory map](https://developer.arm.com/documentation/100964/latest/Base-Platform/Base-Platform-memory/Base-Platform-memory-map?lang=en)
Currently, little kernel supports:
- **UART0,PL011**
- **GICv2**
### Interrupt Assignment
The interrupt assignment for the FVP Base platform can be found in the following documentation:
[Base Platform interrupt assignments](https://developer.arm.com/documentation/100964/1128/Base-Platform/Base-Platform-interrupt-assignments?lang=en)