From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: "Inès Varhol" <ines.varhol@telecom-paris.fr>, qemu-devel@nongnu.org
Cc: qemu-arm@nongnu.org, alistair@alistair23.me,
peter.maydell@linaro.org, arnaud.minier@telecom-paris.fr
Subject: Re: [PATCH v4 2/2] hw/arm: Add minimal support for the B-L475E-IOT01A board
Date: Thu, 4 Jan 2024 14:11:57 +0100 [thread overview]
Message-ID: <1d15fc3d-1334-4ef0-8484-d8dcbfa10df3@linaro.org> (raw)
In-Reply-To: <20231221213838.54944-3-ines.varhol@telecom-paris.fr>
On 21/12/23 22:32, Inès Varhol wrote:
> This commit adds a new B-L475E-IOT01A board using the STM32L475VG SoC
> as well as a dedicated documentation file.
> The implementation is derived from the Netduino Plus 2 machine.
> There are no peripherals implemented yet, only memory regions.
>
> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>
> Signed-off-by: Arnaud Minier <arnaud.minier@telecom-paris.fr>
> Signed-off-by: Inès Varhol <ines.varhol@telecom-paris.fr>
> ---
> MAINTAINERS | 7 +++
> configs/devices/arm-softmmu/default.mak | 1 +
> docs/system/arm/b-l475e-iot01a.rst | 46 ++++++++++++++++
> docs/system/arm/stm32.rst | 6 ++-
> docs/system/target-arm.rst | 1 +
> hw/arm/Kconfig | 6 +++
> hw/arm/b-l475e-iot01a.c | 70 +++++++++++++++++++++++++
> hw/arm/meson.build | 1 +
> 8 files changed, 136 insertions(+), 2 deletions(-)
> create mode 100644 docs/system/arm/b-l475e-iot01a.rst
> create mode 100644 hw/arm/b-l475e-iot01a.c
> diff --git a/hw/arm/b-l475e-iot01a.c b/hw/arm/b-l475e-iot01a.c
> new file mode 100644
> index 0000000000..c3790e3dc8
> --- /dev/null
> +++ b/hw/arm/b-l475e-iot01a.c
> @@ -0,0 +1,70 @@
> +/*
> + * B-L475E-IOT01A Discovery Kit machine
> + * (B-L475E-IOT01A IoT Node)
> + *
> + * Copyright (c) 2023 Arnaud Minier <arnaud.minier@telecom-paris.fr>
> + * Copyright (c) 2023 Inès Varhol <ines.varhol@telecom-paris.fr>
> + *
> + * SPDX-License-Identifier: GPL-2.0-or-later
> + *
> + * This work is licensed under the terms of the GNU GPL, version 2 or later.
> + * See the COPYING file in the top-level directory.
> + *
> + * This work is heavily inspired by the netduinoplus2 by Alistair Francis.
> + * Original code is licensed under the MIT License:
> + *
> + * Copyright (c) 2014 Alistair Francis <alistair@alistair23.me>
> + */
> +
> +/*
> + * The reference used is the STMicroElectronics UM2153 User manual
> + * Discovery kit for IoT node, multi-channel communication with STM32L4.
> + * https://www.st.com/en/evaluation-tools/b-l475e-iot01a.html#documentation
> + */
> +
> +#include "qemu/osdep.h"
> +#include "qapi/error.h"
> +#include "hw/boards.h"
> +#include "hw/qdev-properties.h"
> +#include "hw/qdev-clock.h"
> +#include "qemu/error-report.h"
> +#include "hw/arm/stm32l4x5_soc.h"
> +#include "hw/arm/boot.h"
> +
> +/* Main SYSCLK frequency in Hz (80MHz) */
> +#define SYSCLK_FRQ 80000000ULL
> +
> +static void b_l475e_iot01a_init(MachineState *machine)
> +{
> + const Stm32l4x5SocClass *sc;
> + DeviceState *dev;
> + Clock *sysclk;
> +
> + /* This clock doesn't need migration because it is fixed-frequency */
> + sysclk = clock_new(OBJECT(machine), "SYSCLK");
> + clock_set_hz(sysclk, SYSCLK_FRQ);
> +
> + dev = qdev_new(TYPE_STM32L4X5XG_SOC);
Missing machine parentship relation.
> + sc = STM32L4X5_SOC_GET_CLASS(dev);
> + qdev_connect_clock_in(dev, "sysclk", sysclk);
> + sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
> +
> + armv7m_load_kernel(ARM_CPU(first_cpu),
> + machine->kernel_filename,
> + 0, sc->flash_size);
> +}
Using:
-- >8 --
diff --git a/hw/arm/b-l475e-iot01a.c b/hw/arm/b-l475e-iot01a.c
index c3790e3dc8..85b8cdcd57 100644
--- a/hw/arm/b-l475e-iot01a.c
+++ b/hw/arm/b-l475e-iot01a.c
@@ -45,10 +45,11 @@ static void b_l475e_iot01a_init(MachineState *machine)
clock_set_hz(sysclk, SYSCLK_FRQ);
dev = qdev_new(TYPE_STM32L4X5XG_SOC);
- sc = STM32L4X5_SOC_GET_CLASS(dev);
+ object_property_add_child(OBJECT(machine), "soc", OBJECT(dev));
qdev_connect_clock_in(dev, "sysclk", sysclk);
sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
+ sc = STM32L4X5_SOC_GET_CLASS(dev);
armv7m_load_kernel(ARM_CPU(first_cpu),
machine->kernel_filename,
0, sc->flash_size);
---
we get:
(qemu) info qom-tree
/machine (b-l475e-iot01a-machine)
/SYSCLK (clock)
/peripheral (container)
/peripheral-anon (container)
/soc (stm32l4x5xg-soc)
/SRAM1[0] (memory-region)
/SRAM2[0] (memory-region)
/armv7m (armv7m)
/armv7m-container[0] (memory-region)
/bitband[0] (ARM-bitband-memory)
/bitband[0] (memory-region)
/bitband[1] (ARM-bitband-memory)
/bitband[0] (memory-region)
/cpu (cortex-m4-arm-cpu)
/unnamed-gpio-in[0] (irq)
/unnamed-gpio-in[1] (irq)
/unnamed-gpio-in[2] (irq)
/unnamed-gpio-in[3] (irq)
/cpuclk (clock)
/nvic (armv7m_nvic)
/NMI[0] (irq)
...
prev parent reply other threads:[~2024-01-04 13:13 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-21 21:32 [PATCH v4 0/2] Add minimal support for the B-L475E-IOT01A board Inès Varhol
2023-12-21 21:32 ` [PATCH v4 1/2] hw/arm: Add minimal support for the STM32L4x5 SoC Inès Varhol
2024-01-04 12:49 ` Philippe Mathieu-Daudé
2023-12-21 21:32 ` [PATCH v4 2/2] hw/arm: Add minimal support for the B-L475E-IOT01A board Inès Varhol
2024-01-04 12:55 ` Philippe Mathieu-Daudé
2024-01-04 13:11 ` Philippe Mathieu-Daudé [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1d15fc3d-1334-4ef0-8484-d8dcbfa10df3@linaro.org \
--to=philmd@linaro.org \
--cc=alistair@alistair23.me \
--cc=arnaud.minier@telecom-paris.fr \
--cc=ines.varhol@telecom-paris.fr \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).