Skip to contentSkip to conversation

hw/arm: Add minimal support for the B-L475E-IOT01A board

RFC PATCH In review ~inesvarhol 2 participants 4 messages Nov 20, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v3 cover hw/arm: Add minimal support for the B-L475E-IOT01A board

This patch allows to emulate the B-L475E-IOT01A ARM Cortex-M4 board. This is RFC since the implementation isn't complete yet, there are no implemented
peripherals, and it's a first contribution to QEMU.
The changes from v1 follow the reviews from Philippe Mathieu-Daudé. We additionally changed the parent of the stm32l4x5 SoC from Device to SysBusDevice.

Details of v2 to v3 changes :
- moved the initialization of armv7m from the SoC initfn method to the SoC realize method
- embedded the flash sizes of different SoC types in the class_init methods (removing macros)

Details of v1 to v2 changes :
- replaced 'stm32l475vg' by 'stm32l4x5'

In the *_soc.c file :
- added support for the stm32l4x5xe and stm32l4x5xc
- used ERRP_GUARD() instead of propagating err to errp
- renamed memory regions
- hard-coded the cpu type in the realize method
- used DEFINE_TYPES() is preferred over type_init()
- added a SPDX tag

In the *_soc.h file :
- included "hw/qdev-core.h" and "exec/memory.h"
- removed <private/public> lines
- exported the different flash sizes
- moved the SRAM and flash addresses, SRAM sizes to the *_soc.c
- added a SPDX tag

In the board file :
- enforced the CPU type (using 'valid_cpu_types' instead of 'default_cpu_type')
- added a SPDX tag

Inès Varhol (2):
hw/arm: Add minimal support for the STM32L4x5 SoC hw/arm: Add minimal support for the B-L475E-IOT01A board

 configs/devices/arm-softmmu/default.mak |   1 +
 hw/arm/Kconfig                          |  11 +
 hw/arm/b-l475e-iot01a.c                 |  77 +++++++
 hw/arm/meson.build                      |   2 +
 hw/arm/stm32l4x5_soc.c                  | 275 ++++++++++++++++++++++++
 include/hw/arm/stm32l4x5_soc.h          |  63 ++++++
 6 files changed, 429 insertions(+)
 create mode 100644 hw/arm/b-l475e-iot01a.c
 create mode 100644 hw/arm/stm32l4x5_soc.c
 create mode 100644 include/hw/arm/stm32l4x5_soc.h
Signature · 1 line
2.38.5
#1 lore raw

RFC PATCH v3 1/2 hw/arm: Add minimal support for the STM32L4x5 SoC

From: Inès Varhol <[email protected]>

This patch adds a new STM32L4x5 SoC, it is necessary to add support for the B-L475E-IOT01A board.
The implementation is derived from the STM32F405 SoC.
The implementation contains no peripherals, only memory regions are implemented.

---
 hw/arm/Kconfig                 |   5 +
 hw/arm/meson.build             |   1 +
 hw/arm/stm32l4x5_soc.c         | 275 +++++++++++++++++++++++++++++++++
 include/hw/arm/stm32l4x5_soc.h |  63 ++++++++
 4 files changed, 344 insertions(+)
 create mode 100644 hw/arm/stm32l4x5_soc.c
 create mode 100644 include/hw/arm/stm32l4x5_soc.h
hw/arm/Kconfig +5 -0
index 3ada335a24..d2b94d9a47 100644
@@ -448,6 +448,11 @@ config STM32F405_SOC
     select STM32F4XX_SYSCFG
     select STM32F4XX_EXTI
 
+config STM32L4X5_SOC
+    bool
+    select ARM_V7M
+    select OR_IRQ
+
 config XLNX_ZYNQMP_ARM
     bool
     default y if PIXMAN
hw/arm/meson.build +1 -0
index 68245d3ad1..9766da10c4 100644
@@ -42,6 +42,7 @@ arm_ss.add(when: 'CONFIG_RASPI', if_true: files('bcm2836.c', 'raspi.c'))
 arm_ss.add(when: 'CONFIG_STM32F100_SOC', if_true: files('stm32f100_soc.c'))
 arm_ss.add(when: 'CONFIG_STM32F205_SOC', if_true: files('stm32f205_soc.c'))
 arm_ss.add(when: 'CONFIG_STM32F405_SOC', if_true: files('stm32f405_soc.c'))
+arm_ss.add(when: 'CONFIG_STM32L4X5_SOC', if_true: files('stm32l4x5_soc.c'))
 arm_ss.add(when: 'CONFIG_XLNX_ZYNQMP_ARM', if_true: files('xlnx-zynqmp.c', 'xlnx-zcu102.c'))
 arm_ss.add(when: 'CONFIG_XLNX_VERSAL', if_true: files('xlnx-versal.c', 'xlnx-versal-virt.c'))
 arm_ss.add(when: 'CONFIG_FSL_IMX25', if_true: files('fsl-imx25.c', 'imx25_pdk.c'))
hw/arm/stm32l4x5_soc.c new file +275 -0

275 lines not on this page · raw message

include/hw/arm/stm32l4x5_soc.h new file +63 -0

63 lines not on this page · raw message

Signature · 1 line
2.38.5
#2 lore raw

RFC PATCH v3 2/2 hw/arm: Add minimal support for the B-L475E-IOT01A board

In reply to ~inesvarhol

From: Inès Varhol <[email protected]>

This commit adds a new B-L475E-IOT01A board using the STM32L475VG SoC. The implementation is derived from the Netduino Plus 2 machine. There are no peripherals implemented, only memory regions.

---
 configs/devices/arm-softmmu/default.mak |  1 +
 hw/arm/Kconfig                          |  6 ++
 hw/arm/b-l475e-iot01a.c                 | 77 +++++++++++++++++++++++++
 hw/arm/meson.build                      |  1 +
 4 files changed, 85 insertions(+)
 create mode 100644 hw/arm/b-l475e-iot01a.c
configs/devices/arm-softmmu/default.mak +1 -0
index 980c48a7d9..023faa2f75 100644
@@ -19,6 +19,7 @@ CONFIG_ARM_VIRT=y
 # CONFIG_NSERIES=n
 # CONFIG_STELLARIS=n
 # CONFIG_STM32VLDISCOVERY=n
+# CONFIG_B_L475E_IOT01A=n
 # CONFIG_REALVIEW=n
 # CONFIG_VERSATILE=n
 # CONFIG_VEXPRESS=n
hw/arm/Kconfig +6 -0
index d2b94d9a47..7520dc5cc0 100644
@@ -448,6 +448,12 @@ config STM32F405_SOC
     select STM32F4XX_SYSCFG
     select STM32F4XX_EXTI
 
+config B_L475E_IOT01A
+    bool
+    default y
+    depends on TCG && ARM
+    select STM32L4X5_SOC
+
 config STM32L4X5_SOC
     bool
     select ARM_V7M
hw/arm/b-l475e-iot01a.c new file +77 -0

77 lines not on this page · raw message

hw/arm/meson.build +1 -0
index 9766da10c4..bb92b27db3 100644
@@ -42,6 +42,7 @@ arm_ss.add(when: 'CONFIG_RASPI', if_true: files('bcm2836.c', 'raspi.c'))
 arm_ss.add(when: 'CONFIG_STM32F100_SOC', if_true: files('stm32f100_soc.c'))
 arm_ss.add(when: 'CONFIG_STM32F205_SOC', if_true: files('stm32f205_soc.c'))
 arm_ss.add(when: 'CONFIG_STM32F405_SOC', if_true: files('stm32f405_soc.c'))
+arm_ss.add(when: 'CONFIG_B_L475E_IOT01A', if_true: files('b-l475e-iot01a.c'))
 arm_ss.add(when: 'CONFIG_STM32L4X5_SOC', if_true: files('stm32l4x5_soc.c'))
 arm_ss.add(when: 'CONFIG_XLNX_ZYNQMP_ARM', if_true: files('xlnx-zynqmp.c', 'xlnx-zcu102.c'))
 arm_ss.add(when: 'CONFIG_XLNX_VERSAL', if_true: files('xlnx-versal.c', 'xlnx-versal-virt.c'))
Signature · 1 line
2.38.5
#3 lore raw
In reply to ~inesvarhol
Quoted 8 lines · ~inesvarhol

This patch allows to emulate the B-L475E-IOT01A ARM Cortex-M4 board. This is RFC since the implementation isn't complete yet, there are no implemented
peripherals, and it's a first contribution to QEMU.
The changes from v1 follow the reviews from Philippe Mathieu-Daudé. We additionally changed the parent of the stm32l4x5 SoC from Device to SysBusDevice.

Quoted 8 lines

Details of v2 to v3 changes :
- moved the initialization of armv7m from the SoC initfn method to the SoC realize method
- embedded the flash sizes of different SoC types in the class_init methods (removing macros)

Details of v1 to v2 changes :
- replaced 'stm32l475vg' by 'stm32l4x5'

Thanks Inès for the requested changes. This patch set LGTM now!

Looking forward to see device added and firmware running as test :)

Regards,

Phil.

Quoted 3 lines

Inès Varhol (2):
hw/arm: Add minimal support for the STM32L4x5 SoC hw/arm: Add minimal support for the B-L475E-IOT01A board