Merge tag 'v9.0.0-rc3'
[qemu/ar7.git] / hw / arm / b-l475e-iot01a.c
blobd862aa43fc306e5ddaaddfa33bf37ee4e78e8e4e
1 /*
2 * B-L475E-IOT01A Discovery Kit machine
3 * (B-L475E-IOT01A IoT Node)
5 * Copyright (c) 2023 Arnaud Minier <arnaud.minier@telecom-paris.fr>
6 * Copyright (c) 2023 Inès Varhol <ines.varhol@telecom-paris.fr>
8 * SPDX-License-Identifier: GPL-2.0-or-later
10 * This work is licensed under the terms of the GNU GPL, version 2 or later.
11 * See the COPYING file in the top-level directory.
13 * This work is heavily inspired by the netduinoplus2 by Alistair Francis.
14 * Original code is licensed under the MIT License:
16 * Copyright (c) 2014 Alistair Francis <alistair@alistair23.me>
20 * The reference used is the STMicroElectronics UM2153 User manual
21 * Discovery kit for IoT node, multi-channel communication with STM32L4.
22 * https://www.st.com/en/evaluation-tools/b-l475e-iot01a.html#documentation
25 #include "qemu/osdep.h"
26 #include "qapi/error.h"
27 #include "hw/boards.h"
28 #include "hw/qdev-properties.h"
29 #include "qemu/error-report.h"
30 #include "hw/arm/stm32l4x5_soc.h"
31 #include "hw/arm/boot.h"
33 /* B-L475E-IOT01A implementation is derived from netduinoplus2 */
35 static void b_l475e_iot01a_init(MachineState *machine)
37 const Stm32l4x5SocClass *sc;
38 DeviceState *dev;
40 dev = qdev_new(TYPE_STM32L4X5XG_SOC);
41 object_property_add_child(OBJECT(machine), "soc", OBJECT(dev));
42 sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
44 sc = STM32L4X5_SOC_GET_CLASS(dev);
45 armv7m_load_kernel(ARM_CPU(first_cpu),
46 machine->kernel_filename,
47 0, sc->flash_size);
50 static void b_l475e_iot01a_machine_init(MachineClass *mc)
52 static const char *machine_valid_cpu_types[] = {
53 ARM_CPU_TYPE_NAME("cortex-m4"),
54 NULL
56 mc->desc = "B-L475E-IOT01A Discovery Kit (Cortex-M4)";
57 mc->init = b_l475e_iot01a_init;
58 mc->valid_cpu_types = machine_valid_cpu_types;
60 /* SRAM pre-allocated as part of the SoC instantiation */
61 mc->default_ram_size = 0;
64 DEFINE_MACHINE("b-l475e-iot01a", b_l475e_iot01a_machine_init)