Skip to content

Commit b8d2180

Browse files
authored
Merge pull request #5994 from bmcdonnell-ionx/gcc-arm-extram
allow use of external memory as heap with TOOLCHAIN_GCC_ARM
2 parents d8aebba + a47bf45 commit b8d2180

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

platform/mbed_retarget.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -770,7 +770,8 @@ extern "C" caddr_t _sbrk(int incr) {
770770
#else
771771
// Linker defined symbol used by _sbrk to indicate where heap should start.
772772
extern "C" uint32_t __end__;
773-
extern "C" caddr_t _sbrk(int incr) {
773+
// Weak attribute allows user to override, e.g. to use external RAM for dynamic memory.
774+
extern "C" WEAK caddr_t _sbrk(int incr) {
774775
static unsigned char* heap = (unsigned char*)&__end__;
775776
unsigned char* prev_heap = heap;
776777
unsigned char* new_heap = heap + incr;

0 commit comments

Comments
 (0)