From: Felipe Balbi <balbi@kernel.org>
To: Alistair Francis <alistair@alistair23.me>,
Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-devel@nongnu.org, qemu-arm@nongnu.org,
Felipe Balbi <balbi@kernel.org>
Subject: [PATCH 1/2] hw/arm/stm32f405: correctly describe the memory layout
Date: Sun, 18 Dec 2022 09:12:28 +0200 [thread overview]
Message-ID: <20221218071229.484944-2-balbi@kernel.org> (raw)
In-Reply-To: <20221218071229.484944-1-balbi@kernel.org>
STM32F405 has 128K of SRAM and another 64K of CCM (Core-coupled
Memory) at a different base address. Correctly describe the memory
layout to give existing FW images have a chance to run unmodified.
Signed-off-by: Felipe Balbi <balbi@kernel.org>
---
hw/arm/stm32f405_soc.c | 8 ++++++++
include/hw/arm/stm32f405_soc.h | 5 ++++-
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/hw/arm/stm32f405_soc.c b/hw/arm/stm32f405_soc.c
index c07947d9f8b1..cef23d7ee41a 100644
--- a/hw/arm/stm32f405_soc.c
+++ b/hw/arm/stm32f405_soc.c
@@ -139,6 +139,14 @@ static void stm32f405_soc_realize(DeviceState *dev_soc, Error **errp)
}
memory_region_add_subregion(system_memory, SRAM_BASE_ADDRESS, &s->sram);
+ memory_region_init_ram(&s->ccm, NULL, "STM32F405.ccm", CCM_SIZE,
+ &err);
+ if (err != NULL) {
+ error_propagate(errp, err);
+ return;
+ }
+ memory_region_add_subregion(system_memory, CCM_BASE_ADDRESS, &s->ccm);
+
armv7m = DEVICE(&s->armv7m);
qdev_prop_set_uint32(armv7m, "num-irq", 96);
qdev_prop_set_string(armv7m, "cpu-type", s->cpu_type);
diff --git a/include/hw/arm/stm32f405_soc.h b/include/hw/arm/stm32f405_soc.h
index 5bb0c8d56979..249ab5434ec7 100644
--- a/include/hw/arm/stm32f405_soc.h
+++ b/include/hw/arm/stm32f405_soc.h
@@ -46,7 +46,9 @@ OBJECT_DECLARE_SIMPLE_TYPE(STM32F405State, STM32F405_SOC)
#define FLASH_BASE_ADDRESS 0x08000000
#define FLASH_SIZE (1024 * 1024)
#define SRAM_BASE_ADDRESS 0x20000000
-#define SRAM_SIZE (192 * 1024)
+#define SRAM_SIZE (128 * 1024)
+#define CCM_BASE_ADDRESS 0x10000000
+#define CCM_SIZE (64 * 1024)
struct STM32F405State {
/*< private >*/
@@ -65,6 +67,7 @@ struct STM32F405State {
STM32F2XXADCState adc[STM_NUM_ADCS];
STM32F2XXSPIState spi[STM_NUM_SPIS];
+ MemoryRegion ccm;
MemoryRegion sram;
MemoryRegion flash;
MemoryRegion flash_alias;
--
2.38.1
next prev parent reply other threads:[~2022-12-18 15:24 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-18 7:12 [PATCH 0/2] hw/arm: Add support for STM32 H405 and fix STM32F405 memory layout Felipe Balbi
2022-12-18 7:12 ` Felipe Balbi [this message]
2022-12-19 9:32 ` [PATCH 1/2] hw/arm/stm32f405: correctly describe the " Alistair Francis
2022-12-19 9:53 ` Philippe Mathieu-Daudé
2022-12-19 10:31 ` Felipe Balbi
2022-12-18 7:12 ` [PATCH 2/2] hw/arm: Add Olimex H405 Felipe Balbi
2022-12-19 10:06 ` Philippe Mathieu-Daudé
2022-12-19 10:34 ` Felipe Balbi
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=20221218071229.484944-2-balbi@kernel.org \
--to=balbi@kernel.org \
--cc=alistair@alistair23.me \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.