This is an automated email from the ASF dual-hosted git repository.
GUIDINGLI pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new b23e61ea9cc boards/arm64/qemu: Size the kernel memory regions from the
configuration.
b23e61ea9cc is described below
commit b23e61ea9cc0d5ddc2277d92f41de92a14c007fe
Author: Marco Casaroli <[email protected]>
AuthorDate: Tue Oct 20 10:47:57 2026 +0200
boards/arm64/qemu: Size the kernel memory regions from the configuration.
The linker script of the qemu-armv8a kernel build gave the kernel image
a fixed 2 MiB region, and the page pool a fixed 4 MiB region at
CONFIG_RAM_START + 8 MiB. A kernel larger than 2 MiB did not link, also
when CONFIG_RAM_SIZE gives it the room: the kernel heap takes the RAM
after the image, up to CONFIG_RAM_START + CONFIG_RAM_SIZE, and is
smaller by the same amount. A larger CONFIG_TLS_LOG2_MAXSTACK makes
this easy to hit, because the idle stack is aligned to the maximum stack
size. For example a kernel with networking and
CONFIG_TLS_LOG2_MAXSTACK=20 failed with "region `dram' overflowed by
524288 bytes".
Let the image region end at the end of the RAM, and take the page pool
region from CONFIG_ARCH_PGPOOL_PBASE and CONFIG_ARCH_PGPOOL_SIZE, as the
rv-virt kernel linker script does. The defconfigs do not change.
Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Marco Casaroli <[email protected]>
---
boards/arm64/qemu/qemu-armv8a/scripts/ld-kernel.script | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/boards/arm64/qemu/qemu-armv8a/scripts/ld-kernel.script
b/boards/arm64/qemu/qemu-armv8a/scripts/ld-kernel.script
index 0031ead57fc..d4ba14d18ea 100644
--- a/boards/arm64/qemu/qemu-armv8a/scripts/ld-kernel.script
+++ b/boards/arm64/qemu/qemu-armv8a/scripts/ld-kernel.script
@@ -28,10 +28,16 @@ OUTPUT_ARCH(aarch64)
ENTRY(__start)
EXTERN(__start)
+/* The kernel heap takes the RAM after the image, up to CONFIG_RAM_START +
+ * CONFIG_RAM_SIZE, so the image can use all of that RAM.
+ */
+
MEMORY
{
- dram (rwx) : ORIGIN = CONFIG_LOAD_BASE, LENGTH = 2M
- pgram (rwx) : ORIGIN = CONFIG_RAM_START + 0x800000, LENGTH = 4M
+ dram (rwx) : ORIGIN = CONFIG_LOAD_BASE,
+ LENGTH = CONFIG_RAM_START + CONFIG_RAM_SIZE - CONFIG_LOAD_BASE
+ pgram (rwx) : ORIGIN = CONFIG_ARCH_PGPOOL_PBASE,
+ LENGTH = CONFIG_ARCH_PGPOOL_SIZE /* w/ cache */
}
PHDRS