diff --git a/Makefile b/Makefile index 1a8c807..9f8a3ba 100644 --- a/Makefile +++ b/Makefile @@ -10,3 +10,5 @@ clean: (cd host-parallel && make clean) (cd apps && make clean) +world: + make && (cd apps && make) && cp apps/*/*.bin precompiled/ diff --git a/common/uvm32_common_custom.h b/common/uvm32_common_custom.h index 0fb8c94..5e58ce9 100644 --- a/common/uvm32_common_custom.h +++ b/common/uvm32_common_custom.h @@ -1,11 +1,11 @@ // Definitions needed by both host and target -// syscalls for exposed host functions -#define UVM32_SYSCALL_PRINT 0x13A -#define UVM32_SYSCALL_PRINTLN 0x13B -#define UVM32_SYSCALL_PRINTD 0x13C -#define UVM32_SYSCALL_PRINTX 0x13D -#define UVM32_SYSCALL_MILLIS 0x13F -#define UVM32_SYSCALL_PRINTC 0x140 -#define UVM32_SYSCALL_GETC 0x141 +// syscalls for exposed host functions, start at 0 +#define UVM32_SYSCALL_PRINTC 0x00000000 +#define UVM32_SYSCALL_GETC 0x00000001 +#define UVM32_SYSCALL_PRINT 0x00000002 +#define UVM32_SYSCALL_PRINTLN 0x00000003 +#define UVM32_SYSCALL_PRINTD 0x00000004 +#define UVM32_SYSCALL_PRINTX 0x00000005 +#define UVM32_SYSCALL_MILLIS 0x00000006 diff --git a/common/uvm32_sys.h b/common/uvm32_sys.h index e11b236..82dec7d 100644 --- a/common/uvm32_sys.h +++ b/common/uvm32_sys.h @@ -1,5 +1,5 @@ -// System provided UVM32_SYSCALLs -#define UVM32_SYSCALL_HALT 0x138 -#define UVM32_SYSCALL_YIELD 0x139 +// System provided UVM32_SYSCALLs, start at 0x10000000 +#define UVM32_SYSCALL_HALT 0x1000000 +#define UVM32_SYSCALL_YIELD 0x1000001 #include "uvm32_common_custom.h" diff --git a/host-arduino/common/uvm32_common_custom.h b/host-arduino/common/uvm32_common_custom.h index 2c56fb7..5e58ce9 100644 --- a/host-arduino/common/uvm32_common_custom.h +++ b/host-arduino/common/uvm32_common_custom.h @@ -1,10 +1,11 @@ // Definitions needed by both host and target -// CSRs for exposed host functions -#define UVM32_SYSCALL_PRINT 0x13A -#define UVM32_SYSCALL_PRINTLN 0x13B -#define UVM32_SYSCALL_PRINTD 0x13C -#define UVM32_SYSCALL_PRINTX 0x13D -#define UVM32_SYSCALL_MILLIS 0x13F -#define UVM32_SYSCALL_PRINTC 0x140 +// syscalls for exposed host functions, start at 0 +#define UVM32_SYSCALL_PRINTC 0x00000000 +#define UVM32_SYSCALL_GETC 0x00000001 +#define UVM32_SYSCALL_PRINT 0x00000002 +#define UVM32_SYSCALL_PRINTLN 0x00000003 +#define UVM32_SYSCALL_PRINTD 0x00000004 +#define UVM32_SYSCALL_PRINTX 0x00000005 +#define UVM32_SYSCALL_MILLIS 0x00000006 diff --git a/host-arduino/common/uvm32_sys.h b/host-arduino/common/uvm32_sys.h index e11b236..82dec7d 100644 --- a/host-arduino/common/uvm32_sys.h +++ b/host-arduino/common/uvm32_sys.h @@ -1,5 +1,5 @@ -// System provided UVM32_SYSCALLs -#define UVM32_SYSCALL_HALT 0x138 -#define UVM32_SYSCALL_YIELD 0x139 +// System provided UVM32_SYSCALLs, start at 0x10000000 +#define UVM32_SYSCALL_HALT 0x1000000 +#define UVM32_SYSCALL_YIELD 0x1000001 #include "uvm32_common_custom.h" diff --git a/host-arduino/uvm32.cpp b/host-arduino/uvm32.cpp index 687c9ec..e2a1dde 100644 --- a/host-arduino/uvm32.cpp +++ b/host-arduino/uvm32.cpp @@ -154,6 +154,7 @@ uint32_t uvm32_run(uvm32_state_t *vmst, uvm32_evt_t *evt, uint32_t instr_meter) get_safeptr_terminated(vmst, value, 0x00, &vmst->ioevt.data.syscall.val.buf); break; case UVM32_SYSCALL_TYP_U32_RD: + // pass link to r1 for user function to update vmst->ioevt.data.syscall.val.u32p = &vmst->core->regs[11]; break; } @@ -167,6 +168,7 @@ uint32_t uvm32_run(uvm32_state_t *vmst, uvm32_evt_t *evt, uint32_t instr_meter) } // no mapping found if (!syscall_valid) { +printf("BADSYS %08x halt=%08x YIELD=%08x\n", syscall, UVM32_SYSCALL_HALT, UVM32_SYSCALL_YIELD); setStatusErr(vmst, UVM32_ERR_BAD_SYSCALL); } break; diff --git a/host-arduino/uvm32.h b/host-arduino/uvm32.h index 786390f..93796bf 100644 --- a/host-arduino/uvm32.h +++ b/host-arduino/uvm32.h @@ -3,10 +3,7 @@ #include #include - -// "well-known" system UVM32_SYSCALL functions -#define UVM32_SYSCALL_HALT 0x138 -#define UVM32_SYSCALL_YIELD 0x139 +#include "common/uvm32_sys.h" #define LIST_OF_UVM32_ERRS \ X(UVM32_ERR_NONE) \ diff --git a/host-mini/Makefile b/host-mini/Makefile index 3f23026..778761a 100644 --- a/host-mini/Makefile +++ b/host-mini/Makefile @@ -1,5 +1,5 @@ all: - gcc -Wall -DUVM32_MEMORY_SIZE=512 -I../uvm32 -o host-mini ../uvm32/uvm32.c host-mini.c + gcc -Wall -DUVM32_MEMORY_SIZE=512 -I../uvm32 -I../common -o host-mini ../uvm32/uvm32.c host-mini.c clean: rm -f host-mini diff --git a/host-parallel/Makefile b/host-parallel/Makefile index d853710..bdf7b46 100644 --- a/host-parallel/Makefile +++ b/host-parallel/Makefile @@ -1,5 +1,5 @@ all: - gcc -Wall -DUVM32_MEMORY_SIZE=512 -I../uvm32 -o host-parallel ../uvm32/uvm32.c host-parallel.c + gcc -Wall -DUVM32_MEMORY_SIZE=512 -I../uvm32 -I../common -o host-parallel ../uvm32/uvm32.c host-parallel.c clean: rm -f host-parallel diff --git a/host/Makefile b/host/Makefile index 4e137e3..a77caca 100644 --- a/host/Makefile +++ b/host/Makefile @@ -1,5 +1,5 @@ all: - gcc -Wall -Werror -pedantic -std=c99 -O2 -DUVM32_MEMORY_SIZE=32768 -I../uvm32 -o host ../uvm32/uvm32.c host.c + gcc -Wall -Werror -pedantic -std=c99 -O2 -DUVM32_MEMORY_SIZE=32768 -I../uvm32 -I../common -o host ../uvm32/uvm32.c host.c clean: rm -f host diff --git a/precompiled/conio.bin b/precompiled/conio.bin index 97cdf8b..68001a5 100755 Binary files a/precompiled/conio.bin and b/precompiled/conio.bin differ diff --git a/precompiled/hello-asm.bin b/precompiled/hello-asm.bin new file mode 100755 index 0000000..364e10f Binary files /dev/null and b/precompiled/hello-asm.bin differ diff --git a/precompiled/helloworld.bin b/precompiled/helloworld.bin index 07ed4a2..0b14b65 100755 Binary files a/precompiled/helloworld.bin and b/precompiled/helloworld.bin differ diff --git a/precompiled/mandel.bin b/precompiled/mandel.bin index b64645a..d44b267 100755 Binary files a/precompiled/mandel.bin and b/precompiled/mandel.bin differ diff --git a/precompiled/rust-hello.bin b/precompiled/rust-hello.bin new file mode 100755 index 0000000..b759e3d Binary files /dev/null and b/precompiled/rust-hello.bin differ diff --git a/precompiled/sketch.bin b/precompiled/sketch.bin new file mode 100755 index 0000000..abf3805 Binary files /dev/null and b/precompiled/sketch.bin differ diff --git a/precompiled/zigtris.bin b/precompiled/zigtris.bin index 96ccb8f..757a6c1 100755 Binary files a/precompiled/zigtris.bin and b/precompiled/zigtris.bin differ diff --git a/uvm32/uvm32.c b/uvm32/uvm32.c index 5831bd8..ca5df33 100644 --- a/uvm32/uvm32.c +++ b/uvm32/uvm32.c @@ -167,6 +167,7 @@ uint32_t uvm32_run(uvm32_state_t *vmst, uvm32_evt_t *evt, uint32_t instr_meter) } // no mapping found if (!syscall_valid) { +printf("BADSYS %08x halt=%08x YIELD=%08x\n", syscall, UVM32_SYSCALL_HALT, UVM32_SYSCALL_YIELD); setStatusErr(vmst, UVM32_ERR_BAD_SYSCALL); } break; diff --git a/uvm32/uvm32.h b/uvm32/uvm32.h index 786390f..c7e487b 100644 --- a/uvm32/uvm32.h +++ b/uvm32/uvm32.h @@ -3,10 +3,7 @@ #include #include - -// "well-known" system UVM32_SYSCALL functions -#define UVM32_SYSCALL_HALT 0x138 -#define UVM32_SYSCALL_YIELD 0x139 +#include "uvm32_sys.h" #define LIST_OF_UVM32_ERRS \ X(UVM32_ERR_NONE) \