File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change 5757 #warning "This wrapper was verified for newlib version 2.5.0; please ensure newlib's external requirements for malloc-family are unchanged!"
5858#endif
5959
60- #include "freeRTOS .h" // defines public interface we're implementing here
60+ #include "FreeRTOS .h" // defines public interface we're implementing here
6161#if !defined(configUSE_NEWLIB_REENTRANT ) || (configUSE_NEWLIB_REENTRANT != 1 )
6262 #warning "#define configUSE_NEWLIB_REENTRANT 1 // Required for thread-safety of newlib sprintf, strtok, etc..."
6363 // If you're *really* sure you don't need FreeRTOS's newlib reentrancy support, remove this warning...
7171#ifndef NDEBUG
7272 static int totalBytesProvidedBySBRK = 0 ;
7373#endif
74- extern char __HeapBase , __HeapLimit , HEAP_SIZE ; // make sure to define these symbols in linker command file
75- static int heapBytesRemaining = ( int ) & HEAP_SIZE ; // that's (&__HeapLimit)-(&__HeapBase)
74+ extern char _end ; // Defined in the linker script
75+ static int heapBytesRemaining = configTOTAL_HEAP_SIZE ; // that's (&__HeapLimit)-(&__HeapBase)
7676
7777//! sbrk/_sbrk version supporting reentrant newlib (depends upon above symbols defined by linker control file).
7878char * sbrk (int incr ) {
79- static char * currentHeapEnd = & __HeapBase ;
79+ static char * currentHeapEnd = & _end ;
8080 vTaskSuspendAll (); // Note: safe to use before FreeRTOS scheduler started
8181 char * previousHeapEnd = currentHeapEnd ;
82- if (currentHeapEnd + incr > & __HeapLimit ) {
82+ if (currentHeapEnd + incr > & _end + configTOTAL_HEAP_SIZE ) {
8383 #if ( configUSE_MALLOC_FAILED_HOOK == 1 )
8484 {
8585 extern void vApplicationMallocFailedHook ( void );
You can’t perform that action at this time.
0 commit comments