missing include added
This commit is contained in:
		@@ -6,17 +6,18 @@
 | 
			
		||||
 */
 | 
			
		||||
#include <reent.h>
 | 
			
		||||
#include <errno.h>
 | 
			
		||||
#include <stdlib.h> /* abort */
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
#include <sys/types.h>
 | 
			
		||||
#include <sys/stat.h>
 | 
			
		||||
 | 
			
		||||
#include <string.h>
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
 | 
			
		||||
#include "stm32f4xx.h"
 | 
			
		||||
 | 
			
		||||
#undef errno
 | 
			
		||||
extern int errno;
 | 
			
		||||
 | 
			
		||||
/* cppcheck-suppress unusedFunction */
 | 
			
		||||
int _kill(int pid, int sig)
 | 
			
		||||
{
 | 
			
		||||
    errno = EINVAL;
 | 
			
		||||
@@ -25,11 +26,7 @@ int _kill(int pid, int sig)
 | 
			
		||||
 | 
			
		||||
void _exit(int status)
 | 
			
		||||
{
 | 
			
		||||
#if 0
 | 
			
		||||
    // TODO: redirect xprintf
 | 
			
		||||
    xprintf("_exit called with parameter %d\n", status);
 | 
			
		||||
#endif
 | 
			
		||||
    while(1) {;}
 | 
			
		||||
    while(1);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int _getpid(void)
 | 
			
		||||
@@ -37,7 +34,6 @@ int _getpid(void)
 | 
			
		||||
    return 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
extern char _end; /* Defined by the linker */
 | 
			
		||||
static char *heap_end;
 | 
			
		||||
 | 
			
		||||
@@ -48,10 +44,7 @@ char* get_heap_end(void)
 | 
			
		||||
 | 
			
		||||
char* get_stack_top(void)
 | 
			
		||||
{
 | 
			
		||||
//    uint32_t result=0;
 | 
			
		||||
 | 
			
		||||
    return (char*) __get_MSP();
 | 
			
		||||
    // return (char*) __get_PSP();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
caddr_t _sbrk(int incr)
 | 
			
		||||
@@ -61,15 +54,9 @@ caddr_t _sbrk(int incr)
 | 
			
		||||
        heap_end = &_end;
 | 
			
		||||
    }
 | 
			
		||||
    prev_heap_end = heap_end;
 | 
			
		||||
#if 1
 | 
			
		||||
    if (heap_end + incr > get_stack_top()) {
 | 
			
		||||
#if 0
 | 
			
		||||
        // TODO: redirect xprintf
 | 
			
		||||
        xprintf("Heap and stack collision\n");
 | 
			
		||||
#endif
 | 
			
		||||
        abort();
 | 
			
		||||
    }
 | 
			
		||||
#endif
 | 
			
		||||
    heap_end += incr;
 | 
			
		||||
    return (caddr_t) prev_heap_end;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user