You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Reason to enhance or problem with existing solution
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.
Pros
Described above.
Cons
Problematic if another library also defines _sbrk() weakly.
The text was updated successfully, but these errors were encountered:
#1819 was trying to do the same thing for a different platform, but it takes a different approach. I don't think it's the right approach here, because it's making mbed-os always use the external memory for dynamic memory for that platform, whereas I want to give the user the option to do so.
Description
Bug
Target
LPC40xx
Toolchain:
GCC_ARM
mbed-os sha:
(182bbd5)
Enhancement
Suggested enhancement
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.Reason to enhance or problem with existing solution
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.Pros
Described above.
Cons
Problematic if another library also defines
_sbrk()
weakly.The text was updated successfully, but these errors were encountered: