Skip to content

Commit b3e2ff2

Browse files
xuchang-vivoclaude
andcommitted
fix(qemu_mps2_an385): increase stack size from 8KB to 24KB to prevent boot-time stack overflow
After commit f6e8d61, NetIface::new() is called during net::init() which runs on the interrupt stack (CONFIG_STACK_SIZE=8KB). smoltcp::Interface::new() internally performs a ~14KB memset in Fragmenter::new(), overflowing the 8KB stack and corrupting the TLSF allocator's sentinel block. Increase CONFIG_STACK_SIZE to 24KB across all three defconfig variants, and bump the heap alignment in link.x from 8 to 16 bytes for correctness. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
1 parent f6e8d61 commit b3e2ff2

4 files changed

Lines changed: 4 additions & 4 deletions

File tree

arch/arm/cortex_m/link.x

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ SECTIONS
209209

210210
.heap (COPY) :
211211
{
212-
. = ALIGN(8);
212+
. = ALIGN(16);
213213
PROVIDE(_end = .);
214214
__heap_start = .;
215215
. = ORIGIN(RAM) + LENGTH(RAM) - STACK_SIZE - STACK_GUARD_SIZE;

kconfig/config/qemu_mps2_an385/coverage/defconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,6 @@ CONFIG_CMSIS_RTOS2_ADAPTER=y
7474
# linker script
7575
CONFIG_SRAM_BASE_ADDRESS=0x21000000
7676
CONFIG_SRAM_SIZE=16384
77-
CONFIG_STACK_SIZE=8
77+
CONFIG_STACK_SIZE=24
7878
CONFIG_FLASH_BASE_ADDRESS=0x0
7979
CONFIG_FLASH_SIZE=4096

kconfig/config/qemu_mps2_an385/debug/defconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,6 @@ CONFIG_CMSIS_RTOS2_ADAPTER=y
7474
# linker script
7575
CONFIG_SRAM_BASE_ADDRESS=0x21000000
7676
CONFIG_SRAM_SIZE=16384
77-
CONFIG_STACK_SIZE=8
77+
CONFIG_STACK_SIZE=24
7878
CONFIG_FLASH_BASE_ADDRESS=0x0
7979
CONFIG_FLASH_SIZE=4096

kconfig/config/qemu_mps2_an385/release/defconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,6 @@ CONFIG_CMSIS_RTOS2_ADAPTER=y
7474
# linker script
7575
CONFIG_SRAM_BASE_ADDRESS=0x21000000
7676
CONFIG_SRAM_SIZE=16384
77-
CONFIG_STACK_SIZE=8
77+
CONFIG_STACK_SIZE=24
7878
CONFIG_FLASH_BASE_ADDRESS=0x0
7979
CONFIG_FLASH_SIZE=4096

0 commit comments

Comments
 (0)