RISC-V: Add gdb sim and newlib nano support. Fix a few misc minor bugs.
This commit is contained in:
@@ -1,3 +1,31 @@
|
||||
#ifdef USING_SIM_SPECS
|
||||
|
||||
// Gdb simulator requires that sbrk be implemented without a syscall.
|
||||
extern char _end[]; /* _end is set in the linker command file */
|
||||
char *heap_ptr;
|
||||
|
||||
/*
|
||||
* sbrk -- changes heap size size. Get nbytes more
|
||||
* RAM. We just increment a pointer in what's
|
||||
* left of memory on the board.
|
||||
*/
|
||||
char *
|
||||
_sbrk (nbytes)
|
||||
int nbytes;
|
||||
{
|
||||
char *base;
|
||||
|
||||
if (!heap_ptr)
|
||||
heap_ptr = (char *)&_end;
|
||||
base = heap_ptr;
|
||||
heap_ptr += nbytes;
|
||||
|
||||
return base;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
// QEMU uses a syscall.
|
||||
#include <machine/syscall.h>
|
||||
#include <sys/types.h>
|
||||
#include "internal_syscall.h"
|
||||
@@ -25,3 +53,4 @@ _sbrk(ptrdiff_t incr)
|
||||
heap_end += incr;
|
||||
return (void *)(heap_end - incr);
|
||||
}
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user