mirror of https://github.com/ARMmbed/mbed-os.git
Refine comment for two-region model
parent
e54aad9183
commit
c273b44d17
|
@ -574,7 +574,10 @@ register unsigned char * stack_ptr __asm ("sp");
|
||||||
|
|
||||||
// Dynamic memory allocation related syscall.
|
// Dynamic memory allocation related syscall.
|
||||||
#if defined(TARGET_NUMAKER_PFM_NUC472) || defined(TARGET_NUMAKER_PFM_M453)
|
#if defined(TARGET_NUMAKER_PFM_NUC472) || defined(TARGET_NUMAKER_PFM_M453)
|
||||||
// Overwrite _sbrk() to support two region model.
|
// Overwrite _sbrk() to support two region model (heap and stack are two distinct regions).
|
||||||
|
// __wrap__sbrk() is implemented in:
|
||||||
|
// TARGET_NUMAKER_PFM_NUC472 hal/targets/cmsis/TARGET_NUVOTON/TARGET_NUC472/TARGET_NUMAKER_PFM_NUC472/TOOLCHAIN_GCC_ARM/retarget.c
|
||||||
|
// TARGET_NUMAKER_PFM_M453 hal/targets/cmsis/TARGET_NUVOTON/TARGET_M451/TARGET_NUMAKER_PFM_M453/TOOLCHAIN_GCC_ARM/retarget.c
|
||||||
extern "C" void *__wrap__sbrk(int incr);
|
extern "C" void *__wrap__sbrk(int incr);
|
||||||
extern "C" caddr_t _sbrk(int incr) {
|
extern "C" caddr_t _sbrk(int incr) {
|
||||||
return (caddr_t) __wrap__sbrk(incr);
|
return (caddr_t) __wrap__sbrk(incr);
|
||||||
|
|
|
@ -15,9 +15,11 @@
|
||||||
extern uint32_t __mbed_sbrk_start;
|
extern uint32_t __mbed_sbrk_start;
|
||||||
extern uint32_t __mbed_krbs_start;
|
extern uint32_t __mbed_krbs_start;
|
||||||
|
|
||||||
// NOTE: The implementation of _sbrk (in common/retarget.cpp) for GCC_ARM requires one-region model for heap and stack, which doesn't
|
/**
|
||||||
// meet the layout of e.g. Nu-mbed-NUC472 board where heap is located on external SRAM.
|
* The default implementation of _sbrk() (in common/retarget.cpp) for GCC_ARM requires one-region model (heap and stack share one region), which doesn't
|
||||||
// Because the symbol is not weak and cannot be overwritten, wrap calls to it by hooking command line linker with '-Wl,--wrap,_sbrk'.
|
* fit two-region model (heap and stack are two distinct regions), for example, NUMAKER-PFM-NUC472 locates heap on external SRAM. Define __wrap__sbrk() to
|
||||||
|
* override the default _sbrk(). It is expected to get called through gcc hooking mechanism ('-Wl,--wrap,_sbrk') or in _sbrk().
|
||||||
|
*/
|
||||||
void *__wrap__sbrk(int incr)
|
void *__wrap__sbrk(int incr)
|
||||||
{
|
{
|
||||||
static uint32_t heap_ind = (uint32_t) &__mbed_sbrk_start;
|
static uint32_t heap_ind = (uint32_t) &__mbed_sbrk_start;
|
||||||
|
|
|
@ -15,9 +15,11 @@
|
||||||
extern uint32_t __mbed_sbrk_start;
|
extern uint32_t __mbed_sbrk_start;
|
||||||
extern uint32_t __mbed_krbs_start;
|
extern uint32_t __mbed_krbs_start;
|
||||||
|
|
||||||
// NOTE: The implementation of _sbrk (in common/retarget.cpp) for GCC_ARM requires one-region model for heap and stack, which doesn't
|
/**
|
||||||
// meet the layout of e.g. Nu-mbed-NUC472 board where heap is located on external SRAM.
|
* The default implementation of _sbrk() (in common/retarget.cpp) for GCC_ARM requires one-region model (heap and stack share one region), which doesn't
|
||||||
// Because the symbol is not weak and cannot be overwritten, wrap calls to it by hooking command line linker with '-Wl,--wrap,_sbrk'.
|
* fit two-region model (heap and stack are two distinct regions), for example, NUMAKER-PFM-NUC472 locates heap on external SRAM. Define __wrap__sbrk() to
|
||||||
|
* override the default _sbrk(). It is expected to get called through gcc hooking mechanism ('-Wl,--wrap,_sbrk') or in _sbrk().
|
||||||
|
*/
|
||||||
void *__wrap__sbrk(int incr)
|
void *__wrap__sbrk(int incr)
|
||||||
{
|
{
|
||||||
static uint32_t heap_ind = (uint32_t) &__mbed_sbrk_start;
|
static uint32_t heap_ind = (uint32_t) &__mbed_sbrk_start;
|
||||||
|
|
Loading…
Reference in New Issue