2020-02-12 21:06:52 +01:00
|
|
|
#include <stm-periph/uart.h>
|
2020-01-26 15:27:06 +01:00
|
|
|
|
|
|
|
char* _sbrk(int incr) {
|
|
|
|
extern char heap_low; // Defined by the linker
|
|
|
|
extern char heap_top;
|
|
|
|
static char *heap_end;
|
|
|
|
char *prev_heap_end;
|
|
|
|
|
|
|
|
if (heap_end == 0) {
|
|
|
|
heap_end = &heap_low;
|
|
|
|
}
|
|
|
|
prev_heap_end = heap_end;
|
|
|
|
if (heap_end + incr > &heap_top) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
heap_end += incr;
|
|
|
|
return (char*) prev_heap_end;
|
|
|
|
}
|
|
|
|
int _isatty(int fd) {
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
int _close(int fd) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
int _open(int fd) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
int _fstat(void) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
int _lseek(void) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
int _read(void) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
int _write(int fd, const void *buf, int count) {
|
2020-02-10 22:38:24 +01:00
|
|
|
uart_send_array((char*)buf, count);
|
2020-01-26 15:27:06 +01:00
|
|
|
return count;
|
|
|
|
}
|