Skip to content

Commit 0cef209

Browse files
committed
GigaDevice: Fix heap size formula in scatter files
The heap size was incorrectly calculated. This fixes it by subtracting the Stack size, any memory chunks allocated before the start of the application (for vectors and/or crash report), and finally the size of the application from the total RAM size.
1 parent e917282 commit 0cef209

File tree

2 files changed

+8
-4
lines changed
  • targets/TARGET_GigaDevice

2 files changed

+8
-4
lines changed

targets/TARGET_GigaDevice/TARGET_GD32F30X/TARGET_GD32F307VG/device/TOOLCHAIN_ARM_MICRO/gd32f307vg.sct

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333

3434
#define RAM_FIXED_SIZE (MBED_CONF_TARGET_BOOT_STACK_SIZE+VECTOR_SIZE)
3535

36+
#define MBED_RAM1_START (MBED_RAM_START+VECTOR_SIZE)
37+
3638
LR_IROM1 MBED_APP_START MBED_APP_SIZE { ; load region size_region
3739

3840
ER_IROM1 MBED_APP_START MBED_APP_SIZE { ; load address = execution address
@@ -41,11 +43,11 @@ LR_IROM1 MBED_APP_START MBED_APP_SIZE { ; load region size_region
4143
.ANY (+RO)
4244
}
4345

44-
RW_IRAM1 (MBED_RAM_START+VECTOR_SIZE) (MBED_RAM_SIZE-VECTOR_SIZE) { ; RW data
46+
RW_IRAM1 MBED_RAM1_START (MBED_RAM_SIZE-VECTOR_SIZE) { ; RW data
4547
.ANY (+RW +ZI)
4648
}
4749

48-
ARM_LIB_HEAP AlignExpr(+0, 16) EMPTY (MBED_RAM_SIZE-RAM_FIXED_SIZE+MBED_RAM_START-AlignExpr(ImageLimit(RW_IRAM1), 16)) {
50+
ARM_LIB_HEAP AlignExpr(+0, 16) EMPTY (MBED_RAM_SIZE-RAM_FIXED_SIZE+MBED_RAM1_START-AlignExpr(ImageLimit(RW_IRAM1), 16)) {
4951
}
5052

5153
ARM_LIB_STACK (MBED_RAM_START+MBED_RAM_SIZE) EMPTY -MBED_CONF_TARGET_BOOT_STACK_SIZE { ; stack

targets/TARGET_GigaDevice/TARGET_GD32F4XX/device/TOOLCHAIN_ARM_MICRO/gd32f450zi.sct

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333

3434
#define RAM_FIXED_SIZE (MBED_CONF_TARGET_BOOT_STACK_SIZE+VECTOR_SIZE)
3535

36+
#define MBED_RAM1_START (MBED_RAM_START+VECTOR_SIZE)
37+
3638
LR_IROM1 MBED_APP_START MBED_APP_SIZE { ; load region size_region
3739

3840
ER_IROM1 MBED_APP_START MBED_APP_SIZE { ; load address = execution address
@@ -41,11 +43,11 @@ LR_IROM1 MBED_APP_START MBED_APP_SIZE { ; load region size_region
4143
.ANY (+RO)
4244
}
4345

44-
RW_IRAM1 (MBED_RAM_START+VECTOR_SIZE) (MBED_RAM_SIZE-VECTOR_SIZE) { ; RW data
46+
RW_IRAM1 MBED_RAM1_START (MBED_RAM_SIZE-VECTOR_SIZE) { ; RW data
4547
.ANY (+RW +ZI)
4648
}
4749

48-
ARM_LIB_HEAP AlignExpr(+0, 16) EMPTY (MBED_RAM_SIZE-RAM_FIXED_SIZE+MBED_RAM_START-AlignExpr(ImageLimit(RW_IRAM1), 16)) {
50+
ARM_LIB_HEAP AlignExpr(+0, 16) EMPTY (MBED_RAM_SIZE-RAM_FIXED_SIZE+MBED_RAM1_START-AlignExpr(ImageLimit(RW_IRAM1), 16)) {
4951
}
5052

5153
ARM_LIB_STACK (MBED_RAM_START+MBED_RAM_SIZE) EMPTY -MBED_CONF_TARGET_BOOT_STACK_SIZE { ; stack

0 commit comments

Comments
 (0)