Request
In the file mbed-os/platform/mbed_retarget.cpp
, please add the attribute MBED_WEAK
(or equivalent) to the function definition _sbrk()
, to allow the user to override it.
extern "C" MBED_WEAK caddr_t _sbrk(int incr) {
// [snip...]
}
Details / Motivation
An approach sometimes used to access external memory in embedded systems is to have all stack memory use internal RAM, and all dynamic memory (e.g. malloc()) allocate memory from external RAM. This is especially useful during development, to at least temporarily skip over the often difficult task of editing linker files.
Embedded Artists' EALib takes this approach to enable access to an external SDRAM chip. In sdram.cpp, it defines/overrides the _sbrk()
function, which is used by malloc()
, (etc.), to manage the heap.
This worked in older versions of mbed (at least through rev 120), but I cannot build it in the latest mbed-os, due to _sbrk()
already being defined in mbed_retarget.cpp
. Please make the mbed-os _sbrk()
weak, to allow EALib to use the SDRAM as intended.
Request
In the file
mbed-os/platform/mbed_retarget.cpp
, please add the attributeMBED_WEAK
(or equivalent) to the function definition_sbrk()
, to allow the user to override it.Details / Motivation
An approach sometimes used to access external memory in embedded systems is to have all stack memory use internal RAM, and all dynamic memory (e.g. malloc()) allocate memory from external RAM. This is especially useful during development, to at least temporarily skip over the often difficult task of editing linker files.
Embedded Artists' EALib takes this approach to enable access to an external SDRAM chip. In sdram.cpp, it defines/overrides the
_sbrk()
function, which is used bymalloc()
, (etc.), to manage the heap.This worked in older versions of mbed (at least through rev 120), but I cannot build it in the latest mbed-os, due to
_sbrk()
already being defined inmbed_retarget.cpp
. Please make the mbed-os_sbrk()
weak, to allow EALib to use the SDRAM as intended.