Add i368-elf-gcc v5.4 crosscompiler

This commit is contained in:
2026-02-23 19:58:18 +01:00
parent 25cb90296f
commit 6ab17c98e9
6 changed files with 212 additions and 74 deletions

35
examples/syscalls.c Normal file
View File

@ -0,0 +1,35 @@
#include <errno.h>
#include <sys/stat.h>
extern char _end; /* provided by linker script */
static char *heap_ptr = &_end;
void *sbrk(int incr) {
char *prev = heap_ptr;
heap_ptr += incr;
return prev;
}
int write(int fd, const char *buf, int len) { return len; }
int read(int fd, char *buf, int len) { return 0; }
int close(int fd) { return -1; }
int fstat(int fd, struct stat *st) {
st->st_mode = S_IFCHR;
return 0;
}
int isatty(int fd) { return 1; }
int lseek(int fd, int offset, int whence) { return 0; }
void _exit(int status) {
while (1)
;
}
void exit(int status) {
while (1)
;
}
int kill(int pid, int sig) {
errno = EINVAL;
return -1;
}
int getpid(void) { return 1; }