diff --git a/targets/TARGET_STM/TARGET_STM32H7/linker_scripts/STM32H745_47_FAMILY/CM4/STM32H745_H747_CM4.ld b/targets/TARGET_STM/TARGET_STM32H7/linker_scripts/STM32H745_47_FAMILY/CM4/STM32H745_H747_CM4.ld index 02a3cf703c9..0d5afd00959 100644 --- a/targets/TARGET_STM/TARGET_STM32H7/linker_scripts/STM32H745_47_FAMILY/CM4/STM32H745_H747_CM4.ld +++ b/targets/TARGET_STM/TARGET_STM32H7/linker_scripts/STM32H745_47_FAMILY/CM4/STM32H745_H747_CM4.ld @@ -182,14 +182,15 @@ SECTIONS _ebss = .; } > SRAM_D2 + /* Check if data + stack will exceed SRAM limit */ + ASSERT(_ebss < ORIGIN(SRAM_D2) + LENGTH(SRAM_D2) - MBED_CONF_TARGET_BOOT_STACK_SIZE, "region SRAM does not have enough space for boot stack size") + .heap (COPY): { __end__ = .; PROVIDE(end = .); - PROVIDE(__mbed_sbrk_start = .); *(.heap*) . = ORIGIN(SRAM_D2) + LENGTH(SRAM_D2) - MBED_CONF_TARGET_BOOT_STACK_SIZE; - PROVIDE(__mbed_krbs_start = .); __HeapLimit = .; } > SRAM_D2 /* .stack_dummy section doesn't contains any symbols. It is only @@ -207,9 +208,6 @@ SECTIONS __StackLimit = __StackTop - MBED_CONF_TARGET_BOOT_STACK_SIZE; PROVIDE(__stack = __StackTop); - /* Check if data + heap + stack exceeds SRAM_D2 limit */ - ASSERT(__StackLimit >= __HeapLimit, "region SRAM_D2 overflowed with stack") - /* Put crash data in the otherwise unused D3 SRAM */ .crash_data_ram : {