Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 1 | EL3 test payload |
| 2 | ================ |
| 3 | |
| 4 | This program is a very simple EL3 baremetal application. It has been developed |
| 5 | to test the ability of the Trusted Firmware-A to load an EL3 payload. All it |
| 6 | does is making sure that all CPUs enter this image and if so, reports it through |
| 7 | the UART. |
| 8 | |
| 9 | |
| 10 | Building |
| 11 | -------- |
| 12 | |
Sathees Balya | 52cf479 | 2018-10-16 15:26:40 +0100 | [diff] [blame] | 13 | The environment variable CROSS_COMPILE must point to the cross compiler. Refer |
| 14 | to section 4 of the User Guide for the exact version this software has been tested with. |
| 15 | |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 16 | $ make PLAT=juno |
| 17 | or |
| 18 | $ make PLAT=fvp |
| 19 | |
| 20 | |
| 21 | Preparing Juno board configuration files |
| 22 | ---------------------------------------- |
| 23 | |
| 24 | You should have the following line in your 'SITE1/HBI0262X/board.txt' Juno |
| 25 | configuration file on the SD card (where X depends on the revision of your Juno |
| 26 | board): |
| 27 | |
| 28 | SCC: 0x0F4 0x000003F8 |
| 29 | |
| 30 | This: |
| 31 | - ensures all CPUs are powered on at reset; |
| 32 | - designates the Cortex-A53 #0 as the primary CPU. |
| 33 | |
| 34 | See the 'Assumptions' section below' for more details. |
| 35 | |
| 36 | |
| 37 | Running on Juno |
| 38 | --------------- |
| 39 | |
| 40 | The Trusted Firmware-A must be compiled with SPIN_ON_BL1_EXIT=1. This will |
| 41 | introduce an infinite loop in BL1 that gives you some time to load and run the |
| 42 | EL3 payload over JTAG. |
| 43 | |
| 44 | Boot the board and wait until you see the following messages on the UART. |
| 45 | (Note that the "INFO" messages appear only in a debug build of the Trusted |
| 46 | Firmware but you should see the "NOTICE" messages in any case.) |
| 47 | |
| 48 | NOTICE: BL1: Booting BL31 |
| 49 | INFO: BL1: BL31 address = 0x80000000 |
| 50 | INFO: BL1: BL31 spsr = 0x3cd |
| 51 | INFO: BL1: BL31 params address = 0x0 |
| 52 | INFO: BL1: BL31 plat params address = 0xf1e2d3c4b5a6978 |
| 53 | INFO: BL1: BL31 address = 0x80000000 |
| 54 | INFO: BL1: BL31 spsr = 0x3cd |
| 55 | INFO: BL1: BL31 params address = 0x0 |
| 56 | INFO: BL1: BL31 plat params address = 0xf1e2d3c4b5a6978 |
| 57 | NOTICE: BL1: Debug loop, spinning forever |
| 58 | NOTICE: BL1: Please connect the debugger to jump over it |
| 59 | |
| 60 | TODO: Update the above messages. |
| 61 | |
| 62 | At this point, type the following command in a shell from the EL3 test payload |
| 63 | top directory: |
| 64 | |
| 65 | $ make PLAT=juno run |
| 66 | |
| 67 | You should see something like this in your shell (it takes a few seconds): |
| 68 | |
| 69 | Trying to detect your DSTREAM unit... |
| 70 | Available connections: |
| 71 | USB:000765 |
| 72 | Connecting to USB:000765... |
| 73 | Connected to running target Cortex-A53_0 |
| 74 | Execution stopped in EL3h mode at EL3:0x000000000BEC2548 |
| 75 | EL3:0x000000000BEC2548 B {pc} ; 0xbec2548 |
| 76 | Loaded section ro: EL3:0x0000000080000000 ~ EL3:0x0000000080000123 (size 0x124) |
| 77 | Loaded section .data: EL3:0x0000000080000128 ~ EL3:0x0000000080000197 (size 0x70) |
| 78 | Entry point EL3:0x0000000080000000 |
| 79 | Disconnected from running target Cortex-A53_0 |
| 80 | |
| 81 | And on the Juno UART, this should print the following messages: |
| 82 | |
| 83 | Booting the EL3 test payload |
| 84 | All CPUs booted! |
| 85 | |
| 86 | |
| 87 | Running on FVP (AEMv8A) |
| 88 | ----------------------- |
| 89 | |
| 90 | First, copy the "bl1.bin" and "fip.bin" files into the current directory. |
| 91 | Alternatively, symbolic links might be created. |
| 92 | |
| 93 | Then run: |
| 94 | |
| 95 | $ make PLAT=fvp run |
| 96 | |
| 97 | Note: The EL3 payload does not work on the Foundation FVP. |
| 98 | (This is because it expects 8 CPUs and the Foundation FVP has maximum 4.) |
| 99 | |
| 100 | |
| 101 | How does it work? |
| 102 | ----------------- |
| 103 | |
| 104 | There is a per-cpu array. Each entry is initialised to a "dead" value. On entry |
| 105 | into the payload, each CPU writes its MPID to its entry, which allows it to |
| 106 | signal its presence. |
| 107 | |
| 108 | Secondary CPUs then spin forever. |
| 109 | |
| 110 | The primary CPU carries on. |
| 111 | 1) It prints a "welcome" string. |
| 112 | 2) It waits for each entry in the CPUs array to be updated. |
| 113 | 3) Once all CPUs have been detected in that way, it prints a success message. |
| 114 | 4) Finally, it spins forever. |
| 115 | |
| 116 | |
| 117 | Assumptions |
| 118 | ----------- |
| 119 | |
| 120 | - All CPUs enter the EL3 test payload at some point. |
| 121 | The order doesn't matter, though. |
| 122 | If some CPU doesn't boot then the EL3 payload will wait forever. |
| 123 | |
| 124 | - On FVP, the number of cores is hard-coded to 8. |
| 125 | If the FVP model is configured to disable some CPUs then the EL3 payload will |
| 126 | hang, waiting forever for absent CPUs. |
| 127 | For the same reason, the EL3 payload hangs on the Foundation FVP (which has |
| 128 | 4 CPUs only). |
| 129 | |
| 130 | - The UART is already configured. |
| 131 | |
| 132 | - On Juno, the primary CPU is hard-coded to the Cortex-A53 #0. |
| 133 | Any CPU could be the primary CPU, though. However, the DS-5 scripts launched |
| 134 | by 'make run' assumes the Cortex-A53 #0 is the primary CPU. |
| 135 | |
| 136 | On FVP, the primary CPU is hard-coded to the CPU with MPID 0x0. |
| 137 | |
| 138 | Designating a CPU as the primary one simplifies the code, More particularly, |
| 139 | only the primary CPU accesses the UART, which removes the need for |
| 140 | synchronisation locks to avoid interleaved messages. |
| 141 | |
| 142 | - The EL3 test pyaload runs from RAM. |
| 143 | It can't execute from flash, as we would need to relocate the .data section |
| 144 | in RAM at run-time and this is not implemented for now. |