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