Merge pull request #5994 from bmcdonnell-ionx/gcc-arm-extram

allow use of external memory as heap with TOOLCHAIN_GCC_ARM
pull/6000/head
Cruz Monrreal 2018-02-01 23:17:29 -06:00 committed by GitHub
commit b8d218038b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -770,7 +770,8 @@ extern "C" caddr_t _sbrk(int incr) {
#else
// Linker defined symbol used by _sbrk to indicate where heap should start.
extern "C" uint32_t __end__;
extern "C" caddr_t _sbrk(int incr) {
// Weak attribute allows user to override, e.g. to use external RAM for dynamic memory.
extern "C" WEAK caddr_t _sbrk(int incr) {
static unsigned char* heap = (unsigned char*)&__end__;
unsigned char* prev_heap = heap;
unsigned char* new_heap = heap + incr;