| 1 | .. |
| 2 | Copyright (c) 2016, Xilinx Inc. |
| 3 | |
| 4 | This work is licensed under the terms of the GNU GPL, version 2 or later. See |
| 5 | the COPYING file in the top-level directory. |
| 6 | |
| 7 | Generic Loader |
| 8 | -------------- |
| 9 | |
| 10 | The 'loader' device allows the user to load multiple images or values into |
| 11 | QEMU at startup. |
| 12 | |
| 13 | Loading Data into Memory Values |
| 14 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 15 | The loader device allows memory values to be set from the command line. This |
| 16 | can be done by following the syntax below:: |
| 17 | |
| 18 | -device loader,addr=<addr>,data=<data>,data-len=<data-len> \ |
| 19 | [,data-be=<data-be>][,cpu-num=<cpu-num>] |
| 20 | |
| 21 | ``<addr>`` |
| 22 | The address to store the data in. |
| 23 | |
| 24 | Note that as usual with QEMU numeric option values, the default is to |
| 25 | treat the argument as decimal. To specify a value in hex, prefix it |
| 26 | with '0x'. |
| 27 | |
| 28 | ``<data>`` |
| 29 | The value to be written to the address. The maximum size of the data |
| 30 | is 8 bytes. |
| 31 | |
| 32 | ``<data-len>`` |
| 33 | The length of the data in bytes. This argument must be included if |
| 34 | the data argument is. |
| 35 | |
| 36 | ``<data-be>`` |
| 37 | Set to true if the data to be stored on the guest should be written |
| 38 | as big endian data. The default is to write little endian data. |
| 39 | |
| 40 | ``<cpu-num>`` |
| 41 | The number of the CPU's address space where the data should be |
| 42 | loaded. If not specified the address space of the first CPU is used. |
| 43 | |
| 44 | |
| 45 | An example of loading value 0x8000000e to address 0xfd1a0104 is:: |
| 46 | |
| 47 | -device loader,addr=0xfd1a0104,data=0x8000000e,data-len=4 |
| 48 | |
| 49 | Setting a CPU's Program Counter |
| 50 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 51 | |
| 52 | The loader device allows the CPU's PC to be set from the command line. This |
| 53 | can be done by following the syntax below:: |
| 54 | |
| 55 | -device loader,addr=<addr>,cpu-num=<cpu-num> |
| 56 | |
| 57 | ``<addr>`` |
| 58 | The value to use as the CPU's PC. |
| 59 | |
| 60 | Note that as usual with QEMU numeric option values, the default is to |
| 61 | treat the argument as decimal. To specify a value in hex, prefix it |
| 62 | with '0x'. |
| 63 | |
| 64 | ``<cpu-num>`` |
| 65 | The number of the CPU whose PC should be set to the specified value. |
| 66 | |
| 67 | An example of setting CPU 0's PC to 0x8000 is:: |
| 68 | |
| 69 | -device loader,addr=0x8000,cpu-num=0 |
| 70 | |
| 71 | Loading Files |
| 72 | ^^^^^^^^^^^^^ |
| 73 | |
| 74 | The loader device also allows files to be loaded into memory. It can load ELF, |
| 75 | U-Boot, and Intel HEX executable formats as well as raw images. The syntax is |
| 76 | shown below: |
| 77 | |
| 78 | -device loader,file=<file>[,addr=<addr>][,cpu-num=<cpu-num>][,force-raw=<raw>] |
| 79 | |
| 80 | ``<file>`` |
| 81 | A file to be loaded into memory |
| 82 | |
| 83 | ``<addr>`` |
| 84 | The memory address where the file should be loaded. This is required |
| 85 | for raw images and ignored for non-raw files. |
| 86 | |
| 87 | Note that as usual with QEMU numeric option values, the default is to |
| 88 | treat the argument as decimal. To specify a value in hex, prefix it |
| 89 | with '0x'. |
| 90 | |
| 91 | ``<cpu-num>`` |
| 92 | This specifies the CPU that should be used. This is an |
| 93 | optional argument with two effects: |
| 94 | |
| 95 | * this CPU's address space is used to load the data |
| 96 | * this CPU's PC will be set to the address where the raw file is loaded |
| 97 | or the entry point specified in the executable format header |
| 98 | |
| 99 | If this option is not specified, then the data will be loaded via |
| 100 | the address space of the first CPU, and no CPU will have its PC set. |
| 101 | |
| 102 | Note that there is currently no way to specify the address space to |
| 103 | load the data without also causing that CPU's PC to be set. |
| 104 | |
| 105 | Since it sets the starting PC, this option should only be used for the boot |
| 106 | image. |
| 107 | |
| 108 | ``<force-raw>`` |
| 109 | Setting 'force-raw=on' forces the file to be treated as a raw image. |
| 110 | This can be used to load supported executable formats as if they |
| 111 | were raw. |
| 112 | |
| 113 | |
| 114 | An example of loading an ELF file which CPU0 will boot is shown below:: |
| 115 | |
| 116 | -device loader,file=./images/boot.elf,cpu-num=0 |