[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] stm32vldiscovery: allow overriding of RAM size
From: |
Lucas Villa Real |
Subject: |
[PATCH] stm32vldiscovery: allow overriding of RAM size |
Date: |
Mon, 3 Apr 2023 09:15:37 -0300 |
stm32vldiscovery comes with 8KB of SRAM, which may be too low when
running some workloads on QEMU. The command line argument "-m mem_size"
is not recognized by the current implementation, though, so one cannot
easily override the default memory size.
This patch fixes that by adding a memory subregion according to the
value provided on that command line argument. If absent, the default
value of 8KB still applies.
Signed-off-by: Lucas Villa Real <lucas@osdyne.com>
---
hw/arm/stm32vldiscovery.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/hw/arm/stm32vldiscovery.c b/hw/arm/stm32vldiscovery.c
index 67675e952f..7ca3ba029e 100644
--- a/hw/arm/stm32vldiscovery.c
+++ b/hw/arm/stm32vldiscovery.c
@@ -29,6 +29,7 @@
#include "hw/qdev-properties.h"
#include "hw/qdev-clock.h"
#include "qemu/error-report.h"
+#include "exec/address-spaces.h"
#include "hw/arm/stm32f100_soc.h"
#include "hw/arm/boot.h"
@@ -42,6 +43,9 @@ static void stm32vldiscovery_init(MachineState *machine)
DeviceState *dev;
Clock *sysclk;
+ /* Allow overriding the emulated board's RAM size */
+ memory_region_add_subregion(get_system_memory(), SRAM_BASE_ADDRESS,
machine->ram);
+
/* This clock doesn't need migration because it is fixed-frequency */
sysclk = clock_new(OBJECT(machine), "SYSCLK");
clock_set_hz(sysclk, SYSCLK_FRQ);
@@ -60,6 +64,8 @@ static void stm32vldiscovery_machine_init(MachineClass *mc)
{
mc->desc = "ST STM32VLDISCOVERY (Cortex-M3)";
mc->init = stm32vldiscovery_init;
+ mc->default_ram_id = "stm32vldiscovery.ram";
+ mc->default_ram_size = SRAM_SIZE;
}
DEFINE_MACHINE("stm32vldiscovery", stm32vldiscovery_machine_init)
--
2.37.1 (Apple Git-137.1)
- [PATCH] stm32vldiscovery: allow overriding of RAM size,
Lucas Villa Real <=