Skip to content

ARM toolchain: heap setup micro-optimisation #11701

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 18, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions platform/source/mbed_retarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -927,7 +927,6 @@ __asm(".global __use_no_semihosting\n\t");
// Through weak-reference, we can check if ARM_LIB_HEAP is defined at run-time.
// If ARM_LIB_HEAP is defined, we can fix heap allocation.
extern MBED_WEAK uint32_t Image$$ARM_LIB_HEAP$$ZI$$Base[];
extern MBED_WEAK uint32_t Image$$ARM_LIB_HEAP$$ZI$$Length[];
extern MBED_WEAK uint32_t Image$$ARM_LIB_HEAP$$ZI$$Limit[];

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

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

// Fix heap if ARM_LIB_HEAP is defined
if (Image$$ARM_LIB_HEAP$$ZI$$Length) {
if (Image$$ARM_LIB_HEAP$$ZI$$Base != Image$$ARM_LIB_HEAP$$ZI$$Limit) {
heap_base = (uint32_t) Image$$ARM_LIB_HEAP$$ZI$$Base;
heap_limit = (uint32_t) Image$$ARM_LIB_HEAP$$ZI$$Limit;
}
Expand Down