Skip to contentSkip to conversation

Netduino 2 Machine Model

PATCH Applied Alistair Francis 3 participants 12 messages Feb 17, 2015 – Mar 10, 2015 Arm STM32

lore
Share & tools
lore
#0 lore raw

v11 cover Netduino 2 Machine Model

This patch series adds the Netduino 2 Machine to QEMU

Information on the board is avalible at:
http://www.netduino.com/netduino2/specs.htm

The git tree can be found at:
https://github.com/alistair23/qemu/tree/netduino2.11

Some example code that runs on QEMU is avaliable at:
at: https://github.com/alistair23/CSSE3010-QEMU-Examples

There are more devices in the works, I figured I would just start with these three

V11:
- Include/header fixes
- Make the CPU model a property for the SoC
V9/V10:
- Correct timer device based on Peter C's comments
V8:
- Update the timer device based on Peter C's comments
- Update the USART device based on Peter C's comments
V7:
- Rebase to QEMU 2.2
V6:
- Rename the three devices to STM32FXX*
- Correct the timer to use ns
- Correct the number of devices that are inited
- Rename memory regions

Alistair Francis (5):
stm32f2xx_timer: Add the stm32f2xx Timer
stm32f2xx_USART: Add the stm32f2xx USART Controller
stm32f2xx_SYSCFG: Add the stm32f2xx SYSCFG
stm32f205: Add the stm32f205 SoC
netduino2: Add the Netduino 2 Machine

 default-configs/arm-softmmu.mak    |   4 +
 hw/arm/Makefile.objs               |   2 +
 hw/arm/netduino2.c                 |  57 +++++++
 hw/arm/stm32f205_soc.c             | 160 ++++++++++++++++++
 hw/char/Makefile.objs              |   1 +
 hw/char/stm32f2xx_usart.c          | 229 ++++++++++++++++++++++++++
 hw/misc/Makefile.objs              |   1 +
 hw/misc/stm32f2xx_syscfg.c         | 160 ++++++++++++++++++
 hw/timer/Makefile.objs             |   2 +
 hw/timer/stm32f2xx_timer.c         | 328 +++++++++++++++++++++++++++++++++++++
 include/hw/arm/stm32f205_soc.h     |  57 +++++++
 include/hw/char/stm32f2xx_usart.h  |  73 +++++++++
 include/hw/misc/stm32f2xx_syscfg.h |  61 +++++++
 include/hw/timer/stm32f2xx_timer.h | 101 ++++++++++++
 14 files changed, 1236 insertions(+)
 create mode 100644 hw/arm/netduino2.c
 create mode 100644 hw/arm/stm32f205_soc.c
 create mode 100644 hw/char/stm32f2xx_usart.c
 create mode 100644 hw/misc/stm32f2xx_syscfg.c
 create mode 100644 hw/timer/stm32f2xx_timer.c
 create mode 100644 include/hw/arm/stm32f205_soc.h
 create mode 100644 include/hw/char/stm32f2xx_usart.h
 create mode 100644 include/hw/misc/stm32f2xx_syscfg.h
 create mode 100644 include/hw/timer/stm32f2xx_timer.h
Signature · 1 line
2.1.0
#1 lore raw

PATCH v11 1/5 stm32f2xx_timer: Add the stm32f2xx Timer

This patch adds the stm32f2xx timers: TIM2, TIM3, TIM4 and TIM5 to QEMU.

---
V11:
- Tidy up the register write refresh code
V10:
- Correct the units based on a patch by Peter C
V9:
- Convert tick_offset to now be updated on more events
- This is similar to what I did with the ARM PCCNT regiseter
V8:
- Fix tick_offset to allow now to wrap around
- Remove the calls to get_ticks_per_sec()
- Pre-scale the guest visable time
V6:
- Rename to STM32F2XX
- Change the timer calculations to use ns
- Update the value to timer_mod to ensure it is in ns
- Account for reloadable/resetable timer
- Thanks to Peter C for pointing this out

 default-configs/arm-softmmu.mak    |   1 +
 hw/timer/Makefile.objs             |   2 +
 hw/timer/stm32f2xx_timer.c         | 328 +++++++++++++++++++++++++++++++++++++
 include/hw/timer/stm32f2xx_timer.h | 101 ++++++++++++
 4 files changed, 432 insertions(+)
 create mode 100644 hw/timer/stm32f2xx_timer.c
 create mode 100644 include/hw/timer/stm32f2xx_timer.h
default-configs/arm-softmmu.mak +1 -0
index 7671ee2..27697c3 100644
@@ -78,6 +78,7 @@ CONFIG_NSERIES=y
 CONFIG_REALVIEW=y
 CONFIG_ZAURUS=y
 CONFIG_ZYNQ=y
+CONFIG_STM32F2XX_TIMER=y
 
 CONFIG_VERSATILE_PCI=y
 CONFIG_VERSATILE_I2C=y
hw/timer/Makefile.objs +2 -0
index 2c86c3d..133bd0d 100644
@@ -31,3 +31,5 @@ obj-$(CONFIG_DIGIC) += digic-timer.o
 obj-$(CONFIG_MC146818RTC) += mc146818rtc.o
 
 obj-$(CONFIG_ALLWINNER_A10_PIT) += allwinner-a10-pit.o
+
+common-obj-$(CONFIG_STM32F2XX_TIMER) += stm32f2xx_timer.o
hw/timer/stm32f2xx_timer.c new file +328 -0

328 lines not on this page · raw message

include/hw/timer/stm32f2xx_timer.h new file +101 -0

101 lines not on this page · raw message

Signature · 1 line
2.1.0
#2 lore raw

PATCH v11 2/5 stm32f2xx_USART: Add the stm32f2xx USART Controller

In reply to Alistair Francis

This patch adds the stm32f2xx USART controller
(UART also uses the same controller).

---
V11:
- Update the header macros to only be included once
V8:
- Clear IRQ on reset
- Lower IRQ on data read/status clear
- Set IRQ if enabled while data is avaliable
V6:
- Rename to STM32F2XX
- Fix up unimplemented printing
- Add a qemu_chr_accept()

 default-configs/arm-softmmu.mak   |   1 +
 hw/char/Makefile.objs             |   1 +
 hw/char/stm32f2xx_usart.c         | 229 ++++++++++++++++++++++++++++++++++++++
 include/hw/char/stm32f2xx_usart.h |  73 ++++++++++++
 4 files changed, 304 insertions(+)
 create mode 100644 hw/char/stm32f2xx_usart.c
 create mode 100644 include/hw/char/stm32f2xx_usart.h
default-configs/arm-softmmu.mak +1 -0
index 27697c3..b28e662 100644
@@ -79,6 +79,7 @@ CONFIG_REALVIEW=y
 CONFIG_ZAURUS=y
 CONFIG_ZYNQ=y
 CONFIG_STM32F2XX_TIMER=y
+CONFIG_STM32F2XX_USART=y
 
 CONFIG_VERSATILE_PCI=y
 CONFIG_VERSATILE_I2C=y
hw/char/Makefile.objs +1 -0
index 317385d..5931cc8 100644
@@ -15,6 +15,7 @@ obj-$(CONFIG_OMAP) += omap_uart.o
 obj-$(CONFIG_SH4) += sh_serial.o
 obj-$(CONFIG_PSERIES) += spapr_vty.o
 obj-$(CONFIG_DIGIC) += digic-uart.o
+obj-$(CONFIG_STM32F2XX_USART) += stm32f2xx_usart.o
 
 common-obj-$(CONFIG_ETRAXFS) += etraxfs_ser.o
 common-obj-$(CONFIG_ISA_DEBUG) += debugcon.o
hw/char/stm32f2xx_usart.c new file +229 -0

229 lines not on this page · raw message

include/hw/char/stm32f2xx_usart.h new file +73 -0

73 lines not on this page · raw message

Signature · 1 line
2.1.0
#3 lore raw

PATCH v11 3/5 stm32f2xx_SYSCFG: Add the stm32f2xx SYSCFG

In reply to Alistair Francis

This patch adds the stm32f2xx System Configuration Controller. This is used to configure what memory is mapped at address 0 (although that is not supported) as well as configure how the EXTI interrupts work (also not supported at the moment).

This device is not required for basic examples, but more complex systems will require it (as well as the EXTI device)

---
V6:
- Rename to STM32F2XX
- Remove all casts from debug printing

 default-configs/arm-softmmu.mak    |   1 +
 hw/misc/Makefile.objs              |   1 +
 hw/misc/stm32f2xx_syscfg.c         | 160 +++++++++++++++++++++++++++++++++++++
 include/hw/misc/stm32f2xx_syscfg.h |  61 ++++++++++++++
 4 files changed, 223 insertions(+)
 create mode 100644 hw/misc/stm32f2xx_syscfg.c
 create mode 100644 include/hw/misc/stm32f2xx_syscfg.h
default-configs/arm-softmmu.mak +1 -0
index b28e662..dead36b 100644
@@ -80,6 +80,7 @@ CONFIG_ZAURUS=y
 CONFIG_ZYNQ=y
 CONFIG_STM32F2XX_TIMER=y
 CONFIG_STM32F2XX_USART=y
+CONFIG_STM32F2XX_SYSCFG=y
 
 CONFIG_VERSATILE_PCI=y
 CONFIG_VERSATILE_I2C=y
hw/misc/Makefile.objs +1 -0
index 029a56f..049c1a0 100644
@@ -38,6 +38,7 @@ obj-$(CONFIG_OMAP) += omap_sdrc.o
 obj-$(CONFIG_OMAP) += omap_tap.o
 obj-$(CONFIG_SLAVIO) += slavio_misc.o
 obj-$(CONFIG_ZYNQ) += zynq_slcr.o
+obj-$(CONFIG_STM32F2XX_SYSCFG) += stm32f2xx_syscfg.o
 
 obj-$(CONFIG_PVPANIC) += pvpanic.o
 obj-$(CONFIG_EDU) += edu.o
hw/misc/stm32f2xx_syscfg.c new file +160 -0

160 lines not on this page · raw message

include/hw/misc/stm32f2xx_syscfg.h new file +61 -0

61 lines not on this page · raw message

Signature · 1 line
2.1.0
#4 lore raw

PATCH v11 4/5 stm32f205: Add the stm32f205 SoC

In reply to Alistair Francis

This patch adds the stm32f205 SoC. This will be used by the Netduino 2 to create a machine.

---
V11:
- Update the headers to only include the required files
- Make the CPU Model a property that can be defined
V6:
- Correct the number of USART/UART devices
- Use macros to define how many devices are inited
- Update the memory regions name from netduino.* to STM32F205.*

 default-configs/arm-softmmu.mak |   1 +
 hw/arm/Makefile.objs            |   1 +
 hw/arm/stm32f205_soc.c          | 160 ++++++++++++++++++++++++++++++++++++++++
 include/hw/arm/stm32f205_soc.h  |  57 ++++++++++++++
 4 files changed, 219 insertions(+)
 create mode 100644 hw/arm/stm32f205_soc.c
 create mode 100644 include/hw/arm/stm32f205_soc.h
default-configs/arm-softmmu.mak +1 -0
index dead36b..c8e9ada 100644
@@ -81,6 +81,7 @@ CONFIG_ZYNQ=y
 CONFIG_STM32F2XX_TIMER=y
 CONFIG_STM32F2XX_USART=y
 CONFIG_STM32F2XX_SYSCFG=y
+CONFIG_STM32F205_SOC=y
 
 CONFIG_VERSATILE_PCI=y
 CONFIG_VERSATILE_I2C=y
hw/arm/Makefile.objs +1 -0
index 6088e53..9769317 100644
@@ -8,3 +8,4 @@ obj-y += armv7m.o exynos4210.o pxa2xx.o pxa2xx_gpio.o pxa2xx_pic.o
 obj-$(CONFIG_DIGIC) += digic.o
 obj-y += omap1.o omap2.o strongarm.o
 obj-$(CONFIG_ALLWINNER_A10) += allwinner-a10.o cubieboard.o
+obj-$(CONFIG_STM32F205_SOC) += stm32f205_soc.o
hw/arm/stm32f205_soc.c new file +160 -0

160 lines not on this page · raw message

include/hw/arm/stm32f205_soc.h new file +57 -0

57 lines not on this page · raw message

Signature · 1 line
2.1.0
#6 lore raw

PATCH v11 5/5 netduino2: Add the Netduino 2 Machine

In reply to Alistair Francis

This patch adds the Netduino 2 Machine.

This is a Cortex-M3 based machine. Information can be found at:
http://www.netduino.com/netduino2/specs.htm

---

 hw/arm/Makefile.objs |  1 +
 hw/arm/netduino2.c   | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 58 insertions(+)
 create mode 100644 hw/arm/netduino2.c
hw/arm/Makefile.objs +1 -0
index 9769317..2577f68 100644
@@ -3,6 +3,7 @@ obj-$(CONFIG_DIGIC) += digic_boards.o
 obj-y += integratorcp.o kzm.o mainstone.o musicpal.o nseries.o
 obj-y += omap_sx1.o palm.o realview.o spitz.o stellaris.o
 obj-y += tosa.o versatilepb.o vexpress.o virt.o xilinx_zynq.o z2.o
+obj-y += netduino2.o
 
 obj-y += armv7m.o exynos4210.o pxa2xx.o pxa2xx_gpio.o pxa2xx_pic.o
 obj-$(CONFIG_DIGIC) += digic.o
hw/arm/netduino2.c new file +57 -0

57 lines not on this page · raw message

Signature · 1 line
2.1.0
Reviewed-by on v11 4/5
#5 lore raw

Re: [Qemu-devel] [PATCH v11 4/5] stm32f205: Add the stm32f205 SoC

In reply to Alistair Francis
Quoted 4 lines · Alistair Francis

This patch adds the stm32f205 SoC. This will be used by the Netduino 2 to create a machine.

Quoted 272 lines

---
V11:
- Update the headers to only include the required files
- Make the CPU Model a property that can be defined
V6:
- Correct the number of USART/UART devices
- Use macros to define how many devices are inited
- Update the memory regions name from netduino.* to STM32F205.*

 default-configs/arm-softmmu.mak |   1 +
 hw/arm/Makefile.objs            |   1 +
 hw/arm/stm32f205_soc.c          | 160 ++++++++++++++++++++++++++++++++++++++++
 include/hw/arm/stm32f205_soc.h  |  57 ++++++++++++++
 4 files changed, 219 insertions(+)
 create mode 100644 hw/arm/stm32f205_soc.c
 create mode 100644 include/hw/arm/stm32f205_soc.h
default-configs/arm-softmmu.mak +1 -0
index dead36b..c8e9ada 100644
@@ -81,6 +81,7 @@ CONFIG_ZYNQ=y
 CONFIG_STM32F2XX_TIMER=y
 CONFIG_STM32F2XX_USART=y
 CONFIG_STM32F2XX_SYSCFG=y
+CONFIG_STM32F205_SOC=y
 
 CONFIG_VERSATILE_PCI=y
 CONFIG_VERSATILE_I2C=y
hw/arm/Makefile.objs +1 -0
index 6088e53..9769317 100644
@@ -8,3 +8,4 @@ obj-y += armv7m.o exynos4210.o pxa2xx.o pxa2xx_gpio.o pxa2xx_pic.o
 obj-$(CONFIG_DIGIC) += digic.o
 obj-y += omap1.o omap2.o strongarm.o
 obj-$(CONFIG_ALLWINNER_A10) += allwinner-a10.o cubieboard.o
+obj-$(CONFIG_STM32F205_SOC) += stm32f205_soc.o
hw/arm/stm32f205_soc.c new file +160 -0
new file mode 100644
index 0000000..0f3bdc7
@@ -0,0 +1,160 @@
+/*
+ * STM32F205 SoC
+ *
+ * Copyright (c) 2014 Alistair Francis <[email protected]>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include "hw/arm/arm.h"
+#include "exec/address-spaces.h"
+#include "hw/arm/stm32f205_soc.h"
+
+/* At the moment only Timer 2 to 5 are modelled */
+static const uint32_t timer_addr[STM_NUM_TIMERS] = { 0x40000000, 0x40000400,
+    0x40000800, 0x40000C00 };
+static const uint32_t usart_addr[STM_NUM_USARTS] = { 0x40011000, 0x40004400,
+    0x40004800, 0x40004C00, 0x40005000, 0x40011400 };
+
+static const int timer_irq[STM_NUM_TIMERS] = {28, 29, 30, 50};
+static const int usart_irq[STM_NUM_USARTS] = {37, 38, 39, 52, 53, 71};
+
+static void stm32f205_soc_initfn(Object *obj)
+{
+    STM32F205State *s = STM32F205_SOC(obj);
+    int i;
+
+    object_initialize(&s->syscfg, sizeof(s->syscfg), TYPE_STM32F2XX_SYSCFG);
+    qdev_set_parent_bus(DEVICE(&s->syscfg), sysbus_get_default());
+
+    for (i = 0; i < STM_NUM_USARTS; i++) {
+        object_initialize(&s->usart[i], sizeof(s->usart[i]),
+                          TYPE_STM32F2XX_USART);
+        qdev_set_parent_bus(DEVICE(&s->usart[i]), sysbus_get_default());
+    }
+
+    for (i = 0; i < STM_NUM_TIMERS; i++) {
+        object_initialize(&s->timer[i], sizeof(s->timer[i]),
+                          TYPE_STM32F2XX_TIMER);
+        qdev_set_parent_bus(DEVICE(&s->timer[i]), sysbus_get_default());
+    }
+}
+
+static void stm32f205_soc_realize(DeviceState *dev_soc, Error **errp)
+{
+    STM32F205State *s = STM32F205_SOC(dev_soc);
+    DeviceState *syscfgdev, *usartdev, *timerdev;
+    SysBusDevice *syscfgbusdev, *usartbusdev, *timerbusdev;
+    qemu_irq *pic;
+    Error *err = NULL;
+    int i;
+
+    MemoryRegion *system_memory = get_system_memory();
+    MemoryRegion *sram = g_new(MemoryRegion, 1);
+    MemoryRegion *flash = g_new(MemoryRegion, 1);
+    MemoryRegion *flash_alias = g_new(MemoryRegion, 1);
+
+    memory_region_init_ram(flash, NULL, "STM32F205.flash", FLASH_SIZE,
+                           &error_abort);
+    memory_region_init_alias(flash_alias, NULL, "STM32F205.flash.alias",
+                             flash, 0, FLASH_SIZE);
+
+    vmstate_register_ram_global(flash);
+
+    memory_region_set_readonly(flash, true);
+    memory_region_set_readonly(flash_alias, true);
+
+    memory_region_add_subregion(system_memory, FLASH_BASE_ADDRESS, flash);
+    memory_region_add_subregion(system_memory, 0, flash_alias);
+
+    memory_region_init_ram(sram, NULL, "STM32F205.sram", SRAM_SIZE,
+                           &error_abort);
+    vmstate_register_ram_global(sram);
+    memory_region_add_subregion(system_memory, SRAM_BASE_ADDRESS, sram);
+
+    pic = armv7m_init(get_system_memory(), FLASH_SIZE, 96,
+                      s->kernel_filename, s->cpu_model);
+
+    /* System configuration controller */
+    syscfgdev = DEVICE(&s->syscfg);
+    object_property_set_bool(OBJECT(&s->syscfg), true, "realized", &err);
+    if (err != NULL) {
+        error_propagate(errp, err);
+        return;
+    }
+    syscfgbusdev = SYS_BUS_DEVICE(syscfgdev);
+    sysbus_mmio_map(syscfgbusdev, 0, 0x40013800);
+    sysbus_connect_irq(syscfgbusdev, 0, pic[71]);
+
+    /* Attach UART (uses USART registers) and USART controllers */
+    for (i = 0; i < STM_NUM_USARTS; i++) {
+        usartdev = DEVICE(&(s->usart[i]));
+        object_property_set_bool(OBJECT(&s->usart[i]), true, "realized", &err);
+        if (err != NULL) {
+            error_propagate(errp, err);
+            return;
+        }
+        usartbusdev = SYS_BUS_DEVICE(usartdev);
+        sysbus_mmio_map(usartbusdev, 0, usart_addr[i]);
+        sysbus_connect_irq(usartbusdev, 0, pic[usart_irq[i]]);
+    }
+
+    /* Timer 2 to 5 */
+    for (i = 0; i < STM_NUM_TIMERS; i++) {
+        timerdev = DEVICE(&(s->timer[i]));
+        qdev_prop_set_uint64(timerdev, "clock-frequency", 1000000000);
+        object_property_set_bool(OBJECT(&s->timer[i]), true, "realized", &err);
+        if (err != NULL) {
+            error_propagate(errp, err);
+            return;
+        }
+        timerbusdev = SYS_BUS_DEVICE(timerdev);
+        sysbus_mmio_map(timerbusdev, 0, timer_addr[i]);
+        sysbus_connect_irq(timerbusdev, 0, pic[timer_irq[i]]);
+    }
+}
+
+static Property stm32f205_soc_properties[] = {
+    DEFINE_PROP_STRING("kernel-filename", STM32F205State, kernel_filename),
+    DEFINE_PROP_STRING("cpu-model", STM32F205State, cpu_model),
+    DEFINE_PROP_END_OF_LIST(),
+};
+
+static void stm32f205_soc_class_init(ObjectClass *klass, void *data)
+{
+    DeviceClass *dc = DEVICE_CLASS(klass);
+
+    dc->realize = stm32f205_soc_realize;
+    dc->props = stm32f205_soc_properties;
+}
+
+static const TypeInfo stm32f205_soc_info = {
+    .name          = TYPE_STM32F205_SOC,
+    .parent        = TYPE_SYS_BUS_DEVICE,
+    .instance_size = sizeof(STM32F205State),
+    .instance_init = stm32f205_soc_initfn,
+    .class_init    = stm32f205_soc_class_init,
+};
+
+static void stm32f205_soc_types(void)
+{
+    type_register_static(&stm32f205_soc_info);
+}
+
+type_init(stm32f205_soc_types)
include/hw/arm/stm32f205_soc.h new file +57 -1
new file mode 100644
index 0000000..3cda170
@@ -0,0 +1,57 @@
+/*
+ * STM32F205 SoC
+ *
+ * Copyright (c) 2014 Alistair Francis <[email protected]>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#ifndef HW_ARM_STM32F205SOC_H
+#define HW_ARM_STM32F205SOC_H
+
+#include "hw/misc/stm32f2xx_syscfg.h"
+#include "hw/timer/stm32f2xx_timer.h"
+#include "hw/char/stm32f2xx_usart.h"
+
+#define TYPE_STM32F205_SOC "stm32f205_soc"
+#define STM32F205_SOC(obj) \
+    OBJECT_CHECK(STM32F205State, (obj), TYPE_STM32F205_SOC)
+
+#define STM_NUM_USARTS 6
+#define STM_NUM_TIMERS 4
+
+#define FLASH_BASE_ADDRESS 0x08000000
+#define FLASH_SIZE (1024 * 1024)
+#define SRAM_BASE_ADDRESS 0x20000000
+#define SRAM_SIZE (128 * 1024)
+
+typedef struct STM32F205State {
+    /*< private >*/
+    SysBusDevice parent_obj;
+    /*< public >*/
+
+    char *kernel_filename;
+    char *cpu_model;
+
+    STM32F2XXSyscfgState syscfg;
+    STM32F2XXUsartState usart[STM_NUM_USARTS];
+    STM32F2XXTimerState timer[STM_NUM_TIMERS];
+} STM32F205State;
+
+#endif
--

2.1.0

#7 lore raw
In reply to Alistair Francis
Quoted 1 line · Alistair Francis

This patch series adds the Netduino 2 Machine to QEMU

Hello Peter Maydell,

All of these patches have been reviewed by Peter Crosthwaite. Can this be committed now?

Thanks,

Alistair

Quoted 65 lines

Information on the board is avalible at:
http://www.netduino.com/netduino2/specs.htm

The git tree can be found at:
https://github.com/alistair23/qemu/tree/netduino2.11

Some example code that runs on QEMU is avaliable at:
at: https://github.com/alistair23/CSSE3010-QEMU-Examples

There are more devices in the works, I figured I would just start with these three

V11:
- Include/header fixes
- Make the CPU model a property for the SoC
V9/V10:
- Correct timer device based on Peter C's comments
V8:
- Update the timer device based on Peter C's comments
- Update the USART device based on Peter C's comments
V7:
- Rebase to QEMU 2.2
V6:
- Rename the three devices to STM32FXX*
- Correct the timer to use ns
- Correct the number of devices that are inited
- Rename memory regions

Alistair Francis (5):
stm32f2xx_timer: Add the stm32f2xx Timer
stm32f2xx_USART: Add the stm32f2xx USART Controller
stm32f2xx_SYSCFG: Add the stm32f2xx SYSCFG
stm32f205: Add the stm32f205 SoC
netduino2: Add the Netduino 2 Machine

 default-configs/arm-softmmu.mak    |   4 +
 hw/arm/Makefile.objs               |   2 +
 hw/arm/netduino2.c                 |  57 +++++++
 hw/arm/stm32f205_soc.c             | 160 ++++++++++++++++++
 hw/char/Makefile.objs              |   1 +
 hw/char/stm32f2xx_usart.c          | 229 ++++++++++++++++++++++++++
 hw/misc/Makefile.objs              |   1 +
 hw/misc/stm32f2xx_syscfg.c         | 160 ++++++++++++++++++
 hw/timer/Makefile.objs             |   2 +
 hw/timer/stm32f2xx_timer.c         | 328 +++++++++++++++++++++++++++++++++++++
 include/hw/arm/stm32f205_soc.h     |  57 +++++++
 include/hw/char/stm32f2xx_usart.h  |  73 +++++++++
 include/hw/misc/stm32f2xx_syscfg.h |  61 +++++++
 include/hw/timer/stm32f2xx_timer.h | 101 ++++++++++++
 14 files changed, 1236 insertions(+)
 create mode 100644 hw/arm/netduino2.c
 create mode 100644 hw/arm/stm32f205_soc.c
 create mode 100644 hw/char/stm32f2xx_usart.c
 create mode 100644 hw/misc/stm32f2xx_syscfg.c
 create mode 100644 hw/timer/stm32f2xx_timer.c
 create mode 100644 include/hw/arm/stm32f205_soc.h
 create mode 100644 include/hw/char/stm32f2xx_usart.h
 create mode 100644 include/hw/misc/stm32f2xx_syscfg.h
 create mode 100644 include/hw/timer/stm32f2xx_timer.h

--
2.1.0

#8 lore raw
Quoted 7 lines · Alistair Francis
Quoted 1 line · Alistair Francis

This patch series adds the Netduino 2 Machine to QEMU

Hello Peter Maydell,

All of these patches have been reviewed by Peter Crosthwaite. Can this be committed now?

Sure. I don't plan to try to assemble another target-arm pullreq til I'm back at work ~10th March, though.

-- PMM

#9 lore raw
Quoted 11 lines · Peter Maydell
Quoted 7 lines · Alistair Francis
Quoted 1 line · Alistair Francis

This patch series adds the Netduino 2 Machine to QEMU

Hello Peter Maydell,

All of these patches have been reviewed by Peter Crosthwaite. Can this be committed now?

Sure. I don't plan to try to assemble another target-arm pullreq til I'm back at work ~10th March, though.

That's alright. I couldn't remember how long your holidays were for and I was just wanted to make sure you saw it.

I hope you are having a good time.

Thanks,

Alistair

Quoted 2 lines

-- PMM

#11 lore raw
Quoted 9 lines · Peter Maydell
Quoted 8 lines · Alistair Francis

This patch series adds the Netduino 2 Machine to QEMU

Information on the board is avalible at:
http://www.netduino.com/netduino2/specs.htm

The git tree can be found at:
https://github.com/alistair23/qemu/tree/netduino2.11

Quoted 6 lines
Quoted 2 lines

Some example code that runs on QEMU is avaliable at:
at: https://github.com/alistair23/CSSE3010-QEMU-Examples

Applied to target-arm.next, thanks.

Thanks :)

Alistair

Quoted 2 lines

-- PMM