mbed library sources. Supersedes mbed-src.
Dependents: Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more
Diff: targets/TARGET_NUVOTON/TARGET_M480/device/TOOLCHAIN_GCC_ARM/m480_retarget.c
- Revision:
- 187:0387e8f68319
- Parent:
- 172:7d866c31b3c5
--- a/targets/TARGET_NUVOTON/TARGET_M480/device/TOOLCHAIN_GCC_ARM/m480_retarget.c Fri Jun 22 16:45:37 2018 +0100 +++ b/targets/TARGET_NUVOTON/TARGET_M480/device/TOOLCHAIN_GCC_ARM/m480_retarget.c Thu Sep 06 13:40:20 2018 +0100 @@ -18,12 +18,14 @@ #define NU_HEAP_ALIGN 32 -/** - * 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 - * 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(). +/* Support heap with two-region model + * + * The default implementation of _sbrk() (in mbed_retarget.cpp) for GCC_ARM requires one-region + * model (heap and stack share one region), which doesn't fit two-region model (heap and stack + * are two distinct regions), e.g., stack in internal SRAM/heap in external SRAM on NUMAKER_PFM_NUC472. + * Hence, override _sbrk() here to support heap with two-region model. */ -void *__wrap__sbrk(int incr) +void *_sbrk(int incr) { static uint32_t heap_ind = (uint32_t) &__mbed_sbrk_start; uint32_t heap_ind_old = NU_ALIGN_UP(heap_ind, NU_HEAP_ALIGN);