This readme explains how to install, setup and run the evaluation version of 
latest ARM fast models.


		ARM Fast Models Evaluation Installation Guidelines

The ARM tast models enable developers to generate Programmer's View virtual 
platforms, which are functionally accurate, fast, and scalable. These virtual
platforms enable the parallel development of software and hardware, and are 
fast enough to be used to test applications at close to real-time speeds. 

Please follow the steps below to install & setup ARM fast models on your 
Linux system:

  [1. Register with ARM Ltd. on www.arm.com if not already registered]

  [2. Login on www.arm.com]

  [3. Goto SUPPORT > Resources > Evaluation Products > Fast Models]

  [4. Get your evaluation license.dat and fast model .tgz]

  [5. Unpack fast model .tgz to <your_unpacked_fastmodel_tgz> directory]

  [6. Run <your_unpacked_fastmodel_tgz>/setup.bin and install all packages to <your_fastmodel_dir>]

  [7. Ensure execute permission for fast model environment setup script]
  # chmod +x <your_fastmodel_dir>/FastModelsTools_xxx/source_all.sh

  [8. Setup environment variable for fast model tools from your init scripts (e.g. ~/.bashrc)]
  # export ARMLMD_LICENSE_FILE=<path_to_your_license_dat>/license.dat
  # export PATH=<your_fastmodel_dir>/FastModelsTools_xxx/bin:$PATH
  # source <your_fastmodel_dir>/FastModelsTools_xxx/source_all.sh

  [9. Ensure commands mentioned in previous step are executed before proceeding]

  [10. Start system canvas tool to build required emulation model (lets assume Cortex-A15x1)]
  # sgcanvas

  [11. OPEN <your_fastmodel_dir>/FastModelsPortfolio_xxxx/examples/FVP_VE/Build_Cortex-A15x1/RTSM_VE_Cortex-A15x1.sgproj]

  [12. SELECT Integrated Simulator & Cadilibrary from PROJECT -> PROJECT SETTINGS -> PARAMETER CATEGORY -> TARGETS]

  [13. COMPILE (this will start system canvas build process)]
  (The output emulation model will be a shared library named as: 
   <your_fastmodel_dir>/FastModelsPortfolio_<xxxx>/examples/FVP_VE/Build_Cortex-A15x1/Linux-Debug-GCC-<yyyy>/cadi_system_Linux-Debug-GCC-<yyyy>.so
   OR
   <your_fastmodel_dir>/FastModelsPortfolio_<xxxx>/examples/FVP_VE/Build_Cortex-A15x1/Linux64-Debug-GCC-<yyyy>/cadi_system_Linux64-Debug-GCC-<yyyy>.so)

  (Note: replace all <> brackets based on your workspace)
  (Note: to build a different emulation model redo steps 10 to 13 and 
   select appropriate .sgproj file in step 11)
  (Note: the above steps may slightly differ for older versions of
   ARM fast models)


		ARM Fast Models Evaluation Running Guidelines

The ARM fast models can only load ELF files or Intel Hex files so, we will 
require a boot-wrapper which will act as bootloader + wrapper for booting 
Xvisor on fast models. 

The docs/arm/ directory in Xvisor source contains file fast_model_boot.S which
is an adapted version of the boot-wrapper provided by ARM Ltd. This updated
boot-wrapper (i.e. fast_model_boot.S) can be compiled for any TEXT_BASE and it
will include provided binary image (as -DIMAGE=<binary-image>) at location
TEXT_BASE+0x10000. Optionally, one can also provide a device-tree blob (dtb),
(as -DDTB=<path-to-dtb-file>) which gets included at location TEXT_BASE+0x1000.
As per the dtb-based boot flow for Linux and Xvisor, this dtb gets passsed as
third argument (in register r2) while jumping to input binary. Please note that
no fixup of the dtb is done by the boot-code.

As example, let us assume that we have a valid fast_model_boot.img in directory
<your_test_dir> which we want to boot on Cortex-A15x1 fast model built using
steps provided in previous section:

  [1. Build environment for boot-wrapper]
  # cd <your_test_dir>
  # CROSS_COMPILE=arm-linux-gnueabi-

  [2. Compile boot-wrapper]
  # ${CROSS_COMPILE}gcc -nostdlib -march=armv7ve -mcpu=cortex-a15 -e start_boot -Wl,--build-id=none -Wl,-Ttext=0x80000000 -DSPIN_LOOP_ADDR=0x14000000 -DVEXPRESS_A15 -DIMAGE=fast_model_boot.img <xvisor_source_directory>/docs/arm/fast_model_boot.S -o fast_model_boot.axf
  OR
  # ${CROSS_COMPILE}gcc -nostdlib -march=armv7ve -mcpu=cortex-a15 -e start_boot -Wl,--build-id=none -Wl,-Ttext=0x80000000 -DSPIN_LOOP_ADDR=0x14000000 -DVEXPRESS_A15 -DIMAGE=fast_model_boot.img -DDTB=device-tree.dtb <xvisor_source_directory>/docs/arm/fast_model_boot.S -o fast_model_boot.axf

  [3. Run fast models]
  # model_shell <your_fastmodel_dir>/FastModelsPortfolio_<xxxx>/examples/FVP_VE/Build_Cortex-A15x1/Linux-Debug-GCC-<yyyy>/cadi_system_Linux-Debug-GCC-<yyyy>.so fast_model_boot.axf
  OR
  # model_shell64 <your_fastmodel_dir>/FastModelsPortfolio_<xxxx>/examples/FVP_VE/Build_Cortex-A15x1/Linux64-Debug-GCC-<yyyy>/cadi_system_Linux64-Debug-GCC-<yyyy>.so fast_model_boot.axf

  (Note: replace all <> brackets based on your workspace)

