Skip to content

Commit 00fc308

Browse files
authored
Merge pull request #11701 from kjbracey-arm/heapsave8
ARM toolchain: heap setup micro-optimisation
2 parents d851a63 + 93fbfaf commit 00fc308

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

platform/source/mbed_retarget.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -927,7 +927,6 @@ __asm(".global __use_no_semihosting\n\t");
927927
// Through weak-reference, we can check if ARM_LIB_HEAP is defined at run-time.
928928
// If ARM_LIB_HEAP is defined, we can fix heap allocation.
929929
extern MBED_WEAK uint32_t Image$$ARM_LIB_HEAP$$ZI$$Base[];
930-
extern MBED_WEAK uint32_t Image$$ARM_LIB_HEAP$$ZI$$Length[];
931930
extern MBED_WEAK uint32_t Image$$ARM_LIB_HEAP$$ZI$$Limit[];
932931

933932
// Heap here is considered starting after ZI ends to Stack start
@@ -942,7 +941,7 @@ extern "C" MBED_WEAK __value_in_regs struct __initial_stackheap _mbed_user_setup
942941
struct __initial_stackheap r;
943942

944943
// Fix heap if ARM_LIB_HEAP is defined
945-
if (Image$$ARM_LIB_HEAP$$ZI$$Length) {
944+
if (Image$$ARM_LIB_HEAP$$ZI$$Base != Image$$ARM_LIB_HEAP$$ZI$$Limit) {
946945
heap_base = (uint32_t) Image$$ARM_LIB_HEAP$$ZI$$Base;
947946
heap_limit = (uint32_t) Image$$ARM_LIB_HEAP$$ZI$$Limit;
948947
}
@@ -965,7 +964,7 @@ extern "C" __value_in_regs struct __argc_argv $Sub$$__rt_lib_init(unsigned heapb
965964
uint32_t heap_limit = (uint32_t)Image$$ARM_LIB_STACK$$ZI$$Base;
966965

967966
// Fix heap if ARM_LIB_HEAP is defined
968-
if (Image$$ARM_LIB_HEAP$$ZI$$Length) {
967+
if (Image$$ARM_LIB_HEAP$$ZI$$Base != Image$$ARM_LIB_HEAP$$ZI$$Limit) {
969968
heap_base = (uint32_t) Image$$ARM_LIB_HEAP$$ZI$$Base;
970969
heap_limit = (uint32_t) Image$$ARM_LIB_HEAP$$ZI$$Limit;
971970
}

0 commit comments

Comments
 (0)