diff --git a/ArmPlatformPkg/Documentation/ArmVExpressInstructions.txt b/ArmPlatformPkg/Documentation/ArmVExpressInstructions.txt index db901c4936..d2ef647f60 100644 --- a/ArmPlatformPkg/Documentation/ArmVExpressInstructions.txt +++ b/ArmPlatformPkg/Documentation/ArmVExpressInstructions.txt @@ -4,7 +4,7 @@ Status ------ -Build and Run on EDK2 Subversion revision 11251 +Build and Run on EDK2 Subversion revision 11837 Requirements - RVCTv3 (untested) or RVCTv4 or ARMGCC (Code Sourcery q201009) - Using Ubuntu: gcc, make, uuid-dev @@ -26,8 +26,8 @@ Open "RealView ICE Update" and "Install Firmware Update ...". Install "[ARM_INST Howto build UEFI Versatile Express ---------------------------------- -For Cygwin ----------- +For Linux +--------- For the first time ****************** @@ -38,15 +38,23 @@ svn co https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2 edk2 --username 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 +3. Apply some BaseTools patches +patch -p0 < ArmPlatformPkg/Documentation/patches/BaseTools-armgcc_build_rule_template.patch +patch -p1 < ArmPlatformPkg/Documentation/patches/BaseTools-Define-the-CodeSourcery-toolchain-path-with-ENV.patch +patch -p1 < ArmPlatformPkg/Documentation/patches/BaseTools-Add-mword-relocations-to-ARMGCC.patch + +4. Set up the environment. And build the EDK2’s tools export EDK_TOOLS_PATH=`pwd`/BaseTools . edksetup.sh `pwd`/BaseTools/ make -C $EDK_TOOLS_PATH -4. Build the ARM Versatile Express UEFI Firmware -build -a ARM -p ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA9x4.dsc -t RVCTCYGWIN +5. 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. Edit the ARM Versatile Express configuration file config.txt to declare the location of the UEFI firmware in NOR Flash +6. Build the ARM Versatile Express UEFI Firmware +build -a ARM -p ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA9x4.dsc -t ARMGCC + +7. 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 @@ -71,30 +79,30 @@ NOR4ADDRESS: 40000000 ;Image Flash Address NOR4NAME: BOOTSCRIPT ;Image Name NOR4FILE: \SOFTWARE\bootscr.txt ;Image File Name -6. To select second NOR Flash as a booting device, replace in the ARM Versatile Express file \SITE1\HBI0191B\board.txt: +8. 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 -7. Copy Build/ArmVExpress-CTA9x4/DEBUG_RVCTCYGWIN/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_RVCTCYGWIN/FV/SEC_ARMVEXPRESS_EFI.fd /cygdrive/e/SOFTWARE/sec_uefi.bin +9. 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 -8. Start the ARM Versatile Express board. You should read “Waiting for firmware at 0x80000000 ...” on the serial port. +10. Start the ARM Versatile Express board. You should read “Waiting for firmware at 0x80000000 ...” on the serial port. -9. Copy ARMVEXPRESS_EFI.fd at 0x80000000 with RealView Debugger -readfile,raw,nowarn "[EDK2_PATH]\Build\ArmVExpress-CTA9x4\DEBUG_RVCTCYGWIN\FV\ARMVEXPRESS_EFI.fd"=0x80000000 +11. Copy ARMVEXPRESS_EFI.fd at 0x80000000 with RealView Debugger +readfile,raw,nowarn "[EDK2_PATH]\Build\ArmVExpress-CTA9x4\DEBUG_ARMGCC\FV\ARMVEXPRESS_EFI.fd"=0x80000000 -10. Resume the execution from RealView Debugger +12. 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 RVCTCYGWIN +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_RVCTCYGWIN\FV\ARMVEXPRESS_EFI.fd"=0x80000000 +readfile,raw,nowarn "[EDK2_PATH]\Build\ArmVExpress-CTA9x4\DEBUG_ARMGCC\FV\ARMVEXPRESS_EFI.fd"=0x80000000 4. Resume the execution @@ -112,24 +120,20 @@ The EDK2 toolchain name for ARM RealView under a Linux environment is `RVCTLINUX export RVCT_TOOLS_PATH=[YOUR_TOOLCHAIN_PATH] -For ARM GNU GCC on Linux ------------------------- -The EDK2 toolchain name for ARM RealView under a Linux environment is `ARMGCC`. EDK2 requires Bash Shell to be built on Linux. -The ARMGCC toolchain is expected to be found in your PATH. ARM Edk2 has been tested with 'CodeSourcery G++ Lite 2010.09-51 - EABI Version'. -If you decide to use a specific version, set the environment variable 'ARMGCC_TOOLS_PATH': -export ARMGCC_TOOLS_PATH=[YOUR_CODESOURCERY_TOOLCHAIN_PATH] -Example: -export ARMGCC_TOOLS_PATH=/Work/arm-2010.09/bin/ -Compiling UEFI ArmVE as a standalone firmware -The full ArmVe UEFI firmware can be written into NOR Flash to allow the entire boot sequence to be done after a cold boot. +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: ------------------------------- -build -a ARM -p ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA9x4.dsc -t RVCTCYGWIN -D EDK2_ARMVE_STANDALONE=1 +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_RVCTCYGWIN/FV/SEC_ARMVEXPRESS_EFI.fd /cygdrive/e/SOFTWARE/sec_uefi.bin -cp Build/ArmVExpress-CTA9x4-Standalone/DEBUG_RVCTCYGWIN/FV/ARMVEXPRESS_EFI.fd /cygdrive/e/SOFTWARE/uefi.bin +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 @@ -142,12 +146,18 @@ SCC: 0x004 0x10003F09 Booting Linux ------------- -ArmVe's BDS expects a Linux kernel at 0x46000000 (2nd NOR Flash). This location is also defined in the config.txt file of the motherboard (same file as the one that defines UEFI firmwares location). The Linux kernel at this location is a copy of \SOFTWARE\kernel.bin as refered in config.txt. -To boot on a different kernel, you will need to edit [EDK2_ROOT]\ArmVePkg\Bds\BdsEntry.c -#define LINUX_KERNEL L"VenHw(02118005-9DA7-443a-92D5-781F022AEDBB)/MemoryMapped(0,0x46000000,0x462F0000)" -#define FDT 0 -#define LINUX_ATAG "rdinit=/bin/ash debug earlyprintk console=ttyAMA0,38400 mem=1G" -The macros LINUX_KERNEL and FDT expect a UEFI Device Path. +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: @@ -162,15 +172,3 @@ Example of UEFI Device Path: // Kernel from NOR Flash #define LINUX_KERNEL L"VenHw(02118005-9DA7-443a-92D5-781F022AEDBB)/MemoryMapped(0,0x46000000,0x462F0000)" - - -UEFI Memory Maps for ARM Versatile Express ------------------------------------------- -Figure 1: EFI Memory Map in the Temporary Memory -See ArmVExpressMemoryMaps_TemporaryMemoryMap.png - -Figure 2: CPU Core stack in the Temporary Memory -See ArmVExpressMemoryMaps_TemporaryStack.png - -Figure 3: EFI Memory Map in the Permanent Memory -See ArmVExpressMemoryMaps_PermanentMemoryMap.png diff --git a/ArmPlatformPkg/Documentation/patches/BaseTools-Add-mword-relocations-to-ARMGCC.patch b/ArmPlatformPkg/Documentation/patches/BaseTools-Add-mword-relocations-to-ARMGCC.patch new file mode 100755 index 0000000000..b2daebe90b --- /dev/null +++ b/ArmPlatformPkg/Documentation/patches/BaseTools-Add-mword-relocations-to-ARMGCC.patch @@ -0,0 +1,27 @@ +From 0c01d81d610c6566fdde5e41bbce2265ee952c83 Mon Sep 17 00:00:00 2001 +From: Olivier Martin +Date: Wed, 15 Jun 2011 19:54:50 +0100 +Subject: [PATCH 4/6] BaseTools: Add -mword-relocations to ARMGCC to generate supported relocation symbols + +--- + BaseTools/Conf/tools_def.template | 4 ++-- + 1 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template +index 7629701..39d67fb 100755 +--- a/BaseTools/Conf/tools_def.template ++++ b/BaseTools/Conf/tools_def.template +@@ -3605,8 +3605,8 @@ RELEASE_ARMGCC_ARM_ASM_FLAGS = $(ARCHASM_FLAGS) -mlittle-endian + *_ARMGCC_ARM_SLINK_FLAGS = -rc + *_ARMGCC_ARM_DLINK_FLAGS = $(ARCHDLINK_FLAGS) --oformat=elf32-littlearm --emit-relocs -nostdlib -u $(IMAGE_ENTRY_POINT) -e $(IMAGE_ENTRY_POINT) -Map $(DEST_DIR_DEBUG)/$(BASE_NAME).map + +- DEBUG_ARMGCC_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -mlittle-endian -g -O0 -mabi=aapcs -mapcs -fno-short-enums -save-temps -combine -fsigned-char -fshort-wchar -fno-strict-aliasing -ffunction-sections -fdata-sections -Wall -Werror -Wno-missing-braces -fomit-frame-pointer -c -include AutoGen.h +-RELEASE_ARMGCC_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -mlittle-endian -Os -mabi=aapcs -mapcs -fno-short-enums -save-temps -combine -fsigned-char -fshort-wchar -fno-strict-aliasing -ffunction-sections -fdata-sections -Wall -Werror -Wno-missing-braces -fomit-frame-pointer -c -include AutoGen.h ++ DEBUG_ARMGCC_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -mword-relocations -mlittle-endian -g -O0 -mabi=aapcs -mapcs -fno-short-enums -save-temps -combine -fsigned-char -fshort-wchar -fno-strict-aliasing -ffunction-sections -fdata-sections -Wall -Werror -Wno-missing-braces -fomit-frame-pointer -c -include AutoGen.h ++RELEASE_ARMGCC_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -mword-relocations -mlittle-endian -Os -mabi=aapcs -mapcs -fno-short-enums -save-temps -combine -fsigned-char -fshort-wchar -fno-strict-aliasing -ffunction-sections -fdata-sections -Wall -Werror -Wno-missing-braces -fomit-frame-pointer -c -include AutoGen.h + + ################# + # ASM 16 linker defintions +-- +1.6.3.3 + diff --git a/ArmPlatformPkg/Documentation/patches/BaseTools-Define-the-CodeSourcery-toolchain-path-with-ENV.patch b/ArmPlatformPkg/Documentation/patches/BaseTools-Define-the-CodeSourcery-toolchain-path-with-ENV.patch new file mode 100755 index 0000000000..0db57ff4cd --- /dev/null +++ b/ArmPlatformPkg/Documentation/patches/BaseTools-Define-the-CodeSourcery-toolchain-path-with-ENV.patch @@ -0,0 +1,55 @@ +From fc42aa2804b459c0131cab10803c69e88cc79fc0 Mon Sep 17 00:00:00 2001 +From: Olivier Martin +Date: Wed, 15 Jun 2011 19:24:52 +0100 +Subject: [PATCH] BaseTools: Define the CodeSourcery toolchain path with the macro ENV() + +The path was defined by the macro DEF() that requires a local definition in the file. +--- + BaseTools/Conf/tools_def.template | 20 ++++++++++---------- + 1 files changed, 10 insertions(+), 10 deletions(-) + mode change 100644 => 100755 BaseTools/Conf/tools_def.template + +diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template +old mode 100644 +new mode 100755 +index 495f55d..7629701 +--- a/BaseTools/Conf/tools_def.template ++++ b/BaseTools/Conf/tools_def.template +@@ -3560,7 +3560,7 @@ RELEASE_RVCT31CYGWIN_ARM_CC_FLAGS = "$(CCPATH_FLAG)" $(ARCHCC_FLAGS) $(PLATFORM + *_ARMGCC_*_*_FAMILY = GCC + *_ARMGCC_*_*_BUILDRULEFAMILY = ARMGCC + +-*_ARMGCC_*_MAKE_PATH = DEF(SOURCERY_TOOLS)/cs-make ++*_ARMGCC_*_MAKE_PATH = make + *_ARMGCC_*_MAKE_FLAGS = --no-print-directory + + ################## +@@ -3577,16 +3577,16 @@ RELEASE_RVCT31CYGWIN_ARM_CC_FLAGS = "$(CCPATH_FLAG)" $(ARCHCC_FLAGS) $(PLATFORM + # ARM definitions + ################## + +-*_ARMGCC_ARM_ASLCC_PATH = DEF(SOURCERY_TOOLS)/arm-none-eabi-gcc +-*_ARMGCC_ARM_ASLDLINK_PATH = DEF(SOURCERY_TOOLS)/arm-none-eabi-ld +-*_ARMGCC_ARM_ASLPP_PATH = DEF(SOURCERY_TOOLS)/arm-none-eabi-gcc ++*_ARMGCC_ARM_ASLCC_PATH = ENV(ARMGCC_TOOLS_PATH)arm-none-eabi-gcc ++*_ARMGCC_ARM_ASLDLINK_PATH = ENV(ARMGCC_TOOLS_PATH)arm-none-eabi-ld ++*_ARMGCC_ARM_ASLPP_PATH = ENV(ARMGCC_TOOLS_PATH)arm-none-eabi-gcc + +-*_ARMGCC_ARM_CC_PATH = DEF(SOURCERY_TOOLS)/arm-none-eabi-gcc +-*_ARMGCC_ARM_SLINK_PATH = DEF(SOURCERY_TOOLS)/arm-none-eabi-ar +-*_ARMGCC_ARM_DLINK_PATH = DEF(SOURCERY_TOOLS)/arm-none-eabi-ld +-*_ARMGCC_ARM_ASM_PATH = DEF(SOURCERY_TOOLS)/arm-none-eabi-as +-*_ARMGCC_ARM_PP_PATH = DEF(SOURCERY_TOOLS)/arm-none-eabi-gcc +-*_ARMGCC_ARM_VFRPP_PATH = DEF(SOURCERY_TOOLS)/arm-none-eabi-gcc ++*_ARMGCC_ARM_CC_PATH = ENV(ARMGCC_TOOLS_PATH)arm-none-eabi-gcc ++*_ARMGCC_ARM_SLINK_PATH = ENV(ARMGCC_TOOLS_PATH)arm-none-eabi-ar ++*_ARMGCC_ARM_DLINK_PATH = ENV(ARMGCC_TOOLS_PATH)arm-none-eabi-ld ++*_ARMGCC_ARM_ASM_PATH = ENV(ARMGCC_TOOLS_PATH)arm-none-eabi-as ++*_ARMGCC_ARM_PP_PATH = ENV(ARMGCC_TOOLS_PATH)arm-none-eabi-gcc ++*_ARMGCC_ARM_VFRPP_PATH = ENV(ARMGCC_TOOLS_PATH)arm-none-eabi-gcc + + # + # Use default values, or override in DSC file +-- +1.6.3.3 + diff --git a/ArmPlatformPkg/Documentation/patches/BaseTools-armgcc_build_rule_template.patch b/ArmPlatformPkg/Documentation/patches/BaseTools-armgcc_build_rule_template.patch new file mode 100755 index 0000000000..7522eb4843 --- /dev/null +++ b/ArmPlatformPkg/Documentation/patches/BaseTools-armgcc_build_rule_template.patch @@ -0,0 +1,31 @@ +Index: BaseTools/Conf/build_rule.template +=================================================================== +--- BaseTools/Conf/build_rule.template (revision 11724) ++++ BaseTools/Conf/build_rule.template (working copy) +@@ -242,7 +242,7 @@ + "$(OBJCOPY)" $(OBJCOPY_FLAGS) ${dst} + + +- "$(DLINK)" -o ${dst} $(DLINK_FLAGS) -( $(DLINK_SPATH) $(STATIC_LIBRARY_FILES) -) $(DLINK2_FLAGS) ++ "$(DLINK)" -o ${dst} $(DLINK_FLAGS) -\( $(DLINK_SPATH) $(STATIC_LIBRARY_FILES) -\) $(DLINK2_FLAGS) + + + "$(DLINK)" $(DLINK_FLAGS) -o ${dst} $(DLINK_SPATH) --via $(STATIC_LIBRARY_FILES_LIST) $(DLINK2_FLAGS) +@@ -272,7 +272,7 @@ + "$(DLINK)" $(DLINK_FLAGS) -\( $(DLINK_SPATH) @$(STATIC_LIBRARY_FILES_LIST) -\) $(DLINK2_FLAGS) + + +- "$(DLINK)" $(DLINK_FLAGS) -( $(DLINK_SPATH) $(STATIC_LIBRARY_FILES) -) $(DLINK2_FLAGS) ++ "$(DLINK)" $(DLINK_FLAGS) -\( $(DLINK_SPATH) $(STATIC_LIBRARY_FILES) -\) $(DLINK2_FLAGS) + + + "$(DLINK)" $(DLINK_FLAGS) -o ${dst} $(DLINK_SPATH) --via $(STATIC_LIBRARY_FILES_LIST) $(DLINK2_FLAGS) +@@ -425,7 +425,7 @@ + "$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i + Trim --source-code -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.i + "$(ASM)" -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj $(ASM_FLAGS) $(INC) ${d_path}(+)${s_base}.iii +- "$(DLINK)" -o ${dst} $(DLINK_FLAGS) -( $(DLINK_SPATH) $(LIBS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj -) ++ "$(DLINK)" -o ${dst} $(DLINK_FLAGS) -\( $(DLINK_SPATH) $(LIBS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj -\) + + + "$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i