From e4a25ed91947af1ec87f23725de4ac86a3353b48 Mon Sep 17 00:00:00 2001 From: Su Hang Date: Thu, 16 Aug 2018 14:05:28 +0100 Subject: 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 Signed-off-by: Stefan Hajnoczi Acked-by: Alistair Francis Message-id: 20180814162739.11814-6-stefanha@redhat.com Signed-off-by: Peter Maydell --- include/hw/loader.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'include/hw/loader.h') diff --git a/include/hw/loader.h b/include/hw/loader.h index 5235f119a3..3c112975f4 100644 --- a/include/hw/loader.h +++ b/include/hw/loader.h @@ -28,6 +28,18 @@ ssize_t load_image_size(const char *filename, void *addr, size_t size); int load_image_targphys_as(const char *filename, hwaddr addr, uint64_t max_sz, AddressSpace *as); +/**load_targphys_hex_as: + * @filename: Path to the .hex file + * @entry: Store the entry point given by the .hex file + * @as: The AddressSpace to load the .hex file to. The value of + * address_space_memory is used if nothing is supplied here. + * + * Load a fixed .hex file into memory. + * + * Returns the size of the loaded .hex file on success, -1 otherwise. + */ +int load_targphys_hex_as(const char *filename, hwaddr *entry, AddressSpace *as); + /** load_image_targphys: * Same as load_image_targphys_as(), but doesn't allow the caller to specify * an AddressSpace. -- cgit v1.2.3