summaryrefslogtreecommitdiff
path: root/ArmPlatformPkg/Documentation/ArmVExpressInstructions.txt
blob: a3fe9d77a123f476f079b5c59e73b44994ff730d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
=======================================
= ARM Versatile Express Documentation =
=======================================

Status
------
Build and Run on EDK2 Subversion revision 11837
Requirements 
-	RVCTv3 (untested) or RVCTv4 or ARMGCC (Code Sourcery q201009)
-	Using Ubuntu: gcc, make, uuid-dev 
-	Using Cygwin: gcc, make, e2fsprogs (needed for uuid.h) 

Serial Terminal settings 
-	Baud Rates: 38400
- Data: 8 bit
- Parity: None
- Flow Control: None 


Use ICE debugger with Versatile Express 
---------------------------------------
Prior to use ICE debugger with Versatile Express, you will need to update the version of the ICE's firmware.
If you have not installed RealView 4.0 SP3, do it.
Open "RealView ICE Update" and "Install Firmware Update ...". Install "[ARM_INSTALL_PATH]\RVI\Firmware\3.4\11\ARM-RVI-3.4.0-25-base.rvi" and "[ARM_INSTALL_PATH]\RVI\Firmware\3.4\22\ARM-RVI-3.4.59-59-patch.rvi". 


Howto build UEFI Versatile Express
----------------------------------
For Linux
---------

For the first time 
******************
1. Get EDK2 from Tianocore Subversion repository
svn co https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2 edk2 --username guest
 
2. Get FatPkg from EDK2 SVN repository: 
cd edk2
svn co https://edk2-fatdriver2.svn.sourceforge.net/svnroot/edk2-fatdriver2/trunk/FatPkg FatPkg --username guest

3. Set up the environment. And build the EDK2’s tools
export EDK_TOOLS_PATH=`pwd`/BaseTools
. edksetup.sh
make -C $EDK_TOOLS_PATH

4. Ensure the ARMGCC toolchain is in your PATH environment variable or defined by the ARMGCC_TOOLS_PATH environment variable. Example:
export ARMGCC_TOOLS_PATH=/opt/toolchains/arm-2010.09-arm-none-eabi-i686-pc-linux-gnu/bin/

5. Build the ARM Versatile Express UEFI Firmware
build -a ARM -p ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA9x4.dsc -t ARMGCC

6. Edit the ARM Versatile Express configuration file config.txt to declare the location of the UEFI firmware in NOR Flash
TOTALIMAGES: 5                   ;Number of Images (Max : 32)
NOR0UPDATE: AUTO                 ;Image Update:NONE/AUTO/FORCE
NOR0ADDRESS: BOOT                ;Image Flash Address
NOR0FILE: \SOFTWARE\bm_v209.axf  ;Image File Name
NOR1UPDATE: AUTO                 ;IMAGE UPDATE:NONE/AUTO/FORCE
NOR1ADDRESS: 44000000            ;Image Flash Address
NOR1FILE: \SOFTWARE\sec_uefi.bin ;Image File Name
NOR1LOAD: 0                      ;Image Load Address
NOR1ENTRY: 0                     ;Image Entry Point
NOR2UPDATE: AUTO                 ;IMAGE UPDATE:NONE/AUTO/FORCE
NOR2ADDRESS: 45000000            ;Image Flash Address
NOR2FILE: \SOFTWARE\uefi.bin     ;Image File Name
NOR2LOAD: 45000000               ;Image Load Address
NOR2ENTRY: 45000000              ;Image Entry Point
NOR3UPDATE: AUTO                 ;IMAGE UPDATE:NONE/AUTO/FORCE
NOR3ADDRESS: 46000000            ;Image Flash Address
NOR3FILE: \SOFTWARE\kernel.bin   ;Image File Name
NOR3LOAD: 46000000               ;Image Load Address
NOR3ENTRY: 46000000              ;Image Entry Point
NOR4UPDATE: AUTO                 ;IMAGE UPDATE:NONE/AUTO/FORCE
NOR4ADDRESS: 40000000            ;Image Flash Address
NOR4NAME: BOOTSCRIPT             ;Image Name
NOR4FILE: \SOFTWARE\bootscr.txt  ;Image File Name

7. To select second NOR Flash as a booting device, replace in the ARM Versatile Express file \SITE1\HBI0191B\board.txt:
SCC: 0x004 0x00001F09
By:
SCC: 0x004 0x10001F09

8. Copy Build/ArmVExpress-CTA9x4/DEBUG_ARMGCC/FV/SEC_ARMVEXPRESS_EFI.fd to the ARM Versatile Express mass storage (available when the board is connected through USB to your host machine) under the folder SOTWARE and name sec_uefi.bin. Example for cygwin:
cp Build/ArmVExpress-CTA9x4/DEBUG_ARMGCC/FV/SEC_ARMVEXPRESS_EFI.fd /cygdrive/e/SOFTWARE/sec_uefi.bin

9. Start the ARM Versatile Express board. You should read “Waiting for firmware at 0x80000000 ...” on the serial port. 

10. Copy ARMVEXPRESS_EFI.fd at 0x80000000 with RealView Debugger
readfile,raw,nowarn "[EDK2_PATH]\Build\ArmVExpress-CTA9x4\DEBUG_ARMGCC\FV\ARMVEXPRESS_EFI.fd"=0x80000000

11. Resume the execution from RealView Debugger

For all subsequent times
************************
1. Build ARM Versatile Express UEFI Firmware
build -a ARM -p ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA9x4.dsc -t ARMGCC

2. Start the ARM Versatile Express board. You should read “Waiting for firmware at 0x80000000 ...” on the serial port. 

3. Copy ARMVEXPRESS_EFI.fd at 0x80000000 with RealView Debugger
readfile,raw,nowarn "[EDK2_PATH]\Build\ArmVExpress-CTA9x4\DEBUG_ARMGCC\FV\ARMVEXPRESS_EFI.fd"=0x80000000

4. Resume the execution 


For RealView Compiler Toolchain on Windows
------------------------------------------
The command line window needs to be the one from Visual Studio to get the environment variables required to get some development tools (the windows compiler for BaseTools and `nmake`).
The EDK2 toolchain name for ARM RealView Compiler Toolchain under a Windows environment is `RVCT`. The EDK2 build system will automatically pick up the RVCT toolchain defined in your PATH. If you want to use a specific version, set the environment variable 'RVCT_TOOLS_PATH': 
set RVCT_TOOLS_PATH=[YOUR_TOOLCHAIN_PATH]


For RealView Compiler Toolchain on Linux
----------------------------------------
The EDK2 toolchain name for ARM RealView under a Linux environment is `RVCTLINUX`. The EDK2 build system will automatically pick up the RVCT toolchain defined in your PATH. If you want to use a specific version, set the environment variable 'RVCT_TOOLS_PATH': 
export RVCT_TOOLS_PATH=[YOUR_TOOLCHAIN_PATH]


For RVCT on Cygwin
------------------
The EDK2 toolchain name for ARM RealView under a Cygwin environment is `RVCTCYGWIN`. The EDK2 build system will automatically pick up the RVCT toolchain defined in your PATH. If you want to use a specific version, set the environment variable 'RVCT_TOOLS_PATH': 
export RVCT_TOOLS_PATH=[YOUR_TOOLCHAIN_PATH]


To support the standalone mode:
-------------------------------
The full ArmVe UEFI firmware can be written into NOR Flash to allow the entire boot sequence to be done after a cold boot.

build -a ARM -p ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA9x4.dsc -t ARMGCC -D EDK2_ARMVE_STANDALONE=1
ARMVEXPRESS_EFI.fd is required to be copied into the ARM Versatile Express board:
cp Build/ArmVExpress-CTA9x4-Standalone/DEBUG_ARMGCC/FV/SEC_ARMVEXPRESS_EFI.fd /cygdrive/e/SOFTWARE/sec_uefi.bin
cp Build/ArmVExpress-CTA9x4-Standalone/DEBUG_ARMGCC/FV/ARMVEXPRESS_EFI.fd /cygdrive/e/SOFTWARE/uefi.bin


Trustzone Support
-----------------
ArmVE's UEFI supports booting Trustzone (two worlds: Secure and Normal Worlds) and No Trustzone (one world: the CPU remains in Secure World) supports. Trustzone support is enabled by Enabling SMC TZASC in the Test Chip SCC Register 1. This register can only be changed by editing the configuration file of your Versatile Express board: E:\SITE1\HBI0191B\board.txt Changing: 
SCC: 0x004 0x10001F09
For: 
SCC: 0x004 0x10003F09


Booting Linux
-------------
The default entry in the ARM Boot Manager is defined by the PCDs:

- gArmPlatformTokenSpaceGuid.PcdDefaultBootDescription|L"NorFlash"
- gArmPlatformTokenSpaceGuid.PcdDefaultBootDevicePath|L"VenHw(E7223039-5836-41E1-B542-D7EC736C5E59)/MemoryMapped(0,0x46000000,0x462F0000)"
- gArmPlatformTokenSpaceGuid.PcdDefaultBootArgument|"root=/dev/sda2 rootwait debug earlyprintk console=ttyAMA0,38400 mem=1G"
- gArmPlatformTokenSpaceGuid.PcdDefaultBootType|1

The PCD PcdDefaultBootDevicePath expects a Device Path conforms to the UEFI specification.
PcdDefaultBootType defines the type of the image pointed by PcdDefaultBootDevicePath.
-	PcdDefaultBootDevicePath = 0 for an EFI Application
-	PcdDefaultBootDevicePath = 1 for a legacy kernel with ATAG support
-	PcdDefaultBootDevicePath = 2 for a kernel with Flat Device Tree (FDT) support

Example of UEFI Device Path: 

// Load FDT binary from the Firmware Volume (mapped at 0x80000000)
#define LINUX_KERNEL  L"MemoryMapped(11,0x80000000,0x6FEFFFFF)\\zImage.fdt"

// Linux Kernel from a SD Card
#define LINUX_KERNEL    L"VenHw(621B6FA5-4DC1-476F-B9D8-52C557D81070)/HD(1,MBR,0x00000000,0xF9,0x3C8907)\\boot\\zImage.fdt"

// Kernel from SATA HD - Partition 2
#define LINUX_KERNEL    L"Acpi(PNP0A03,0)/Pci(0|0)/Pci(0|0)/Pci(5|0)/Pci(0|0)/Sata(0,0,0)/HD(2,MBR,0x00076730,0x1F21BF,0x1F21BF)\\boot\\zImage.fdt"

// Kernel from NOR Flash
#define LINUX_KERNEL            L"VenHw(02118005-9DA7-443a-92D5-781F022AEDBB)/MemoryMapped(0,0x46000000,0x462F0000)"