diff options
author | Su Hang <suhang16@mails.ucas.ac.cn> | 2018-08-16 14:05:28 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2018-08-16 14:05:28 +0100 |
commit | e4a25ed91947af1ec87f23725de4ac86a3353b48 (patch) | |
tree | 8cabeb941c80b107ac7bd612d322b65a39cab54a /hw/core/generic-loader.c | |
parent | e2336043cc40eafc302c5ea8fa1d5c01438c06bb (diff) |
loader: Implement .hex file loader
This patch adds Intel Hexadecimal Object File format support to the
generic loader device. The file format specification is available here:
http://www.piclist.com/techref/fileext/hex/intel.htm
This file format is often used with microcontrollers such as the
micro:bit, Arduino, STM32, etc. Users expect to be able to run .hex
files directly with without first converting them to ELF. Most
micro:bit code is developed in web-based IDEs without direct user access
to binutils so it is important for QEMU to handle this file format
natively.
Signed-off-by: Su Hang <suhang16@mails.ucas.ac.cn>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Acked-by: Alistair Francis <alistair.francis@wdc.com>
Message-id: 20180814162739.11814-6-stefanha@redhat.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/core/generic-loader.c')
-rw-r--r-- | hw/core/generic-loader.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/hw/core/generic-loader.c b/hw/core/generic-loader.c index cb0e68486d..fde32cbda1 100644 --- a/hw/core/generic-loader.c +++ b/hw/core/generic-loader.c @@ -147,6 +147,10 @@ static void generic_loader_realize(DeviceState *dev, Error **errp) size = load_uimage_as(s->file, &entry, NULL, NULL, NULL, NULL, as); } + + if (size < 0) { + size = load_targphys_hex_as(s->file, &entry, as); + } } if (size < 0 || s->force_raw) { |