blob: 5df6e0b15c216236faac70cbeb431d18b9957e6c [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
Sathees Balya52cf4792018-10-16 15:26:40 +010013The environment variable CROSS_COMPILE must point to the cross compiler. Refer
14to section 4 of the User Guide for the exact version this software has been tested with.
15
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020016$ make PLAT=juno
17or
18$ make PLAT=fvp
19
20
21Preparing Juno board configuration files
22----------------------------------------
23
24You should have the following line in your 'SITE1/HBI0262X/board.txt' Juno
25configuration file on the SD card (where X depends on the revision of your Juno
26board):
27
28 SCC: 0x0F4 0x000003F8
29
30This:
31 - ensures all CPUs are powered on at reset;
32 - designates the Cortex-A53 #0 as the primary CPU.
33
34See the 'Assumptions' section below' for more details.
35
36
37Running on Juno
38---------------
39
40The Trusted Firmware-A must be compiled with SPIN_ON_BL1_EXIT=1. This will
41introduce an infinite loop in BL1 that gives you some time to load and run the
42EL3 payload over JTAG.
43
44Boot 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
46Firmware 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
60TODO: Update the above messages.
61
62At this point, type the following command in a shell from the EL3 test payload
63top directory:
64
65$ make PLAT=juno run
66
67You 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
81And on the Juno UART, this should print the following messages:
82
83 Booting the EL3 test payload
84 All CPUs booted!
85
86
87Running on FVP (AEMv8A)
88-----------------------
89
90First, copy the "bl1.bin" and "fip.bin" files into the current directory.
91Alternatively, symbolic links might be created.
92
93Then run:
94
95$ make PLAT=fvp run
96
97Note: 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
101How does it work?
102-----------------
103
104There is a per-cpu array. Each entry is initialised to a "dead" value. On entry
105into the payload, each CPU writes its MPID to its entry, which allows it to
106signal its presence.
107
108Secondary CPUs then spin forever.
109
110The 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
117Assumptions
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.