We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c3e2de6 commit 14b4dd8Copy full SHA for 14b4dd8
cores/arduino/syscalls.c
@@ -5,6 +5,7 @@
5
*
6
*/
7
8
+#include "stm32_def.h"
9
#if defined ( __GNUC__ ) /* GCC CS3 */
10
#include <sys/stat.h>
11
#endif
@@ -25,8 +26,6 @@ extern size_t uart_debug_write(uint8_t *data, uint32_t size);
25
26
#define UNUSED(x) x ## _UNUSED
27
28
-register char * stack_ptr asm("sp");
29
-
30
__attribute__((weak))
31
caddr_t _sbrk( int incr ) {
32
extern char _estack; /* Defined in the linker script */
@@ -35,7 +34,7 @@ caddr_t _sbrk( int incr ) {
35
34
static char *heap_end = &_end ;
36
char *prev_heap_end = heap_end;
37
38
- if (heap_end + incr > stack_ptr) {
+ if (heap_end + incr > (char *)__get_MSP()) {
39
/* Heap and stack collision */
40
errno = ENOMEM;
41
return (caddr_t) -1;
0 commit comments