hw/misc: Add the STM32F4xx Sysconfig device
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/5 hw/misc: Add the STM32F4xx Sysconfig device
--- default-configs/arm-softmmu.mak | 1 + hw/misc/Kconfig | 3 + hw/misc/Makefile.objs | 1 + hw/misc/stm32f4xx_syscfg.c | 168 +++++++++++++++++++++++++++++ hw/misc/trace-events | 6 ++ include/hw/misc/stm32f4xx_syscfg.h | 61 +++++++++++ 6 files changed, 240 insertions(+) create mode 100644 hw/misc/stm32f4xx_syscfg.c create mode 100644 include/hw/misc/stm32f4xx_syscfg.h
default-configs/arm-softmmu.mak +1 -0
@@ -96,6 +96,7 @@ CONFIG_STM32F2XX_SYSCFG=y CONFIG_STM32F2XX_ADC=y CONFIG_STM32F2XX_SPI=y CONFIG_STM32F205_SOC=y +CONFIG_STM32F4XX_SYSCFG=y CONFIG_NRF51_SOC=y CONFIG_CMSDK_APB_TIMER=y
hw/misc/Kconfig +3 -0
@@ -80,6 +80,9 @@ config IMX config STM32F2XX_SYSCFG bool +config STM32F4XX_SYSCFG + bool + config MIPS_ITU bool
hw/misc/Makefile.objs +1 -0
@@ -57,6 +57,7 @@ obj-$(CONFIG_SLAVIO) += slavio_misc.o obj-$(CONFIG_ZYNQ) += zynq_slcr.o obj-$(CONFIG_ZYNQ) += zynq-xadc.o obj-$(CONFIG_STM32F2XX_SYSCFG) += stm32f2xx_syscfg.o +obj-$(CONFIG_STM32F4XX_SYSCFG) += stm32f4xx_syscfg.o obj-$(CONFIG_MIPS_CPS) += mips_cmgcr.o obj-$(CONFIG_MIPS_CPS) += mips_cpc.o obj-$(CONFIG_MIPS_ITU) += mips_itu.o
hw/misc/stm32f4xx_syscfg.c new file +168 -0
168 lines not on this page · raw message
hw/misc/trace-events +6 -0
@@ -84,6 +84,12 @@ mos6522_set_sr_int(void) "set sr_int" mos6522_write(uint64_t addr, uint64_t val) "reg=0x%"PRIx64 " val=0x%"PRIx64 mos6522_read(uint64_t addr, unsigned val) "reg=0x%"PRIx64 " val=0x%x" +# stm32f4xx_syscfg +stm32f4xx_syscfg_set_irq(int gpio, int line, int level) "Interupt: GPIO: %d, Line: %d; Level: %d" +stm32f4xx_pulse_exti(int irq) "Pulse EXTI: %d" +stm32f4xx_syscfg_read(uint64_t addr) "reg read: addr: 0x%" PRIx64 " " +stm32f4xx_syscfg_write(uint64_t addr, uint64_t data) "reg write: addr: 0x%" PRIx64 " val: 0x%" PRIx64 "" + # tz-mpc.c tz_mpc_reg_read(uint32_t offset, uint64_t data, unsigned size) "TZ MPC regs read: offset 0x%x data 0x%" PRIx64 " size %u" tz_mpc_reg_write(uint32_t offset, uint64_t data, unsigned size) "TZ MPC regs write: offset 0x%x data 0x%" PRIx64 " size %u"
include/hw/misc/stm32f4xx_syscfg.h new file +61 -0
61 lines not on this page · raw message
Signature · 1 line
2.21.0
hw/misc/stm32f4xx_syscfg.c line 48
Quoted 9 lines · Alistair Francis
Signed-off-by Alistair Francis <[email protected]>hw/misc/stm32f4xx_syscfg.c new file +6
-0+static void stm32f4xx_syscfg_set_irq (void *opaque,int irq,int level) +{ +STM32F4xxSyscfgState *s = opaque; +int icrreg = irq /4 ; +int startbit = (irq &3 ) *4 ; +uint8_t config = config = irq /16 ;;
Stray double-semicolon.
Otherwise
thanks
-- PMM
PATCH 2/5 hw/misc: Add the STM32F4xx EXTI device
In reply to a message not in the archive--- default-configs/arm-softmmu.mak | 1 + hw/misc/Kconfig | 3 + hw/misc/Makefile.objs | 1 + hw/misc/stm32f4xx_exti.c | 187 +++++++++++++++++++++++++++++++ hw/misc/trace-events | 5 + include/hw/misc/stm32f4xx_exti.h | 60 ++++++++++ 6 files changed, 257 insertions(+) create mode 100644 hw/misc/stm32f4xx_exti.c create mode 100644 include/hw/misc/stm32f4xx_exti.h
default-configs/arm-softmmu.mak +1 -0
@@ -97,6 +97,7 @@ CONFIG_STM32F2XX_ADC=y CONFIG_STM32F2XX_SPI=y CONFIG_STM32F205_SOC=y CONFIG_STM32F4XX_SYSCFG=y +CONFIG_STM32F4XX_EXTI=y CONFIG_NRF51_SOC=y CONFIG_CMSDK_APB_TIMER=y
hw/misc/Kconfig +3 -0
@@ -83,6 +83,9 @@ config STM32F2XX_SYSCFG config STM32F4XX_SYSCFG bool +config STM32F4XX_EXTI + bool + config MIPS_ITU bool
hw/misc/Makefile.objs +1 -0
@@ -58,6 +58,7 @@ obj-$(CONFIG_ZYNQ) += zynq_slcr.o obj-$(CONFIG_ZYNQ) += zynq-xadc.o obj-$(CONFIG_STM32F2XX_SYSCFG) += stm32f2xx_syscfg.o obj-$(CONFIG_STM32F4XX_SYSCFG) += stm32f4xx_syscfg.o +obj-$(CONFIG_STM32F4XX_EXTI) += stm32f4xx_exti.o obj-$(CONFIG_MIPS_CPS) += mips_cmgcr.o obj-$(CONFIG_MIPS_CPS) += mips_cpc.o obj-$(CONFIG_MIPS_ITU) += mips_itu.o
hw/misc/stm32f4xx_exti.c new file +187 -0
187 lines not on this page · raw message
hw/misc/trace-events +5 -0
@@ -90,6 +90,11 @@ stm32f4xx_pulse_exti(int irq) "Pulse EXTI: %d" stm32f4xx_syscfg_read(uint64_t addr) "reg read: addr: 0x%" PRIx64 " " stm32f4xx_syscfg_write(uint64_t addr, uint64_t data) "reg write: addr: 0x%" PRIx64 " val: 0x%" PRIx64 "" +# stm32f4xx_exti +stm32f4xx_exti_set_irq(int irq, int leve) "Set EXTI: %d to %d" +stm32f4xx_exti_read(uint64_t addr) "reg read: addr: 0x%" PRIx64 " " +stm32f4xx_exti_write(uint64_t addr, uint64_t data) "reg write: addr: 0x%" PRIx64 " val: 0x%" PRIx64 "" + # tz-mpc.c tz_mpc_reg_read(uint32_t offset, uint64_t data, unsigned size) "TZ MPC regs read: offset 0x%x data 0x%" PRIx64 " size %u" tz_mpc_reg_write(uint32_t offset, uint64_t data, unsigned size) "TZ MPC regs write: offset 0x%x data 0x%" PRIx64 " size %u"
include/hw/misc/stm32f4xx_exti.h new file +60 -0
60 lines not on this page · raw message
Signature · 1 line
2.21.0
Re: [Qemu-devel] [PATCH v1 2/5] hw/misc: Add the STM32F4xx EXTI device
Quoted 3 lines · Alistair Francis
Signed-off-by Alistair Francis <[email protected]>---
thanks
-- PMM
PATCH 3/5 armv7m: Allow entry information to be returned
In reply to a message not in the archiveAllow the kernel's entry point information to be returned when loading a kernel.
--- hw/arm/armv7m.c | 4 +++- include/hw/arm/arm.h | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-)
hw/arm/armv7m.c +3 -1
@@ -286,7 +286,7 @@ static void armv7m_reset(void *opaque)cpu_reset (CPU (cpu)); } -void armv7m_load_kernel (ARMCPU *cpu,const char *kernel_filename,int mem_size) +uint64_t armv7m_load_kernel (ARMCPU *cpu,const char *kernel_filename,int mem_size) {int image_size;uint64_t entry;
@@ -333,6 +333,8 @@ void armv7m_load_kernel(ARMCPU *cpu, const char *kernel_filename, int mem_size)* board must call this function! */ qemu_register_reset (armv7m_reset, cpu); + +return entry; }static Property bitband_properties[] = {
include/hw/arm/arm.h +3 -1
@@ -29,11 +29,13 @@ typedef enum {* @kernel_filename: file to load * @mem_size: mem_size: maximum image size to load * +* returns: location of the kernel's entry point +* * Load the guest image for an ARMv7M system. This must be called by * any ARMv7M board. (This is necessary to ensure that the CPU resets * correctly on system reset, as well as for kernel loading.) */ -void armv7m_load_kernel (ARMCPU *cpu,const char *kernel_filename,int mem_size); +uint64_t armv7m_load_kernel (ARMCPU *cpu,const char *kernel_filename,int mem_size);/* arm_boot.c */ struct arm_boot_info {
Signature · 1 line
2.21.0
PATCH 4/5 hw/arm: Add the STM32F4xx SoC
In reply to a message not in the archive--- MAINTAINERS | 8 + default-configs/arm-softmmu.mak | 1 + hw/arm/Kconfig | 3 + hw/arm/Makefile.objs | 1 + hw/arm/stm32f405_soc.c | 306 ++++++++++++++++++++++++++++++++ include/hw/arm/stm32f405_soc.h | 74 ++++++++ 6 files changed, 393 insertions(+) create mode 100644 hw/arm/stm32f405_soc.c create mode 100644 include/hw/arm/stm32f405_soc.h
MAINTAINERS +8 -0
@@ -810,6 +810,14 @@ F: hw/adc/* F: hw/ssi/stm32f2xx_spi.c F: include/hw/*/stm32*.h +STM32F405 +M: Alistair Francis <[email protected]> +M: Peter Maydell <[email protected]> +S: Maintained +F: hw/arm/stm32f405_soc.c +F: hw/misc/stm32f4xx_syscfg.c +F: hw/misc/stm32f4xx_exti.c + Netduino 2 M: Alistair Francis <[email protected]> M: Peter Maydell <[email protected]>
default-configs/arm-softmmu.mak +1 -0
@@ -98,6 +98,7 @@ CONFIG_STM32F2XX_SPI=y CONFIG_STM32F205_SOC=y CONFIG_STM32F4XX_SYSCFG=y CONFIG_STM32F4XX_EXTI=y +CONFIG_STM32F405_SOC=y CONFIG_NRF51_SOC=y CONFIG_CMSDK_APB_TIMER=y
hw/arm/Kconfig +3 -0
@@ -62,6 +62,9 @@ config RASPI config STM32F205_SOC bool +config STM32F405_SOC + bool + config XLNX_ZYNQMP_ARM bool
hw/arm/Makefile.objs +1 -0
@@ -26,6 +26,7 @@ obj-$(CONFIG_STRONGARM) += strongarm.o obj-$(CONFIG_ALLWINNER_A10) += allwinner-a10.o cubieboard.o obj-$(CONFIG_RASPI) += bcm2835_peripherals.o bcm2836.o raspi.o obj-$(CONFIG_STM32F205_SOC) += stm32f205_soc.o +obj-$(CONFIG_STM32F405_SOC) += stm32f405_soc.o obj-$(CONFIG_XLNX_ZYNQMP_ARM) += xlnx-zynqmp.o xlnx-zcu102.o obj-$(CONFIG_XLNX_VERSAL) += xlnx-versal.o xlnx-versal-virt.o obj-$(CONFIG_FSL_IMX25) += fsl-imx25.o imx25_pdk.o
hw/arm/stm32f405_soc.c new file +306 -0
306 lines not on this page · raw message
include/hw/arm/stm32f405_soc.h new file +74 -0
74 lines not on this page · raw message
Signature · 1 line
2.21.0
Re: [Qemu-devel] [PATCH v1 4/5] hw/arm: Add the STM32F4xx SoC
Quoted 16 lines · Alistair Francis
Signed-off-by Alistair Francis <[email protected]>--- MAINTAINERS | 8 + default-configs/arm-softmmu.mak | 1 + hw/arm/Kconfig | 3 + hw/arm/Makefile.objs | 1 + hw/arm/stm32f405_soc.c | 306 ++++++++++++++++++++++++++++++++ include/hw/arm/stm32f405_soc.h | 74 ++++++++ 6 files changed, 393 insertions(+) create mode 100644 hw/arm/stm32f405_soc.c create mode 100644 include/hw/arm/stm32f405_soc.hhw/arm/stm32f405_soc.c new file +2
-0+static void stm32f405_soc_realize (DeviceState *dev_soc,Error **errp) +{
hw/arm/stm32f405_soc.c line 100
Quoted 10 lines
hw/arm/stm32f405_soc.c new file +10
-0+STM32F405State *s =STM32F405_SOC (dev_soc); +DeviceState *dev, *armv7m; +SysBusDevice *busdev; +Error *err =NULL ; +int i; + + s->system_memory =get_system_memory (); + s->sram =g_new (MemoryRegion,1 ); + s->flash =g_new (MemoryRegion,1 ); + s->flash_alias =g_new (MemoryRegion,1 );
What I meant by my comment on v1 was that rather than doing g_new() here you can just have the STM32F405State struct have
MemoryRegion sram;
MemoryRegion flash;
etc
and then instead of
memory_region_init_ram(s->flash, ...)
you use
memory_region_init_ram(&s->flash, ...)
etc
which avoids doing separate memory allocations (which would need to be freed if you then do an error-exit from the realize function, I think).
And you don't need to have an s->system_memory -- that can just be a local variable, because it's just caching the pointer to the global system memory MemoryRegion.
Otherwise
thanks
-- PMM
PATCH 5/5 hw/arm: Add the Netduino Plus 2
In reply to a message not in the archive--- 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
MAINTAINERS +6 -0
@@ -824,6 +824,12 @@ M: Peter Maydell <[email protected]> S: Maintained F: hw/arm/netduino2.c +Netduino Plus 2 +M: Alistair Francis <[email protected]> +M: Peter Maydell <[email protected]> +S: Maintained +F: hw/arm/netduinoplus2.c + SmartFusion2 M: Subbaraya Sundeep <[email protected]> M: Peter Maydell <[email protected]>
default-configs/arm-softmmu.mak +1 -0
@@ -46,6 +46,7 @@ CONFIG_A15MPCORE=y CONFIG_ARM_V7M=y CONFIG_NETDUINO2=y +CONFIG_NETDUINOPLUS2=y CONFIG_ARM_GIC=y CONFIG_ARM_TIMER=y
hw/arm/Kconfig +3 -0
@@ -26,6 +26,9 @@ config MUSICPAL config NETDUINO2 bool +config NETDUINOPLUS2 + bool + config NSERIES bool
hw/arm/Makefile.objs +1 -0
@@ -8,6 +8,7 @@ obj-$(CONFIG_INTEGRATOR) += integratorcp.o obj-$(CONFIG_MAINSTONE) += mainstone.o obj-$(CONFIG_MUSICPAL) += musicpal.o obj-$(CONFIG_NETDUINO2) += netduino2.o +obj-$(CONFIG_NETDUINOPLUS2) += netduinoplus2.o obj-$(CONFIG_NSERIES) += nseries.o obj-$(CONFIG_OMAP) += omap_sx1.o palm.o obj-$(CONFIG_PXA2XX) += gumstix.o spitz.o tosa.o z2.o
hw/arm/netduinoplus2.c new file +77 -0
77 lines not on this page · raw message
Signature · 1 line
2.21.0
Re: [Qemu-devel] [PATCH v1 5/5] hw/arm: Add the Netduino Plus 2
Quoted 22 lines · Alistair Francis
Signed-off-by Alistair Francis <[email protected]>--- 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.chw/arm/netduinoplus2.c new file +11
-0+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); + + entry = armv7m_load_kernel(ARM_CPU(first_cpu), machine->kernel_filename,
hw/arm/netduinoplus2.c line 69
Quoted 10 lines
hw/arm/netduinoplus2.c new file +10
-0+ FLASH_SIZE); + + 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))); +}
I still don't really like having this board interpret -kernel in a different way to all the other M-profile boards. I'd be much happier if it just behaved the same way the others do.
thanks
-- PMM