merge main into hifive1

This commit is contained in:
2023-10-04 09:07:16 +02:00
7 changed files with 67 additions and 4 deletions

View File

@ -5,6 +5,7 @@
extern volatile uint32_t tohost;
extern volatile uint32_t fromhost;
void write_hex(int fd, uint32_t hex);
void __wrap__exit(int code)
{

View File

@ -2,8 +2,12 @@
#include <errno.h>
#include "stub.h"
#include "weak_under_alias.h"
int __wrap_close(int fd)
{
return _stub(EBADF);
}
weak_under_alias(close);

View File

@ -4,6 +4,7 @@
#include <unistd.h>
#include <sys/stat.h>
#include "stub.h"
#include "weak_under_alias.h"
int __wrap_fstat(int fd, struct stat* st)
{
@ -14,3 +15,5 @@ int __wrap_fstat(int fd, struct stat* st)
return _stub(EBADF);
}
weak_under_alias(fstat);

View File

@ -4,6 +4,7 @@
#include <unistd.h>
#include <sys/types.h>
#include "stub.h"
#include "weak_under_alias.h"
off_t __wrap_lseek(int fd, off_t ptr, int dir)
{
@ -12,3 +13,6 @@ off_t __wrap_lseek(int fd, off_t ptr, int dir)
return _stub(EBADF);
}
weak_under_alias(lseek);

View File

@ -0,0 +1,28 @@
/* See LICENSE of license details. */
#include <stdint.h>
#include <errno.h>
#include <unistd.h>
#include <sys/types.h>
#include "platform.h"
#include "stub.h"
#include "weak_under_alias.h"
int __wrap_puts(const char *s)
{
while (*s != '\0') {
while (UART0_REG(UART_REG_TXFIFO) & 0x80000000) ;
UART0_REG(UART_REG_TXFIFO) = *s;
if (*s == '\n') {
while (UART0_REG(UART_REG_TXFIFO) & 0x80000000) ;
UART0_REG(UART_REG_TXFIFO) = '\r';
}
++s;
}
return 0;
}
weak_under_alias(puts);

View File

@ -1,6 +1,7 @@
/* See LICENSE of license details. */
#include <stddef.h>
#include "weak_under_alias.h"
void *__wrap_sbrk(ptrdiff_t incr)
{
@ -14,3 +15,5 @@ void *__wrap_sbrk(ptrdiff_t incr)
curbrk += incr;
return curbrk - incr;
}
weak_under_alias(sbrk);