On Mon, 29 Apr 2019 at 06:39, Alistair Francis <alist...@alistair23.me> wrote: > > Signed-off-by: Alistair Francis <alist...@alistair23.me> > --- > MAINTAINERS | 6 +++ > default-configs/arm-softmmu.mak | 1 + > hw/arm/Kconfig | 3 ++ > hw/arm/Makefile.objs | 1 + > hw/arm/netduinoplus2.c | 77 +++++++++++++++++++++++++++++++++ > 5 files changed, 88 insertions(+) > create mode 100644 hw/arm/netduinoplus2.c >
> +typedef struct ARMV7MResetArgs { > + ARMCPU *cpu; > + uint32_t reset_sp; > + uint32_t reset_pc; > +} ARMV7MResetArgs; > + > +static void armv7m_reset(void *opaque) > +{ > + ARMV7MResetArgs *args = opaque; > + > + cpu_reset(CPU(args->cpu)); > + > + args->cpu->env.regs[13] = args->reset_sp & 0xFFFFFFFC; > + args->cpu->env.thumb = args->reset_pc & 1; > + args->cpu->env.regs[15] = args->reset_pc & ~1; > +} > + > +static void netduinoplus2_init(MachineState *machine) > +{ > + DeviceState *dev; > + ARMV7MResetArgs reset_args; > + uint64_t entry; > + > + dev = qdev_create(NULL, TYPE_STM32F405_SOC); > + qdev_prop_set_string(dev, "cpu-type", ARM_CPU_TYPE_NAME("cortex-m4")); > + object_property_set_bool(OBJECT(dev), true, "realized", &error_fatal); > + > + armv7m_load_kernel(ARM_CPU(first_cpu), machine->kernel_filename, > + FLASH_SIZE, &entry); > + > + reset_args = (ARMV7MResetArgs) { > + .cpu = ARM_CPU(first_cpu), > + .reset_pc = entry, > + .reset_sp = (SRAM_BASE_ADDRESS + (SRAM_SIZE * 2) / 3), > + }; > + qemu_register_reset(armv7m_reset, > + g_memdup(&reset_args, sizeof(reset_args))); > +} Can you explain the purpose of the reset code? None of the other v7m boards seem to need to do a manual qemu_register_reset(). thanks -- PMM