mbed-os/platform/source
Lingkai Dong 8d32b668ec Workaround for a bug in malloc() from newlib-nano 4.1.0
The commit 84d0689 "Nano-malloc: Fix for unwanted external heap
fragmentation" from newlib 4.1.0 introduced several optimizations,
one of which is as follows:

When the last chunk in the free list is smaller than requested,
nano_malloc() calls sbrk(0) to see if the heap's current head is
adjacent to this chunk, and if so it asks sbrk() to allocate the
difference in bytes only and expands the current chunk.

This doesn't work if the heap consists of non-contiguous regions.
sbrk(0) returns the the current region's head if the region has any
remaining capacity. But if this capacity is not enough for the second
(non-trivial) call to sbrk() described above, allocation will happen
from the next region if available. Expanding the current chunk won't
work and will result in a segmentation fault.

So this optimization needs to be reverted in order to bring back
compatibility with non-contiguous heaps. Before the next version
of newlib becomes available and gets updated in the GCC Arm Embedded
Toolchain, we work around this issue by including the fix in Mbed OS.
The linker prioritizes malloc() from the project to the one from the
toolchain.
2021-09-01 17:21:32 +01:00
..
TARGET_CORTEX_A/TOOLCHAIN_IAR CMake platform: remove IAR related CMakeLists 2021-02-17 09:15:50 +00:00
TARGET_CORTEX_M Update GCC except.S to support ARMC6 2021-05-24 13:54:57 +01:00
minimal-printf Fix minimal-printf floating point decimal output error 2021-01-20 20:54:34 +08:00
ATCmdParser.cpp busy s... fix (ONME-4352) 2019-12-12 09:36:34 +02:00
CMakeLists.txt Workaround for a bug in malloc() from newlib-nano 4.1.0 2021-09-01 17:21:32 +01:00
CThunkBase.cpp Change MBED_STATIC_ASSERTs version for built-in 2020-10-27 08:30:40 -05:00
CriticalSectionLock.cpp Remove the deprecated CriticalSectionLock APIs 2020-02-28 07:19:19 -08:00
DeepSleepLock.cpp Platform: Separate internal APIs from public APIs 2019-08-02 12:23:47 +01:00
FileBase.cpp Platform: Separate internal APIs from public APIs 2019-08-02 12:23:47 +01:00
FileHandle.cpp Platform: Separate internal APIs from public APIs 2019-08-02 12:23:47 +01:00
FilePath.cpp Platform: Separate internal APIs from public APIs 2019-08-02 12:23:47 +01:00
FileSystemHandle.cpp Platform: Separate internal APIs from public APIs 2019-08-02 12:23:47 +01:00
LocalFileSystem.cpp semihosting: add compat header where is required 2021-07-29 14:31:38 +01:00
Stream.cpp mbed_retarget: Add a minimal console implementation to provide basic functionalities 2019-11-11 15:14:00 +00:00
SysTimer.cpp Merge pull request #13085 from pea-pod/remove-deprecated-mbed-assert 2020-11-24 13:38:07 +00:00
mbed_alloc_wrappers.cpp Add integer overflow check to the malloc wrappers 2021-03-10 09:47:15 +00:00
mbed_application.c Make changes for Cortex-A5 support 2021-06-23 13:36:55 +08:00
mbed_assert.c Platform: Separate internal APIs from public APIs 2019-08-02 12:23:47 +01:00
mbed_atomic_impl.c Change MBED_STATIC_ASSERTs version for built-in 2020-10-27 08:30:40 -05:00
mbed_board.c [STD-PIN] BUTTON and LED define 2021-03-18 17:01:50 +00:00
mbed_crash_data_offsets.h Streamline crash data access 2020-04-24 10:59:13 +03:00
mbed_critical.c Unify the __CORTEX_A macro in the files containing cmsis.h 2021-06-23 13:36:52 +08:00
mbed_error.c fixup! error: use __INITIAL_SP from cmsis instead of RTX one 2021-05-10 16:09:18 +01:00
mbed_error_hist.c platform: move internal headers to internal/ 2020-08-20 08:58:00 +01:00
mbed_interface.c Platform: Separate internal APIs from public APIs 2019-08-02 12:23:47 +01:00
mbed_mem_trace.cpp Platform: Separate internal APIs from public APIs 2019-08-02 12:23:47 +01:00
mbed_mktime.c Platform: Separate internal APIs from public APIs 2019-08-02 12:23:47 +01:00
mbed_mpu_mgmt.c platform: fix SPDX identifiers 2020-02-21 07:00:58 +00:00
mbed_os_timer.cpp Fix MBED_ERROR call in init_os_timer 2020-11-19 12:35:34 -05:00
mbed_poll.cpp Platform: Separate internal APIs from public APIs 2019-08-02 12:23:47 +01:00
mbed_power_mgmt.c Platform: Separate internal APIs from public APIs 2019-08-02 12:23:47 +01:00
mbed_retarget.cpp retarget: move compat header for ARMClang prior any cmsis headers 2021-07-29 14:31:33 +01:00
mbed_rtc_time.cpp Use std::chrono based functions 2020-06-17 14:52:50 +01:00
mbed_sdk_boot.c Unify the __CORTEX_A macro in the files containing cmsis.h 2021-06-23 13:36:52 +08:00
mbed_semihost_api.c semihosting: add compat header where is required 2021-07-29 14:31:38 +01:00
mbed_stats.c Platform: Separate internal APIs from public APIs 2019-08-02 12:23:47 +01:00
mbed_thread.cpp platform: move internal headers to internal/ 2020-08-20 08:58:00 +01:00
mbed_wait_api_no_rtos.c Make changes for Cortex-A5 support 2021-06-23 13:36:55 +08:00
newlib_nano_malloc_workaround.c Workaround for a bug in malloc() from newlib-nano 4.1.0 2021-09-01 17:21:32 +01:00