This patch adds support for a "dummy" ARMv7-M board so that QEMU can be used as an ISS for ARMv7-M processors. For example, running an image compiled for the Cortex-M3 with -cpu cortex-m3 should just work.
Signed-off-by: Meador Inge <mead...@codesourcery.com> --- hw/arm/Makefile.objs | 1 + hw/dummy_armv7m.c | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 0 deletions(-) create mode 100644 hw/dummy_armv7m.c diff --git a/hw/arm/Makefile.objs b/hw/arm/Makefile.objs index 2b39fb3..ba3811f 100644 --- a/hw/arm/Makefile.objs +++ b/hw/arm/Makefile.objs @@ -9,6 +9,7 @@ obj-y += exynos4210_pmu.o exynos4210_mct.o exynos4210_fimd.o obj-y += exynos4210_rtc.o exynos4210_i2c.o obj-y += arm_mptimer.o a15mpcore.o obj-y += armv7m.o armv7m_nvic.o stellaris.o stellaris_enet.o +obj-y += dummy_armv7m.o obj-y += highbank.o obj-y += pxa2xx.o pxa2xx_pic.o pxa2xx_gpio.o pxa2xx_timer.o pxa2xx_dma.o obj-y += pxa2xx_lcd.o pxa2xx_mmci.o pxa2xx_pcmcia.o pxa2xx_keypad.o diff --git a/hw/dummy_armv7m.c b/hw/dummy_armv7m.c new file mode 100644 index 0000000..0a6c922 --- /dev/null +++ b/hw/dummy_armv7m.c @@ -0,0 +1,40 @@ +/* + * Dummy board with just RAM and CPU for use as an ISS. + * + * Copyright (c) 2012 Mentor Graphics. + * Written by Meador Inge + * + * This code is licensed under the GPL. + */ + +#include "arm-misc.h" +#include "boards.h" +#include "exec-memory.h" + +static void dummy_armv7m_init(ram_addr_t ram_size, + const char *boot_device, + const char *kernel_filename, + const char *kernel_cmdline, + const char *initrd_filename, + const char *cpu_model) +{ + + MemoryRegion *address_space_mem = get_system_memory(); + + (void) armv7m_init(address_space_mem, + 64, ram_size / 1024, kernel_filename, cpu_model); +} + +static QEMUMachine dummy_armv7m_machine = { + .name = "dummy_armv7m", + .desc = "Dummy ARMv7-M", + .init = dummy_armv7m_init, + .default_for_cpu_model = "cortex-m3", +}; + +static void dummy_armv7m_machine_init(void) +{ + qemu_register_machine(&dummy_armv7m_machine); +} + +machine_init(dummy_armv7m_machine_init); -- 1.7.7.6