Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 1 | .. |
| 2 | # Copyright (c) 2022, Arm Limited. |
| 3 | # |
| 4 | # SPDX-License-Identifier: MIT |
| 5 | |
| 6 | ########## |
| 7 | User Guide |
| 8 | ########## |
| 9 | |
| 10 | Notice |
| 11 | ------ |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 12 | The Corstone-1000 software stack uses the `Yocto Project <https://www.yoctoproject.org/>`__ to build |
| 13 | a tiny Linux distribution suitable for the Corstone-1000 platform (kernel and initramfs filesystem less than 5 MB on the flash). |
| 14 | The Yocto Project relies on the `Bitbake <https://docs.yoctoproject.org/bitbake.html#bitbake-documentation>`__ |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 15 | tool as its build tool. Please see `Yocto Project documentation <https://docs.yoctoproject.org/>`__ |
| 16 | for more information. |
| 17 | |
| 18 | |
| 19 | Prerequisites |
| 20 | ------------- |
| 21 | These instructions assume your host PC is running Ubuntu Linux 18.04 or 20.04 LTS, with |
| 22 | at least 32GB of free disk space and 16GB of RAM as minimum requirement. The |
| 23 | following instructions expect that you are using a bash shell. |
| 24 | |
| 25 | The following prerequisites must be available on the host system. To resolve these dependencies, run: |
| 26 | |
| 27 | :: |
| 28 | |
| 29 | sudo apt-get update |
| 30 | sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib \ |
| 31 | build-essential chrpath socat cpio python3 python3-pip python3-pexpect \ |
| 32 | xz-utils debianutils iputils-ping python3-git libegl1-mesa libsdl1.2-dev \ |
| 33 | xterm zstd liblz4-tool picocom |
| 34 | sudo apt-get upgrade libstdc++6 |
| 35 | |
| 36 | Provided components |
| 37 | ------------------- |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 38 | Within the Yocto Project, each component included in the Corstone-1000 software stack is specified as |
| 39 | a `bitbake recipe <https://docs.yoctoproject.org/bitbake/2.2/bitbake-user-manual/bitbake-user-manual-intro.html#recipes>`__. |
| 40 | The recipes specific to the Corstone-1000 BSP are located at: |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 41 | ``<_workspace>/meta-arm/meta-arm-bsp/``. |
| 42 | |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 43 | The Yocto machine config files for the Corstone-1000 FVP and FPGA targets are: |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 44 | |
| 45 | - ``<_workspace>/meta-arm/meta-arm-bsp/conf/machine/include/corstone1000.inc`` |
| 46 | - ``<_workspace>/meta-arm/meta-arm-bsp/conf/machine/corstone1000-fvp.conf`` |
| 47 | - ``<_workspace>/meta-arm/meta-arm-bsp/conf/machine/corstone1000-mps3.conf`` |
| 48 | |
| 49 | ***************** |
| 50 | Software for Host |
| 51 | ***************** |
| 52 | |
| 53 | Trusted Firmware-A |
| 54 | ================== |
| 55 | Based on `Trusted Firmware-A <https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git>`__ |
| 56 | |
| 57 | +----------+---------------------------------------------------------------------------------------------------+ |
| 58 | | bbappend | <_workspace>/meta-arm/meta-arm-bsp/recipes-bsp/trusted-firmware-a/trusted-firmware-a_2.7.bbappend | |
| 59 | +----------+---------------------------------------------------------------------------------------------------+ |
| 60 | | Recipe | <_workspace>/meta-arm/meta-arm/recipes-bsp/trusted-firmware-a/trusted-firmware-a_2.7.bb | |
| 61 | +----------+---------------------------------------------------------------------------------------------------+ |
| 62 | |
| 63 | OP-TEE |
| 64 | ====== |
| 65 | Based on `OP-TEE <https://git.trustedfirmware.org/OP-TEE/optee_os.git>`__ |
| 66 | |
| 67 | +----------+------------------------------------------------------------------------------------+ |
| 68 | | bbappend | <_workspace>/meta-arm/meta-arm-bsp/recipes-security/optee/optee-os_3.18.0.bbappend | |
| 69 | +----------+------------------------------------------------------------------------------------+ |
| 70 | | Recipe | <_workspace>/meta-arm/meta-arm/recipes-security/optee/optee-os_3.18.0.bb | |
| 71 | +----------+------------------------------------------------------------------------------------+ |
| 72 | |
| 73 | U-Boot |
| 74 | ======= |
| 75 | Based on `U-Boot <https://gitlab.com/u-boot>`__ |
| 76 | |
| 77 | +----------+---------------------------------------------------------------------+ |
| 78 | | bbappend | <_workspace>/meta-arm/meta-arm/recipes-bsp/u-boot/u-boot_%.bbappend | |
| 79 | +----------+---------------------------------------------------------------------+ |
| 80 | | Recipe | <_workspace>/poky/meta/recipes-bsp/u-boot/u-boot_2022.07.bb | |
| 81 | +----------+---------------------------------------------------------------------+ |
| 82 | |
| 83 | Linux |
| 84 | ===== |
| 85 | The distro is based on the `poky-tiny <https://wiki.yoctoproject.org/wiki/Poky-Tiny>`__ |
| 86 | distribution which is a Linux distribution stripped down to a minimal configuration. |
| 87 | |
| 88 | The provided distribution is based on busybox and built using muslibc. The |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 89 | recipe responsible for building a tiny version of Linux is listed below. |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 90 | |
| 91 | +-----------+----------------------------------------------------------------------------------------------+ |
| 92 | | bbappend | <_workspace>/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-yocto_%.bbappend | |
| 93 | +-----------+----------------------------------------------------------------------------------------------+ |
| 94 | | Recipe | <_workspace>/poky/meta/recipes-kernel/linux/linux-yocto_5.19.bb | |
| 95 | +-----------+----------------------------------------------------------------------------------------------+ |
| 96 | | defconfig | <_workspace>/meta-arm/meta-arm-bsp/recipes-kernel/linux/files/corstone1000/defconfig | |
| 97 | +-----------+----------------------------------------------------------------------------------------------+ |
| 98 | |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 99 | External System Tests |
| 100 | ======================= |
| 101 | Based on `Corstone-1000/applications <https://git.gitlab.arm.com/arm-reference-solutions/corstone1000/applications>`__ |
| 102 | |
| 103 | +------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ |
| 104 | | Recipe | <_workspace>/meta-arm/meta-arm-bsp/recipes-test/corstone1000-external-sys-tests/corstone1000-external-sys-tests_1.0.bb | |
| 105 | +------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ |
| 106 | |
| 107 | The recipe provides the systems-comms-tests command run in Linux and used for testing the External System. |
| 108 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 109 | ************************************************** |
| 110 | Software for Boot Processor (a.k.a Secure Enclave) |
| 111 | ************************************************** |
| 112 | Based on `Trusted Firmware-M <https://git.trustedfirmware.org/TF-M/trusted-firmware-m.git>`__ |
| 113 | |
| 114 | +----------+-------------------------------------------------------------------------------------------------+ |
| 115 | | bbappend | <_workspace>/meta-arm/meta-arm-bsp/recipes-bsp/trusted-firmware-m/trusted-firmware-m_%.bbappend | |
| 116 | +----------+-------------------------------------------------------------------------------------------------+ |
| 117 | | Recipe | <_workspace>/meta-arm/meta-arm/recipes-bsp/trusted-firmware-m/trusted-firmware-m_1.6.0.bb | |
| 118 | +----------+-------------------------------------------------------------------------------------------------+ |
| 119 | |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 120 | ************************************************** |
| 121 | Software for the External System |
| 122 | ************************************************** |
| 123 | |
| 124 | RTX |
| 125 | ==== |
| 126 | Based on `RTX RTOS <https://git.gitlab.arm.com/arm-reference-solutions/corstone1000/external_system/rtx>`__ |
| 127 | |
| 128 | +----------+-------------------------------------------------------------------------------------------------------------------------------------------------------+ |
| 129 | | Recipe | <_workspace>/meta-arm/meta-arm-bsp/recipes-bsp/external-system/external-system_0.1.0.bb | |
| 130 | +----------+-------------------------------------------------------------------------------------------------------------------------------------------------------+ |
| 131 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 132 | Building the software stack |
| 133 | --------------------------- |
| 134 | Create a new folder that will be your workspace and will henceforth be referred |
| 135 | to as ``<_workspace>`` in these instructions. To create the folder, run: |
| 136 | |
| 137 | :: |
| 138 | |
| 139 | mkdir <_workspace> |
| 140 | cd <_workspace> |
| 141 | |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 142 | Corstone-1000 software is based on the Yocto Project which uses kas and bitbake |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 143 | commands to build the stack. To install kas tool, run: |
| 144 | |
| 145 | :: |
| 146 | |
| 147 | pip3 install kas |
| 148 | |
| 149 | In the top directory of the workspace ``<_workspace>``, run: |
| 150 | |
| 151 | :: |
| 152 | |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 153 | git clone https://git.yoctoproject.org/git/meta-arm -b CORSTONE1000-2022.11.10 |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 154 | |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 155 | To build a Corstone-1000 image for MPS3 FPGA, run: |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 156 | |
| 157 | :: |
| 158 | |
| 159 | kas build meta-arm/kas/corstone1000-mps3.yml |
| 160 | |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 161 | Alternatively, to build a Corstone-1000 image for FVP, run: |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 162 | |
| 163 | :: |
| 164 | |
| 165 | kas build meta-arm/kas/corstone1000-fvp.yml |
| 166 | |
| 167 | The initial clean build will be lengthy, given that all host utilities are to |
| 168 | be built as well as the target images. This includes host executables (python, |
| 169 | cmake, etc.) and the required toolchain(s). |
| 170 | |
| 171 | Once the build is successful, all output binaries will be placed in the following folders: |
| 172 | - ``<_workspace>/build/tmp/deploy/images/corstone1000-fvp/`` folder for FVP build; |
| 173 | - ``<_workspace>/build/tmp/deploy/images/corstone1000-mps3/`` folder for FPGA build. |
| 174 | |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 175 | Everything apart from the Secure Enclave ROM firmware and External System firmware, is bundled into a single binary, the |
| 176 | ``corstone1000-image-corstone1000-{mps3,fvp}.wic.nopt`` file. |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 177 | |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 178 | The output binaries run in the Corstone-1000 platform are the following: |
| 179 | - The Secure Enclave ROM firmware: ``<_workspace>/build/tmp/deploy/images/corstone1000-{mps3,fvp}/bl1.bin`` |
| 180 | - The External System firmware: ``<_workspace>/build/tmp/deploy/images/corstone1000-{mps3,fvp}/es_flashfw.bin`` |
| 181 | - The flash image: ``<_workspace>/build/tmp/deploy/images/corstone1000-{mps3,fvp}/corstone1000-image-corstone1000-{mps3,fvp}.wic.nopt`` |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 182 | |
| 183 | Flash the firmware image on FPGA |
| 184 | -------------------------------- |
| 185 | |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 186 | The user should download the FPGA bit file image ``AN550: Arm® Corstone™-1000 for MPS3 Version 1`` |
| 187 | from `this link <https://developer.arm.com/tools-and-software/development-boards/fpga-prototyping-boards/download-fpga-images>`__ |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 188 | and under the section ``Arm® Corstone™-1000 for MPS3``. |
| 189 | |
| 190 | The directory structure of the FPGA bundle is shown below. |
| 191 | |
| 192 | :: |
| 193 | |
| 194 | Boardfiles |
| 195 | ├── MB |
| 196 | │  ├── BRD_LOG.TXT |
| 197 | │  ├── HBI0309B |
| 198 | │  │  ├── AN550 |
| 199 | │  │  │  ├── AN550_v1.bit |
| 200 | │  │  │  ├── an550_v1.txt |
| 201 | │  │  │  └── images.txt |
| 202 | │  │  ├── board.txt |
| 203 | │  │  └── mbb_v210.ebf |
| 204 | │  └── HBI0309C |
| 205 | │  ├── AN550 |
| 206 | │  │  ├── AN550_v1.bit |
| 207 | │  │  ├── an550_v1.txt |
| 208 | │  │  └── images.txt |
| 209 | │  ├── board.txt |
| 210 | │  └── mbb_v210.ebf |
| 211 | ├── SOFTWARE |
| 212 | │  ├── ES0.bin |
| 213 | │  ├── SE.bin |
| 214 | │  └── an550_st.axf |
| 215 | └── config.txt |
| 216 | |
| 217 | Depending upon the MPS3 board version (printed on the MPS3 board) you should update the images.txt file |
| 218 | (in corresponding HBI0309x folder) so that the file points to the images under SOFTWARE directory. |
| 219 | |
| 220 | Here is an example |
| 221 | |
| 222 | :: |
| 223 | |
| 224 | ;************************************************ |
| 225 | ; Preload port mapping * |
| 226 | ;************************************************ |
| 227 | ; PORT 0 & ADDRESS: 0x00_0000_0000 QSPI Flash (XNVM) (32MB) |
| 228 | ; PORT 0 & ADDRESS: 0x00_8000_0000 OCVM (DDR4 2GB) |
| 229 | ; PORT 1 Secure Enclave (M0+) ROM (64KB) |
| 230 | ; PORT 2 External System 0 (M3) Code RAM (256KB) |
| 231 | ; PORT 3 Secure Enclave OTP memory (8KB) |
| 232 | ; PORT 4 CVM (4MB) |
| 233 | ;************************************************ |
| 234 | |
| 235 | [IMAGES] |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 236 | TOTALIMAGES: 3 ;Number of Images (Max: 32) |
| 237 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 238 | IMAGE0PORT: 1 |
| 239 | IMAGE0ADDRESS: 0x00_0000_0000 |
| 240 | IMAGE0UPDATE: RAM |
| 241 | IMAGE0FILE: \SOFTWARE\bl1.bin |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 242 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 243 | IMAGE1PORT: 0 |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 244 | IMAGE1ADDRESS: 0x00_0010_0000 |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 245 | IMAGE1UPDATE: AUTOQSPI |
| 246 | IMAGE1FILE: \SOFTWARE\cs1000.bin |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 247 | |
| 248 | IMAGE2PORT: 2 |
| 249 | IMAGE2ADDRESS: 0x00_0000_0000 |
| 250 | IMAGE2UPDATE: RAM |
| 251 | IMAGE2FILE: \SOFTWARE\es0.bin |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 252 | |
| 253 | OUTPUT_DIR = ``<_workspace>/build/tmp/deploy/images/corstone1000-mps3`` |
| 254 | |
| 255 | 1. Copy ``bl1.bin`` from OUTPUT_DIR directory to SOFTWARE directory of the FPGA bundle. |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 256 | 2. Copy ``es_flashfw.bin`` from OUTPUT_DIR directory to SOFTWARE directory of the FPGA bundle |
| 257 | and rename the binary to ``es0.bin``. |
| 258 | 3. Copy ``corstone1000-image-corstone1000-mps3.wic.nopt`` from OUTPUT_DIR directory to SOFTWARE |
| 259 | directory of the FPGA bundle and rename the wic.nopt image to ``cs1000.bin``. |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 260 | |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 261 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 262 | **NOTE:** Renaming of the images are required because MCC firmware has |
| 263 | limitation of 8 characters before .(dot) and 3 characters after .(dot). |
| 264 | |
| 265 | Now, copy the entire folder to board's SDCard and reboot the board. |
| 266 | |
| 267 | Running the software on FPGA |
| 268 | ---------------------------- |
| 269 | |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 270 | On the host machine, open 4 serial port terminals. In case of Linux machine it will |
| 271 | be ttyUSB0, ttyUSB1, ttyUSB2, ttyUSB3 and it might be different on Windows machines. |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 272 | |
| 273 | - ttyUSB0 for MCC, OP-TEE and Secure Partition |
| 274 | - ttyUSB1 for Boot Processor (Cortex-M0+) |
| 275 | - ttyUSB2 for Host Processor (Cortex-A35) |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 276 | - ttyUSB3 for External System Processor (Cortex-M3) |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 277 | |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 278 | Run following commands to open serial port terminals on Linux: |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 279 | |
| 280 | :: |
| 281 | |
| 282 | sudo picocom -b 115200 /dev/ttyUSB0 # in one terminal |
| 283 | sudo picocom -b 115200 /dev/ttyUSB1 # in another terminal |
| 284 | sudo picocom -b 115200 /dev/ttyUSB2 # in another terminal. |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 285 | sudo picocom -b 115200 /dev/ttyUSB3 # in another terminal. |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 286 | |
| 287 | Once the system boot is completed, you should see console |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 288 | logs on the serial port terminals. Once the HOST(Cortex-A35) is |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 289 | booted completely, user can login to the shell using |
| 290 | **"root"** login. |
| 291 | |
| 292 | Running the software on FVP |
| 293 | --------------------------- |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 294 | |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 295 | An FVP (Fixed Virtual Platform) model of the Corstone-1000 platform must be available to run the |
| 296 | Corstone-1000 FVP software image. |
| 297 | |
| 298 | A Yocto recipe is provided and allows to download the latest supported FVP version. |
| 299 | |
| 300 | The recipe is located at <_workspace>/meta-arm/meta-arm/recipes-devtools/fvp/fvp-corstone1000.bb |
| 301 | |
| 302 | The latest supported Fixed Virtual Platform (FVP) version is 11.19_21 and is automatically downloaded |
| 303 | and installed when using the runfvp command as detailed below. |
| 304 | |
| 305 | The FVP can also be manually downloaded from the `Arm Ecosystem FVPs`_ page. On this page, navigate |
| 306 | to "Corstone IoT FVPs" section to download the Corstone-1000 platform FVP installer. Follow the |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 307 | instructions of the installer and setup the FVP. |
| 308 | |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 309 | To run the FVP using the runfvp command, please run the following command: |
| 310 | |
| 311 | :: |
| 312 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 313 | <_workspace>/meta-arm/scripts/runfvp --terminals=xterm <_workspace>/build/tmp/deploy/images/corstone1000-fvp/corstone1000-image-corstone1000-fvp.fvpconf |
| 314 | |
| 315 | When the script is executed, three terminal instances will be launched, one for the boot processor |
| 316 | (aka Secure Enclave) processing element and two for the Host processing element. Once the FVP is |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 317 | executing, the Boot Processor will start to boot, wherein the relevant memory contents of the .wic.nopt |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 318 | file are copied to their respective memory locations within the model, enforce firewall policies |
| 319 | on memories and peripherals and then, bring the host out of reset. |
| 320 | |
| 321 | The host will boot trusted-firmware-a, OP-TEE, U-Boot and then Linux, and present a login prompt |
| 322 | (FVP host_terminal_0): |
| 323 | |
| 324 | :: |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 325 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 326 | corstone1000-fvp login: |
| 327 | |
| 328 | Login using the username root. |
| 329 | |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 330 | The External System can be released out of reset on demand using the systems-comms-tests command. |
| 331 | |
| 332 | SystemReady-IR tests |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 333 | ------------------------- |
| 334 | |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 335 | ********************* |
| 336 | Testing steps |
| 337 | ********************* |
| 338 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 339 | **NOTE**: Running the SystemReady-IR tests described below requires the user to |
| 340 | work with USB sticks. In our testing, not all USB stick models work well with |
| 341 | MPS3 FPGA. Here are the USB sticks models that are stable in our test |
| 342 | environment. |
| 343 | |
| 344 | - HP V165W 8 GB USB Flash Drive |
| 345 | - SanDisk Ultra 32GB Dual USB Flash Drive USB M3.0 |
| 346 | - SanDisk Ultra 16GB Dual USB Flash Drive USB M3.0 |
| 347 | |
| 348 | **NOTE**: |
| 349 | Before running each of the tests in this chapter, the user should follow the |
| 350 | steps described in following section "Clean Secure Flash Before Testing" to |
| 351 | erase the SecureEnclave flash cleanly and prepare a clean board environment for |
| 352 | the testing. |
| 353 | |
| 354 | Clean Secure Flash Before Testing (applicable to FPGA only) |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 355 | ================================================================== |
| 356 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 357 | To prepare a clean board environment with clean secure flash for the testing, |
| 358 | the user should prepare an image that erases the secure flash cleanly during |
| 359 | boot. Run following commands to build such image. |
| 360 | |
| 361 | :: |
| 362 | |
| 363 | cd <_workspace> |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 364 | git clone https://git.yoctoproject.org/git/meta-arm -b CORSTONE1000-2022.11.10 |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 365 | git clone https://git.gitlab.arm.com/arm-reference-solutions/systemready-patch.git |
| 366 | cp -f systemready-patch/embedded-a/corstone1000/erase_flash/0001-arm-bsp-trusted-firmware-m-corstone1000-Clean-Secure.patch meta-arm |
| 367 | cd meta-arm |
| 368 | git apply 0001-arm-bsp-trusted-firmware-m-corstone1000-Clean-Secure.patch |
| 369 | cd .. |
| 370 | kas build meta-arm/kas/corstone1000-mps3.yml |
| 371 | |
| 372 | Replace the bl1.bin and cs1000.bin files on the SD card with following files: |
| 373 | - The ROM firmware: <_workspace>/build/tmp/deploy/images/corstone1000-mps3/bl1.bin |
| 374 | - The flash image: <_workspace>/build/tmp/deploy/images/corstone1000-mps3/corstone1000-image-corstone1000-mps3.wic.nopt |
| 375 | |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 376 | Now reboot the board. This step erases the Corstone-1000 SecureEnclave flash |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 377 | completely, the user should expect following message from TF-M log: |
| 378 | |
| 379 | :: |
| 380 | |
| 381 | !!!SECURE FLASH HAS BEEN CLEANED!!! |
| 382 | NOW YOU CAN FLASH THE ACTUAL CORSTONE1000 IMAGE |
| 383 | PLEASE REMOVE THE LATEST ERASE SECURE FLASH PATCH AND BUILD THE IMAGE AGAIN |
| 384 | |
| 385 | Then the user should follow "Building the software stack" to build a clean |
| 386 | software stack and flash the FPGA as normal. And continue the testing. |
| 387 | |
| 388 | Run SystemReady-IR ACS tests |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 389 | ============================= |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 390 | |
| 391 | ACS image contains two partitions. BOOT partition and RESULTS partition. |
| 392 | Following packages are under BOOT partition |
| 393 | |
| 394 | * SCT |
| 395 | * FWTS |
| 396 | * BSA uefi |
| 397 | * BSA linux |
| 398 | * grub |
| 399 | * uefi manual capsule application |
| 400 | |
| 401 | RESULTS partition is used to store the test results. |
| 402 | PLEASE MAKE SURE THAT THE RESULTS PARTITION IS EMPTY BEFORE YOU START THE TESTING. OTHERWISE THE TEST RESULTS |
| 403 | WILL NOT BE CONSISTENT |
| 404 | |
| 405 | FPGA instructions for ACS image |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 406 | ================================ |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 407 | |
| 408 | This section describes how the user can build and run Architecture Compliance |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 409 | Suite (ACS) tests on Corstone-1000. |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 410 | |
| 411 | First, the user should download the `Arm SystemReady ACS repository <https://github.com/ARM-software/arm-systemready/>`__. |
| 412 | This repository contains the infrastructure to build the Architecture |
| 413 | Compliance Suite (ACS) and the bootable prebuilt images to be used for the |
| 414 | certifications of SystemReady-IR. To download the repository, run command: |
| 415 | |
| 416 | :: |
| 417 | |
| 418 | cd <_workspace> |
| 419 | git clone https://github.com/ARM-software/arm-systemready.git -b v21.09_REL1.0 |
| 420 | |
| 421 | Once the repository is successfully downloaded, the prebuilt ACS live image can be found in: |
| 422 | - ``<_workspace>/arm-systemready/IR/prebuilt_images/v21.07_0.9_BETA/ir_acs_live_image.img.xz`` |
| 423 | |
| 424 | **NOTE**: This prebuilt ACS image includes v5.13 kernel, which doesn't provide |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 425 | USB driver support for Corstone-1000. The ACS image with newer kernel version |
| 426 | and with full USB support for Corstone-1000 will be available in the next |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 427 | SystemReady release in this repository. |
| 428 | |
| 429 | Then, the user should prepare a USB stick with ACS image. In the given example here, |
| 430 | we assume the USB device is ``/dev/sdb`` (the user should use ``lsblk`` command to |
| 431 | confirm). Be cautious here and don't confuse your host PC's own hard drive with the |
| 432 | USB drive. Run the following commands to prepare the ACS image in USB stick: |
| 433 | |
| 434 | :: |
| 435 | |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 436 | cd <_workspace>/arm-systemready/IR/prebuilt_images/v21.07_0.9_BETA |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 437 | unxz ir_acs_live_image.img.xz |
| 438 | sudo dd if=ir_acs_live_image.img of=/dev/sdb iflag=direct oflag=direct bs=1M status=progress; sync |
| 439 | |
| 440 | Once the USB stick with ACS image is prepared, the user should make sure that |
| 441 | ensure that only the USB stick with the ACS image is connected to the board, |
| 442 | and then boot the board. |
| 443 | |
| 444 | FVP instructions for ACS image and run |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 445 | ============================================ |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 446 | |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 447 | Download ACS image from: |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 448 | - ``https://gitlab.arm.com/systemready/acs/arm-systemready/-/tree/linux-5.17-rc7/IR/prebuilt_images/v22.04_1.0-Linux-v5.17-rc7`` |
| 449 | |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 450 | Use the below command to run the FVP with ACS image support in the |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 451 | SD card. |
| 452 | |
| 453 | :: |
| 454 | |
| 455 | unxz ${<path-to-img>/ir_acs_live_image.img.xz} |
| 456 | |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 457 | tmux |
| 458 | |
| 459 | <_workspace>/meta-arm/scripts/runfvp <_workspace>/build/tmp/deploy/images/corstone1000-fvp/corstone1000-image-corstone1000-fvp.fvpconf – -C board.msd_mmc.p_mmc_file="${<path-to-img>/ir_acs_live_image.img}" |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 460 | |
| 461 | The test results can be fetched using following commands: |
| 462 | |
| 463 | :: |
| 464 | |
| 465 | sudo mkdir /mnt/test |
| 466 | sudo mount -o rw,offset=<offset_2nd_partition> <path-to-img>/ir_acs_live_image.img /mnt/test/ |
| 467 | fdisk -lu <path-to-img>/ir_acs_live_image.img |
| 468 | -> Device Start End Sectors Size Type |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 469 | <path-to-img>/ir_acs_live_image_modified.img1 2048 1050622 1048575 512M Microsoft basic data |
| 470 | <path-to-img>/ir_acs_live_image_modified.img2 1050624 1153022 102399 50M Microsoft basic data |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 471 | |
| 472 | -> <offset_2nd_partition> = 1050624 * 512 (sector size) = 537919488 |
| 473 | |
| 474 | The FVP will reset multiple times during the test, and it might take up to 1 day to finish |
| 475 | the test. At the end of test, the FVP host terminal will halt showing a shell prompt. |
| 476 | Once test is finished, the FVP can be stoped, and result can be copied following above |
| 477 | instructions. |
| 478 | |
| 479 | Common to FVP and FPGA |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 480 | =========================== |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 481 | |
| 482 | U-Boot should be able to boot the grub bootloader from |
| 483 | the 1st partition and if grub is not interrupted, tests are executed |
| 484 | automatically in the following sequence: |
| 485 | |
| 486 | - SCT |
| 487 | - UEFI BSA |
| 488 | - FWTS |
| 489 | - BSA Linux |
| 490 | |
| 491 | The results can be fetched from the ``acs_results`` partition of the USB stick (FPGA) / SD Card (FVP). |
| 492 | |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 493 | ##################################################### |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 494 | |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 495 | Manual capsule update and ESRT checks |
| 496 | --------------------------------------------------------------------- |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 497 | |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 498 | The following section describes running manual capsule update with the ``direct`` method. |
| 499 | |
| 500 | The steps described in this section perform manual capsule update and show how to use the ESRT feature |
| 501 | to retrieve the installed capsule details. |
| 502 | |
| 503 | For the following tests two capsules are needed to perform 2 capsule updates. A positive update and a negative update. |
| 504 | |
| 505 | A positive test case capsule which boots the platform correctly until the Linux prompt, and a negative test case with an |
| 506 | incorrect capsule (corrupted or outdated) which fails to boot to the host software. |
| 507 | |
| 508 | Check the "Run SystemReady-IR ACS tests" section above to download and unpack the ACS image file |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 509 | - ``ir_acs_live_image.img.xz`` |
| 510 | |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 511 | Download edk2 under <_workspace> : |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 512 | |
| 513 | :: |
| 514 | |
| 515 | git clone https://github.com/tianocore/edk2.git |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 516 | |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 517 | ********************* |
| 518 | Generating Capsules |
| 519 | ********************* |
| 520 | |
| 521 | The capsule binary size (wic.nopt file) should be less than 15 MB. |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 522 | |
| 523 | Based on the user's requirement, the user can change the firmware version |
| 524 | number given to ``--fw-version`` option (the version number needs to be >= 1). |
| 525 | |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 526 | Generating FPGA Capsules |
| 527 | ======================== |
| 528 | |
| 529 | :: |
| 530 | |
| 531 | <_workspace>/edk2/BaseTools/BinWrappers/PosixLike/GenerateCapsule -e -o \ |
| 532 | cs1k_cap_mps3_v5 --fw-version 5 --lsv 0 --guid \ |
| 533 | e2bb9c06-70e9-4b14-97a3-5a7913176e3f --verbose --update-image-index \ |
| 534 | 0 --verbose <_workspace>/build/tmp/deploy/images/corstone1000-mps3/corstone1000-image-corstone1000-mps3.wic.nopt |
| 535 | |
| 536 | :: |
| 537 | |
| 538 | <_workspace>/edk2/BaseTools/BinWrappers/PosixLike/GenerateCapsule -e -o \ |
| 539 | cs1k_cap_mps3_v6 --fw-version 6 --lsv 0 --guid \ |
| 540 | e2bb9c06-70e9-4b14-97a3-5a7913176e3f --verbose --update-image-index \ |
| 541 | 0 --verbose <_workspace>/build/tmp/deploy/images/corstone1000-mps3/corstone1000-image-corstone1000-mps3.wic.nopt |
| 542 | |
| 543 | Generating FVP Capsules |
| 544 | ======================== |
| 545 | |
| 546 | :: |
| 547 | |
| 548 | <_workspace>/edk2/BaseTools/BinWrappers/PosixLike/GenerateCapsule -e -o \ |
| 549 | cs1k_cap_fvp_v6 --fw-version 6 --lsv 0 --guid \ |
| 550 | e2bb9c06-70e9-4b14-97a3-5a7913176e3f --verbose --update-image-index \ |
| 551 | 0 --verbose <_workspace>/build/tmp/deploy/images/corstone1000-fvp/corstone1000-image-corstone1000-fvp.wic.nopt |
| 552 | |
| 553 | :: |
| 554 | |
| 555 | <_workspace>/edk2/BaseTools/BinWrappers/PosixLike/GenerateCapsule -e -o \ |
| 556 | cs1k_cap_fvp_v5 --fw-version 5 --lsv 0 --guid \ |
| 557 | e2bb9c06-70e9-4b14-97a3-5a7913176e3f --verbose --update-image-index \ |
| 558 | 0 --verbose <_workspace>/build/tmp/deploy/images/corstone1000-fvp/corstone1000-image-corstone1000-fvp.wic.nopt |
| 559 | |
| 560 | ********************* |
| 561 | Copying Capsules |
| 562 | ********************* |
| 563 | |
| 564 | Copying the FPGA capsules |
| 565 | ========================= |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 566 | |
| 567 | The user should prepare a USB stick as explained in ACS image section (see above). |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 568 | Place the generated ``cs1k_cap`` files in the root directory of the boot partition |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 569 | in the USB stick. Note: As we are running the direct method, the ``cs1k_cap`` file |
| 570 | should not be under the EFI/UpdateCapsule directory as this may or may not trigger |
| 571 | the on disk method. |
| 572 | |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 573 | :: |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 574 | |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 575 | sudo cp cs1k_cap_mps3_v6 <mounting path>/BOOT/ |
| 576 | sudo cp cs1k_cap_mps3_v5 <mounting path>/BOOT/ |
| 577 | sync |
| 578 | |
| 579 | Copying the FVP capsules |
| 580 | ======================== |
| 581 | |
| 582 | First, mount the IR image: |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 583 | |
| 584 | :: |
| 585 | |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 586 | sudo mkdir /mnt/test |
| 587 | sudo mount -o rw,offset=1048576 <path-to-img>/ir_acs_live_image.img /mnt/test |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 588 | |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 589 | Then, copy the capsules: |
| 590 | |
| 591 | :: |
| 592 | |
| 593 | sudo cp cs1k_cap_fvp_v6 /mnt/test/ |
| 594 | sudo cp cs1k_cap_fvp_v5 /mnt/test/ |
| 595 | sync |
| 596 | |
| 597 | Then, unmount the IR image: |
| 598 | |
| 599 | :: |
| 600 | |
| 601 | sudo umount /mnt/test |
| 602 | |
| 603 | **NOTE:** |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 604 | |
| 605 | Size of first partition in the image file is calculated in the following way. The data is |
| 606 | just an example and might vary with different ir_acs_live_image.img files. |
| 607 | |
| 608 | :: |
| 609 | |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 610 | fdisk -lu <path-to-img>/ir_acs_live_image.img |
| 611 | -> Device Start End Sectors Size Type |
| 612 | <path-to-img>/ir_acs_live_image_modified.img1 2048 1050622 1048575 512M Microsoft basic data |
| 613 | <path-to-img>/ir_acs_live_image_modified.img2 1050624 1153022 102399 50M Microsoft basic data |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 614 | |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 615 | -> <offset_1st_partition> = 2048 * 512 (sector size) = 1048576 |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 616 | |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 617 | ****************************** |
| 618 | Performing the capsule update |
| 619 | ****************************** |
| 620 | |
| 621 | During this section we will be using the capsule with the higher version (cs1k_cap_<fvp/mps3>_v6) for the positive scenario |
| 622 | and the capsule with the lower version (cs1k_cap_<fvp/mps3>_v5) for the negative scenario. |
| 623 | |
| 624 | Running the FVP with the IR prebuilt image |
| 625 | ============================================== |
| 626 | |
| 627 | Run the FVP with the IR prebuilt image: |
| 628 | |
| 629 | :: |
| 630 | |
| 631 | <_workspace>/meta-arm/scripts/runfvp --terminals=xterm <_workspace>/build/tmp/deploy/images/corstone1000-fvp/corstone1000-image-corstone1000-fvp.fvpconf -- -C "board.msd_mmc.p_mmc_file ${<path-to-img>/ir_acs_live_image.img}" |
| 632 | |
| 633 | Running the FPGA with the IR prebuilt image |
| 634 | ============================================== |
| 635 | |
| 636 | Insert the prepared USB stick then Power cycle the MPS3 board. |
| 637 | |
| 638 | Executing capsule update for FVP and FPGA |
| 639 | ============================================== |
| 640 | |
| 641 | Reach u-boot then interrupt the boot to reach the EFI shell. |
| 642 | |
| 643 | :: |
| 644 | |
| 645 | Press ESC in 4 seconds to skip startup.nsh or any other key to continue. |
| 646 | |
| 647 | Then, type FS0: as shown below: |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 648 | |
| 649 | :: |
| 650 | |
| 651 | FS0: |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 652 | |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 653 | In case of the positive scenario run the update with the higher version capsule as shown below: |
| 654 | |
| 655 | :: |
| 656 | |
| 657 | EFI/BOOT/app/CapsuleApp.efi cs1k_cap_<fvp/mps3>_v6 |
| 658 | |
| 659 | After successfully updating the capsule the system will reset. |
| 660 | |
| 661 | In case of the negative scenario run the update with the lower version capsule as shown below: |
| 662 | |
| 663 | :: |
| 664 | |
| 665 | EFI/BOOT/app/CapsuleApp.efi cs1k_cap_<fvp/mps3>_v5 |
| 666 | |
| 667 | The command above should fail and in the TF-M logs the following message should appear: |
| 668 | |
| 669 | :: |
| 670 | |
| 671 | ERROR: flash_full_capsule: version error |
| 672 | |
| 673 | Then, reboot manually: |
| 674 | |
| 675 | :: |
| 676 | |
| 677 | Shell> reset |
| 678 | |
| 679 | FPGA: Select Corstone-1000 Linux kernel boot |
| 680 | ============================================== |
| 681 | |
| 682 | Remove the USB stick before u-boot is reached so the Corstone-1000 kernel will be detected and used for booting. |
| 683 | |
| 684 | **NOTE:** Otherwise, the execution ends up in the ACS live image. |
| 685 | |
| 686 | FVP: Select Corstone-1000 Linux kernel boot |
| 687 | ============================================== |
| 688 | |
| 689 | Interrupt the u-boot shell. |
| 690 | |
| 691 | :: |
| 692 | |
| 693 | Hit any key to stop autoboot: |
| 694 | |
| 695 | Run the following commands in order to run the Corstone-1000 Linux kernel and being able to check the ESRT table. |
| 696 | |
| 697 | **NOTE:** Otherwise, the execution ends up in the ACS live image. |
| 698 | |
| 699 | :: |
| 700 | |
| 701 | $ run retrieve_kernel_load_addr |
| 702 | $ unzip $kernel_addr 0x90000000 |
| 703 | $ loadm 0x90000000 $kernel_addr_r 0xf00000 |
| 704 | $ bootefi $kernel_addr_r $fdtcontroladdr |
| 705 | |
| 706 | |
| 707 | *********************** |
| 708 | Capsule update status |
| 709 | *********************** |
| 710 | |
| 711 | Positive scenario |
| 712 | ================= |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 713 | |
| 714 | In the positive case scenario, the user should see following log in TF-M log, |
| 715 | indicating the new capsule image is successfully applied, and the board boots |
| 716 | correctly. |
| 717 | |
| 718 | :: |
| 719 | |
| 720 | ... |
| 721 | SysTick_Handler: counted = 10, expiring on = 360 |
| 722 | SysTick_Handler: counted = 20, expiring on = 360 |
| 723 | SysTick_Handler: counted = 30, expiring on = 360 |
| 724 | ... |
| 725 | metadata_write: success: active = 1, previous = 0 |
| 726 | accept_full_capsule: exit: fwu state is changed to regular |
| 727 | ... |
| 728 | |
| 729 | |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 730 | It's possible to check the content of the ESRT table after the system fully boots. |
| 731 | |
| 732 | In the Linux command-line run the following: |
| 733 | |
| 734 | :: |
| 735 | |
| 736 | # cd /sys/firmware/efi/esrt/entries/entry0 |
| 737 | # cat * |
| 738 | |
| 739 | 0x0 |
| 740 | e2bb9c06-70e9-4b14-97a3-5a7913176e3f |
| 741 | 0 |
| 742 | 6 |
| 743 | 0 |
| 744 | 6 |
| 745 | 0 |
| 746 | |
| 747 | .. line-block:: |
| 748 | capsule_flags: 0x0 |
| 749 | fw_class: e2bb9c06-70e9-4b14-97a3-5a7913176e3f |
| 750 | fw_type: 0 |
| 751 | fw_version: 6 |
| 752 | last_attempt_status: 0 |
| 753 | last_attempt_version: 6 |
| 754 | lowest_supported_fw_ver: 0 |
| 755 | |
| 756 | |
| 757 | Negative scenario |
| 758 | ================= |
| 759 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 760 | In the negative case scenario, the user should see appropriate logs in |
| 761 | the secure enclave terminal. If capsule pass initial verification, but fails |
| 762 | verifications performed during boot time, secure enclave will try new images |
| 763 | predetermined number of times (defined in the code), before reverting back to |
| 764 | the previous good bank. |
| 765 | |
| 766 | :: |
| 767 | |
| 768 | ... |
| 769 | metadata_write: success: active = 0, previous = 1 |
| 770 | fwu_select_previous: in regular state by choosing previous active bank |
| 771 | ... |
| 772 | |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 773 | It's possible to check the content of the ESRT table after the system fully boots. |
| 774 | |
| 775 | In the Linux command-line run the following: |
| 776 | |
| 777 | :: |
| 778 | |
| 779 | # cd /sys/firmware/efi/esrt/entries/entry0 |
| 780 | # cat * |
| 781 | |
| 782 | 0x0 |
| 783 | e2bb9c06-70e9-4b14-97a3-5a7913176e3f |
| 784 | 0 |
| 785 | 6 |
| 786 | 1 |
| 787 | 5 |
| 788 | 0 |
| 789 | |
| 790 | .. line-block:: |
| 791 | capsule_flags: 0x0 |
| 792 | fw_class: e2bb9c06-70e9-4b14-97a3-5a7913176e3f |
| 793 | fw_type: 0 |
| 794 | fw_version: 6 |
| 795 | last_attempt_status: 1 |
| 796 | last_attempt_version: 5 |
| 797 | lowest_supported_fw_ver: 0 |
| 798 | |
| 799 | Linux distros tests |
| 800 | ---------------------------------- |
| 801 | |
| 802 | *************************************************************************************** |
| 803 | Debian/OpenSUSE install and boot (applicable to FPGA only) |
| 804 | *************************************************************************************** |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 805 | |
| 806 | To test Linux distro install and boot, the user should prepare two empty USB sticks. |
| 807 | |
| 808 | Download one of following Linux distro images: |
| 809 | - Debian installer image: https://cdimage.debian.org/cdimage/weekly-builds/arm64/iso-dvd/ |
| 810 | - OpenSUSE Tumbleweed installer image: http://download.opensuse.org/ports/aarch64/tumbleweed/iso/ |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 811 | - The user should look for a DVD Snapshot like openSUSE-Tumbleweed-DVD-aarch64-Snapshot<date>-Media.iso |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 812 | |
| 813 | Once the .iso file is downloaded, the .iso file needs to be flashed to your USB drive. |
| 814 | |
| 815 | In the given example here, we assume the USB device is ``/dev/sdb`` (the user |
| 816 | should use `lsblk` command to confirm). Be cautious here and don't confuse your |
| 817 | host PC's own hard drive with the USB drive. Then copy the contents of an iso |
| 818 | file into the first USB stick, run: |
| 819 | |
| 820 | :: |
| 821 | |
| 822 | sudo dd if=</path/to/iso_file> of=/dev/sdb iflag=direct oflag=direct status=progress bs=1M; sync; |
| 823 | |
| 824 | Boot the MSP3 board with the first USB stick connected. Open following minicom sessions: |
| 825 | |
| 826 | :: |
| 827 | |
| 828 | sudo picocom -b 115200 /dev/ttyUSB0 # in one terminal |
| 829 | sudo picocom -b 115200 /dev/ttyUSB2 # in another terminal. |
| 830 | |
| 831 | Press <Ctrl+x>. |
| 832 | |
| 833 | Now plug in the second USB stick, the distro installation process will start. |
| 834 | |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 835 | **NOTE:** Due to the performance limitation of Corstone-1000 MPS3 FPGA, the |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 836 | distro installation process can take up to 24 hours to complete. |
| 837 | |
| 838 | Once installation is complete, unplug the first USB stick and reboot the board. |
| 839 | After successfully installing and booting the Linux distro, the user should see |
| 840 | a login prompt: |
| 841 | |
| 842 | :: |
| 843 | |
| 844 | debian login: |
| 845 | |
| 846 | Login with the username root. |
| 847 | |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 848 | **NOTE:** The Debian installer has a known issue "Install the GRUB bootloader - unable to install " and these are the steps to |
| 849 | follow on the subsequent popups to solve the issue during the installation: |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 850 | |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 851 | 1. Select "Continue", then "Continue" again on the next popup |
| 852 | 2. Scroll down and select "Execute a shell" |
| 853 | 3. Select "Continue" |
| 854 | 4. Enter the following command: |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 855 | |
| 856 | :: |
| 857 | |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 858 | in-target grub-install --no-nvram --force-extra-removable |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 859 | |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 860 | 5. Enter the following command: |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 861 | |
| 862 | :: |
| 863 | |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 864 | in-target update-grub |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 865 | |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 866 | 6. Enter the following command: |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 867 | |
| 868 | :: |
| 869 | |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 870 | exit |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 871 | |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 872 | 7. Select "Continue without boot loader", then select "Continue" on the next popup |
| 873 | 8. At this stage, the installation should proceed as normal. |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 874 | |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 875 | *************************************************************************************** |
| 876 | OpenSUSE Raw image install and boot (applicable to FVP only) |
| 877 | *************************************************************************************** |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 878 | |
| 879 | Steps to download openSUSE Tumbleweed raw image: |
| 880 | - Go to: http://download.opensuse.org/ports/aarch64/tumbleweed/appliances/ |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 881 | - The user should look for a Tumbleweed-ARM-JeOS-efi.aarch64-* Snapshot, for example, ``openSUSE-Tumbleweed-ARM-JeOS-efi.aarch64-<date>-Snapshot<date>.raw.xz`` |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 882 | |
| 883 | Once the .raw.xz file is downloaded, the raw image file needs to be extracted: |
| 884 | |
| 885 | :: |
| 886 | |
| 887 | unxz <file-name.raw.xz> |
| 888 | |
| 889 | |
| 890 | The above command will generate a file ending with extension .raw image. Now, use the following command |
| 891 | to run FVP with raw image installation process. |
| 892 | |
| 893 | :: |
| 894 | |
| 895 | <_workspace>/meta-arm/scripts/runfvp --terminals=xterm <_workspace>/build/tmp/deploy/images/corstone1000-fvp/corstone1000-image-corstone1000-fvp.fvpconf -- -C board.msd_mmc.p_mmc_file="${openSUSE raw image file path}" |
| 896 | |
| 897 | After successfully installing and booting the Linux distro, the user should see |
| 898 | a openSUSE login prompt. |
| 899 | |
| 900 | :: |
| 901 | |
| 902 | localhost login: |
| 903 | |
| 904 | Login with the username 'root' and password 'linux'. |
| 905 | |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 906 | PSA API tests |
| 907 | ---------------------- |
| 908 | |
| 909 | *************************************************************************************** |
| 910 | Run PSA API test commands (applicable to both FPGA and FVP) |
| 911 | *************************************************************************************** |
| 912 | |
| 913 | When running PSA API test commands (aka PSA Arch Tests) on MPS3 FPGA, the user should make sure there is no |
| 914 | USB stick connected to the board. Power on the board and boot the board to |
| 915 | Linux. Then, the user should follow the steps below to run the tests. |
| 916 | |
| 917 | When running the tests on the Corstone-1000 FVP, the user should follow the |
| 918 | instructions in `Running the software on FVP`_ section to boot Linux in FVP |
| 919 | host_terminal_0, and login using the username ``root``. |
| 920 | |
| 921 | First, load FF-A TEE kernel module: |
| 922 | |
| 923 | :: |
| 924 | |
| 925 | insmod /lib/modules/5.19.9-yocto-standard/extra/arm-ffa-tee.ko |
| 926 | |
| 927 | Then, check whether the FF-A TEE driver is loaded correctly by using the following command: |
| 928 | |
| 929 | :: |
| 930 | |
| 931 | cat /proc/modules | grep arm_ffa_tee |
| 932 | |
| 933 | The output should be: |
| 934 | |
| 935 | :: |
| 936 | |
| 937 | arm_ffa_tee 16384 - - Live 0xffffffc0004f0000 (O) |
| 938 | |
| 939 | Now, run the PSA API tests in the following order: |
| 940 | |
| 941 | :: |
| 942 | |
| 943 | psa-iat-api-test |
| 944 | psa-crypto-api-test |
| 945 | psa-its-api-test |
| 946 | psa-ps-api-test |
| 947 | |
| 948 | External System tests |
| 949 | ----------------------------------- |
| 950 | |
| 951 | *************************************************************************************** |
| 952 | Running the External System test command (systems-comms-tests) |
| 953 | *************************************************************************************** |
| 954 | |
| 955 | Test 1: Releasing the External System out of reset |
| 956 | =================================================== |
| 957 | |
| 958 | Run this command in the Linux command-line: |
| 959 | |
| 960 | :: |
| 961 | |
| 962 | systems-comms-tests 1 |
| 963 | |
| 964 | The output on the External System terminal should be: |
| 965 | |
| 966 | :: |
| 967 | |
| 968 | ___ ___ |
| 969 | | / __| |
| 970 | |=== \___ |
| 971 | |___ |___/ |
| 972 | External System Cortex-M3 Processor |
| 973 | Running RTX RTOS |
| 974 | v0.1.0_2022-10-19_16-41-32-8c9dca7 |
| 975 | MHUv2 module 'MHU0_H' started |
| 976 | MHUv2 module 'MHU1_H' started |
| 977 | MHUv2 module 'MHU0_SE' started |
| 978 | MHUv2 module 'MHU1_SE' started |
| 979 | |
| 980 | Test 2: Communication |
| 981 | ============================================= |
| 982 | |
| 983 | Test 2 releases the External System out of reset if not already done. Then, it performs communication between host and External System. |
| 984 | |
| 985 | After running Test 1, run this command in the Linux command-line: |
| 986 | |
| 987 | :: |
| 988 | |
| 989 | systems-comms-tests 2 |
| 990 | |
| 991 | Additional output on the External System terminal will be printed: |
| 992 | |
| 993 | :: |
| 994 | |
| 995 | MHUv2: Message from 'MHU0_H': 0xabcdef1 |
| 996 | Received 'abcdef1' From Host MHU0 |
| 997 | CMD: Increment and return to sender... |
| 998 | MHUv2: Message from 'MHU1_H': 0xabcdef1 |
| 999 | Received 'abcdef1' From Host MHU1 |
| 1000 | CMD: Increment and return to sender... |
| 1001 | |
| 1002 | When running Test 2 the first, Test 1 will be run in the background. |
| 1003 | |
| 1004 | The output on the External System terminal should be: |
| 1005 | |
| 1006 | :: |
| 1007 | |
| 1008 | ___ ___ |
| 1009 | | / __| |
| 1010 | |=== \___ |
| 1011 | |___ |___/ |
| 1012 | External System Cortex-M3 Processor |
| 1013 | Running RTX RTOS |
| 1014 | v0.1.0_2022-10-19_16-41-32-8c9dca7 |
| 1015 | MHUv2 module 'MHU0_H' started |
| 1016 | MHUv2 module 'MHU1_H' started |
| 1017 | MHUv2 module 'MHU0_SE' started |
| 1018 | MHUv2 module 'MHU1_SE' started |
| 1019 | MHUv2: Message from 'MHU0_H': 0xabcdef1 |
| 1020 | Received 'abcdef1' From Host MHU0 |
| 1021 | CMD: Increment and return to sender... |
| 1022 | MHUv2: Message from 'MHU1_H': 0xabcdef1 |
| 1023 | Received 'abcdef1' From Host MHU1 |
| 1024 | CMD: Increment and return to sender... |
| 1025 | |
| 1026 | The output on the Host terminal should be: |
| 1027 | |
| 1028 | :: |
| 1029 | |
| 1030 | Received abcdf00 from es0mhu0 |
| 1031 | Received abcdf00 from es0mhu1 |
| 1032 | |
| 1033 | |
| 1034 | Tests results |
| 1035 | ----------------------------------- |
| 1036 | |
| 1037 | As a reference for the end user, reports for various tests for `Corstone-1000 software (CORSTONE1000-2022.11.10) <https://git.yoctoproject.org/meta-arm/tag/?h=CORSTONE1000-2022.11.10>`__ |
| 1038 | can be found in `here <https://gitlab.arm.com/arm-reference-solutions/arm-reference-solutions-test-report/-/tree/master/embedded-a/corstone1000>`__. |
| 1039 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 1040 | Running the software on FVP on Windows |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 1041 | --------------------------------------------------------------- |
| 1042 | |
| 1043 | If the user needs to run the Corstone-1000 software on FVP on Windows. The user |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 1044 | should follow the build instructions in this document to build on Linux host |
| 1045 | PC, and copy the output binaries to the Windows PC where the FVP is located, |
| 1046 | and launch the FVP binary. |
| 1047 | |
| 1048 | -------------- |
| 1049 | |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame^] | 1050 | *Copyright (c) 2022, Arm Limited. All rights reserved.* |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 1051 | |
| 1052 | .. _Arm Ecosystem FVPs: https://developer.arm.com/tools-and-software/open-source-software/arm-platforms-software/arm-ecosystem-fvps |