[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v1 5/5] hw/arm: Add the Netduino Plus 2
From: |
Alistair Francis |
Subject: |
Re: [Qemu-devel] [PATCH v1 5/5] hw/arm: Add the Netduino Plus 2 |
Date: |
Tue, 30 Apr 2019 13:27:15 -0700 |
On Tue, Apr 30, 2019 at 9:02 AM Peter Maydell <address@hidden> wrote:
>
> On Mon, 29 Apr 2019 at 06:39, Alistair Francis <address@hidden> wrote:
> >
> > Signed-off-by: Alistair Francis <address@hidden>
> > ---
> > 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().
The reset code allows the machine to work with the -kernel option.
Without the reset override using -kernel results in the guest starting
at the wrong address. We can use the -device loader option without the
reset code though.
I don't have examples infront of me, I can run it when I'm home and
include the addresses if you want.
Alistair
>
> thanks
> -- PMM