generic-loader.txt 4.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. Copyright (c) 2016 Xilinx Inc.
  2. This work is licensed under the terms of the GNU GPL, version 2 or later. See
  3. the COPYING file in the top-level directory.
  4. The 'loader' device allows the user to load multiple images or values into
  5. QEMU at startup.
  6. Loading Data into Memory Values
  7. -------------------------------
  8. The loader device allows memory values to be set from the command line. This
  9. can be done by following the syntax below:
  10. -device loader,addr=<addr>,data=<data>,data-len=<data-len>
  11. [,data-be=<data-be>][,cpu-num=<cpu-num>]
  12. <addr> - The address to store the data in.
  13. <data> - The value to be written to the address. The maximum size of
  14. the data is 8 bytes.
  15. <data-len> - The length of the data in bytes. This argument must be
  16. included if the data argument is.
  17. <data-be> - Set to true if the data to be stored on the guest should be
  18. written as big endian data. The default is to write little
  19. endian data.
  20. <cpu-num> - The number of the CPU's address space where the data should
  21. be loaded. If not specified the address space of the first
  22. CPU is used.
  23. All values are parsed using the standard QemuOps parsing. This allows the user
  24. to specify any values in any format supported. By default the values
  25. will be parsed as decimal. To use hex values the user should prefix the number
  26. with a '0x'.
  27. An example of loading value 0x8000000e to address 0xfd1a0104 is:
  28. -device loader,addr=0xfd1a0104,data=0x8000000e,data-len=4
  29. Setting a CPU's Program Counter
  30. -------------------------------
  31. The loader device allows the CPU's PC to be set from the command line. This
  32. can be done by following the syntax below:
  33. -device loader,addr=<addr>,cpu-num=<cpu-num>
  34. <addr> - The value to use as the CPU's PC.
  35. <cpu-num> - The number of the CPU whose PC should be set to the
  36. specified value.
  37. All values are parsed using the standard QemuOps parsing. This allows the user
  38. to specify any values in any format supported. By default the values
  39. will be parsed as decimal. To use hex values the user should prefix the number
  40. with a '0x'.
  41. An example of setting CPU 0's PC to 0x8000 is:
  42. -device loader,addr=0x8000,cpu-num=0
  43. Loading Files
  44. -------------
  45. The loader device also allows files to be loaded into memory. It can load ELF,
  46. U-Boot, and Intel HEX executable formats as well as raw images. The syntax is
  47. shown below:
  48. -device loader,file=<file>[,addr=<addr>][,cpu-num=<cpu-num>][,force-raw=<raw>]
  49. <file> - A file to be loaded into memory
  50. <addr> - The memory address where the file should be loaded. This is
  51. required for raw images and ignored for non-raw files.
  52. <cpu-num> - This specifies the CPU that should be used. This is an
  53. optional argument and will cause the CPU's PC to be set to
  54. the memory address where the raw file is loaded or the entry
  55. point specified in the executable format header. This option
  56. should only be used for the boot image.
  57. This will also cause the image to be written to the specified
  58. CPU's address space. If not specified, the default is CPU 0.
  59. <force-raw> - Setting force-raw=on forces the file to be treated as a raw
  60. image. This can be used to load supported executable formats
  61. as if they were raw.
  62. All values are parsed using the standard QemuOps parsing. This allows the user
  63. to specify any values in any format supported. By default the values
  64. will be parsed as decimal. To use hex values the user should prefix the number
  65. with a '0x'.
  66. An example of loading an ELF file which CPU0 will boot is shown below:
  67. -device loader,file=./images/boot.elf,cpu-num=0
  68. Restrictions and ToDos
  69. ----------------------
  70. - At the moment it is just assumed that if you specify a cpu-num then you
  71. want to set the PC as well. This might not always be the case. In future
  72. the internal state 'set_pc' (which exists in the generic loader now) should
  73. be exposed to the user so that they can choose if the PC is set or not.