diff --git a/apps/self/Makefile b/apps/self/Makefile index 44d34fe..7c6cf20 100644 --- a/apps/self/Makefile +++ b/apps/self/Makefile @@ -2,7 +2,9 @@ TOPDIR=../../ PROJECT:=$(shell basename ${PWD}) SRCS=${PROJECT}.c ${TOPDIR}/apps/crt0.S ${TOPDIR}/uvm32/uvm32.c CFLAGS=-DUVM32_MEMORY_SIZE=8192 -DCUSTOM_STDLIB_H=\"uvm32_target.h\" -I../../uvm32 -all: all_common +all: + xxd -n mandel -i ${TOPDIR}/precompiled/mandel.bin | sed -e "s/unsigned char/const unsigned char/" > mandel.h + make all_common test: test_common clean: clean_common include ${TOPDIR}/apps/makefile.common diff --git a/apps/self/mandel.h b/apps/self/mandel.h new file mode 100644 index 0000000..21f8d81 --- /dev/null +++ b/apps/self/mandel.h @@ -0,0 +1,28 @@ +const unsigned char mandel[] = { + 0x17, 0x05, 0x00, 0x00, 0x13, 0x05, 0x05, 0x13, 0xb7, 0x08, 0x00, 0x01, + 0x93, 0x88, 0x28, 0x00, 0x73, 0x00, 0x00, 0x00, 0x23, 0x26, 0x11, 0x00, + 0xef, 0x00, 0xc0, 0x00, 0xb7, 0x08, 0x00, 0x01, 0x73, 0x00, 0x00, 0x00, + 0x13, 0x01, 0x01, 0xff, 0x23, 0x26, 0x81, 0x00, 0x37, 0xf5, 0xff, 0xff, + 0xb7, 0x15, 0x00, 0x00, 0x37, 0xe6, 0xff, 0xff, 0x13, 0x07, 0xf0, 0x01, + 0xb7, 0x47, 0x00, 0x00, 0xb7, 0x06, 0x00, 0x01, 0x13, 0x08, 0xd5, 0xcc, + 0x93, 0x82, 0x35, 0x33, 0x13, 0x03, 0x76, 0xe6, 0x93, 0x83, 0x35, 0xb3, + 0x13, 0x86, 0x16, 0x00, 0x63, 0xce, 0x02, 0x09, 0x13, 0x0e, 0x03, 0x00, + 0x63, 0xce, 0x63, 0x06, 0x93, 0x0f, 0x00, 0x00, 0x13, 0x0f, 0x00, 0x00, + 0x13, 0x04, 0x00, 0x00, 0x93, 0x0e, 0x00, 0x00, 0x93, 0x06, 0x00, 0x02, + 0x13, 0x85, 0x06, 0xfe, 0x63, 0x64, 0xa7, 0x04, 0x33, 0x05, 0xff, 0x01, + 0x63, 0xe0, 0xa7, 0x04, 0x13, 0x05, 0x00, 0x00, 0x93, 0x05, 0x00, 0x00, + 0x93, 0x08, 0x06, 0x00, 0xb3, 0x8e, 0x8e, 0x02, 0x33, 0x0f, 0xff, 0x41, + 0x13, 0xd4, 0xbe, 0x40, 0xb3, 0x0e, 0xcf, 0x01, 0x73, 0x00, 0x00, 0x00, + 0x33, 0x04, 0x04, 0x01, 0x33, 0x85, 0xde, 0x03, 0x13, 0x5f, 0xc5, 0x00, + 0x33, 0x05, 0x84, 0x02, 0x93, 0x5f, 0xc5, 0x00, 0x93, 0x86, 0x16, 0x00, + 0x6f, 0xf0, 0x9f, 0xfb, 0x13, 0x85, 0x06, 0x00, 0x93, 0x05, 0x00, 0x00, + 0x93, 0x08, 0x00, 0x00, 0x73, 0x00, 0x00, 0x00, 0x13, 0x0e, 0x1e, 0x09, + 0xe3, 0xd6, 0xc3, 0xf9, 0x13, 0x05, 0xa0, 0x00, 0x93, 0x05, 0x00, 0x00, + 0x93, 0x08, 0x00, 0x00, 0x73, 0x00, 0x00, 0x00, 0x13, 0x08, 0x98, 0x19, + 0xe3, 0xd6, 0x02, 0xf7, 0x37, 0x05, 0x00, 0x80, 0x13, 0x05, 0x05, 0x12, + 0x93, 0x08, 0x30, 0x00, 0x93, 0x05, 0x00, 0x00, 0x73, 0x00, 0x00, 0x00, + 0x03, 0x24, 0xc1, 0x00, 0x13, 0x01, 0x01, 0x01, 0x67, 0x80, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x00 +}; +unsigned int mandel_len = 300; diff --git a/apps/self/self.c b/apps/self/self.c index fa98ab9..3d52881 100644 --- a/apps/self/self.c +++ b/apps/self/self.c @@ -1,32 +1,7 @@ #include "uvm32_target.h" #include "uvm32.h" #include "../common/uvm32_common_custom.h" - -uint8_t rom[] = { // mandel.bin - 0x23, 0x26, 0x11, 0x00, 0xef, 0x00, 0xc0, 0x00, 0xb7, 0x08, 0x00, 0x01, - 0x73, 0x00, 0x00, 0x00, 0x13, 0x01, 0x01, 0xff, 0x23, 0x26, 0x81, 0x00, - 0x37, 0xf5, 0xff, 0xff, 0xb7, 0x15, 0x00, 0x00, 0x37, 0xe6, 0xff, 0xff, - 0x13, 0x07, 0xf0, 0x01, 0xb7, 0x47, 0x00, 0x00, 0xb7, 0x06, 0x00, 0x01, - 0x13, 0x08, 0xd5, 0xcc, 0x93, 0x82, 0x35, 0x33, 0x13, 0x03, 0x76, 0xe6, - 0x93, 0x83, 0x35, 0xb3, 0x13, 0x86, 0x16, 0x00, 0x63, 0xce, 0x02, 0x09, - 0x13, 0x0e, 0x03, 0x00, 0x63, 0xce, 0x63, 0x06, 0x93, 0x0f, 0x00, 0x00, - 0x13, 0x0f, 0x00, 0x00, 0x13, 0x04, 0x00, 0x00, 0x93, 0x0e, 0x00, 0x00, - 0x93, 0x06, 0x00, 0x02, 0x13, 0x85, 0x06, 0xfe, 0x63, 0x64, 0xa7, 0x04, - 0x33, 0x05, 0xff, 0x01, 0x63, 0xe0, 0xa7, 0x04, 0x13, 0x05, 0x00, 0x00, - 0x93, 0x05, 0x00, 0x00, 0x93, 0x08, 0x06, 0x00, 0xb3, 0x8e, 0x8e, 0x02, - 0x33, 0x0f, 0xff, 0x41, 0x13, 0xd4, 0xbe, 0x40, 0xb3, 0x0e, 0xcf, 0x01, - 0x73, 0x00, 0x00, 0x00, 0x33, 0x04, 0x04, 0x01, 0x33, 0x85, 0xde, 0x03, - 0x13, 0x5f, 0xc5, 0x00, 0x33, 0x05, 0x84, 0x02, 0x93, 0x5f, 0xc5, 0x00, - 0x93, 0x86, 0x16, 0x00, 0x6f, 0xf0, 0x9f, 0xfb, 0x13, 0x85, 0x06, 0x00, - 0x93, 0x05, 0x00, 0x00, 0x93, 0x08, 0x00, 0x00, 0x73, 0x00, 0x00, 0x00, - 0x13, 0x0e, 0x1e, 0x09, 0xe3, 0xd6, 0xc3, 0xf9, 0x13, 0x05, 0xa0, 0x00, - 0x93, 0x05, 0x00, 0x00, 0x93, 0x08, 0x00, 0x00, 0x73, 0x00, 0x00, 0x00, - 0x13, 0x08, 0x98, 0x19, 0xe3, 0xd6, 0x02, 0xf7, 0x37, 0x05, 0x00, 0x80, - 0x13, 0x05, 0x05, 0x10, 0x93, 0x08, 0x30, 0x00, 0x93, 0x05, 0x00, 0x00, - 0x73, 0x00, 0x00, 0x00, 0x03, 0x24, 0xc1, 0x00, 0x13, 0x01, 0x01, 0x01, - 0x67, 0x80, 0x00, 0x00, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x77, 0x6f, - 0x72, 0x6c, 0x64, 0x00 -}; +#include "mandel.h" void main(void) { uvm32_state_t vmst; @@ -34,7 +9,7 @@ void main(void) { bool isrunning = true; uvm32_init(&vmst); - uvm32_load(&vmst, rom, sizeof(rom)); + uvm32_load(&vmst, mandel, mandel_len); while(isrunning) { uvm32_run(&vmst, &evt, 100); // num instructions before vm considered hung diff --git a/host-mini/Makefile b/host-mini/Makefile index 26b105f..a462722 100644 --- a/host-mini/Makefile +++ b/host-mini/Makefile @@ -1,4 +1,5 @@ all: + xxd -n mandel -i ../precompiled/mandel.bin | sed -e "s/unsigned char/const unsigned char/" > mandel.h gcc -Wall -DUVM32_MEMORY_SIZE=512 -O2 -I../uvm32 -I../common -o host-mini ../uvm32/uvm32.c host-mini.c clean: diff --git a/host-mini/host-mini.c b/host-mini/host-mini.c index a9eb539..9498823 100644 --- a/host-mini/host-mini.c +++ b/host-mini/host-mini.c @@ -3,32 +3,7 @@ #include #include "uvm32.h" #include "../common/uvm32_common_custom.h" - -uint8_t rom[] = { // mandel.bin - 0x23, 0x26, 0x11, 0x00, 0xef, 0x00, 0xc0, 0x00, 0xb7, 0x08, 0x00, 0x01, - 0x73, 0x00, 0x00, 0x00, 0x13, 0x01, 0x01, 0xff, 0x23, 0x26, 0x81, 0x00, - 0x37, 0xf5, 0xff, 0xff, 0xb7, 0x15, 0x00, 0x00, 0x37, 0xe6, 0xff, 0xff, - 0x13, 0x07, 0xf0, 0x01, 0xb7, 0x47, 0x00, 0x00, 0xb7, 0x06, 0x00, 0x01, - 0x13, 0x08, 0xd5, 0xcc, 0x93, 0x82, 0x35, 0x33, 0x13, 0x03, 0x76, 0xe6, - 0x93, 0x83, 0x35, 0xb3, 0x13, 0x86, 0x16, 0x00, 0x63, 0xce, 0x02, 0x09, - 0x13, 0x0e, 0x03, 0x00, 0x63, 0xce, 0x63, 0x06, 0x93, 0x0f, 0x00, 0x00, - 0x13, 0x0f, 0x00, 0x00, 0x13, 0x04, 0x00, 0x00, 0x93, 0x0e, 0x00, 0x00, - 0x93, 0x06, 0x00, 0x02, 0x13, 0x85, 0x06, 0xfe, 0x63, 0x64, 0xa7, 0x04, - 0x33, 0x05, 0xff, 0x01, 0x63, 0xe0, 0xa7, 0x04, 0x13, 0x05, 0x00, 0x00, - 0x93, 0x05, 0x00, 0x00, 0x93, 0x08, 0x06, 0x00, 0xb3, 0x8e, 0x8e, 0x02, - 0x33, 0x0f, 0xff, 0x41, 0x13, 0xd4, 0xbe, 0x40, 0xb3, 0x0e, 0xcf, 0x01, - 0x73, 0x00, 0x00, 0x00, 0x33, 0x04, 0x04, 0x01, 0x33, 0x85, 0xde, 0x03, - 0x13, 0x5f, 0xc5, 0x00, 0x33, 0x05, 0x84, 0x02, 0x93, 0x5f, 0xc5, 0x00, - 0x93, 0x86, 0x16, 0x00, 0x6f, 0xf0, 0x9f, 0xfb, 0x13, 0x85, 0x06, 0x00, - 0x93, 0x05, 0x00, 0x00, 0x93, 0x08, 0x00, 0x00, 0x73, 0x00, 0x00, 0x00, - 0x13, 0x0e, 0x1e, 0x09, 0xe3, 0xd6, 0xc3, 0xf9, 0x13, 0x05, 0xa0, 0x00, - 0x93, 0x05, 0x00, 0x00, 0x93, 0x08, 0x00, 0x00, 0x73, 0x00, 0x00, 0x00, - 0x13, 0x08, 0x98, 0x19, 0xe3, 0xd6, 0x02, 0xf7, 0x37, 0x05, 0x00, 0x80, - 0x13, 0x05, 0x05, 0x10, 0x93, 0x08, 0x30, 0x00, 0x93, 0x05, 0x00, 0x00, - 0x73, 0x00, 0x00, 0x00, 0x03, 0x24, 0xc1, 0x00, 0x13, 0x01, 0x01, 0x01, - 0x67, 0x80, 0x00, 0x00, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x77, 0x6f, - 0x72, 0x6c, 0x64, 0x00 -}; +#include "mandel.h" int main(int argc, char *argv[]) { uvm32_state_t vmst; @@ -36,7 +11,7 @@ int main(int argc, char *argv[]) { bool isrunning = true; uvm32_init(&vmst); - uvm32_load(&vmst, rom, sizeof(rom)); + uvm32_load(&vmst, mandel, mandel_len); while(isrunning) { uvm32_run(&vmst, &evt, 100); // num instructions before vm considered hung diff --git a/host-mini/mandel.h b/host-mini/mandel.h new file mode 100644 index 0000000..21f8d81 --- /dev/null +++ b/host-mini/mandel.h @@ -0,0 +1,28 @@ +const unsigned char mandel[] = { + 0x17, 0x05, 0x00, 0x00, 0x13, 0x05, 0x05, 0x13, 0xb7, 0x08, 0x00, 0x01, + 0x93, 0x88, 0x28, 0x00, 0x73, 0x00, 0x00, 0x00, 0x23, 0x26, 0x11, 0x00, + 0xef, 0x00, 0xc0, 0x00, 0xb7, 0x08, 0x00, 0x01, 0x73, 0x00, 0x00, 0x00, + 0x13, 0x01, 0x01, 0xff, 0x23, 0x26, 0x81, 0x00, 0x37, 0xf5, 0xff, 0xff, + 0xb7, 0x15, 0x00, 0x00, 0x37, 0xe6, 0xff, 0xff, 0x13, 0x07, 0xf0, 0x01, + 0xb7, 0x47, 0x00, 0x00, 0xb7, 0x06, 0x00, 0x01, 0x13, 0x08, 0xd5, 0xcc, + 0x93, 0x82, 0x35, 0x33, 0x13, 0x03, 0x76, 0xe6, 0x93, 0x83, 0x35, 0xb3, + 0x13, 0x86, 0x16, 0x00, 0x63, 0xce, 0x02, 0x09, 0x13, 0x0e, 0x03, 0x00, + 0x63, 0xce, 0x63, 0x06, 0x93, 0x0f, 0x00, 0x00, 0x13, 0x0f, 0x00, 0x00, + 0x13, 0x04, 0x00, 0x00, 0x93, 0x0e, 0x00, 0x00, 0x93, 0x06, 0x00, 0x02, + 0x13, 0x85, 0x06, 0xfe, 0x63, 0x64, 0xa7, 0x04, 0x33, 0x05, 0xff, 0x01, + 0x63, 0xe0, 0xa7, 0x04, 0x13, 0x05, 0x00, 0x00, 0x93, 0x05, 0x00, 0x00, + 0x93, 0x08, 0x06, 0x00, 0xb3, 0x8e, 0x8e, 0x02, 0x33, 0x0f, 0xff, 0x41, + 0x13, 0xd4, 0xbe, 0x40, 0xb3, 0x0e, 0xcf, 0x01, 0x73, 0x00, 0x00, 0x00, + 0x33, 0x04, 0x04, 0x01, 0x33, 0x85, 0xde, 0x03, 0x13, 0x5f, 0xc5, 0x00, + 0x33, 0x05, 0x84, 0x02, 0x93, 0x5f, 0xc5, 0x00, 0x93, 0x86, 0x16, 0x00, + 0x6f, 0xf0, 0x9f, 0xfb, 0x13, 0x85, 0x06, 0x00, 0x93, 0x05, 0x00, 0x00, + 0x93, 0x08, 0x00, 0x00, 0x73, 0x00, 0x00, 0x00, 0x13, 0x0e, 0x1e, 0x09, + 0xe3, 0xd6, 0xc3, 0xf9, 0x13, 0x05, 0xa0, 0x00, 0x93, 0x05, 0x00, 0x00, + 0x93, 0x08, 0x00, 0x00, 0x73, 0x00, 0x00, 0x00, 0x13, 0x08, 0x98, 0x19, + 0xe3, 0xd6, 0x02, 0xf7, 0x37, 0x05, 0x00, 0x80, 0x13, 0x05, 0x05, 0x12, + 0x93, 0x08, 0x30, 0x00, 0x93, 0x05, 0x00, 0x00, 0x73, 0x00, 0x00, 0x00, + 0x03, 0x24, 0xc1, 0x00, 0x13, 0x01, 0x01, 0x01, 0x67, 0x80, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x00 +}; +unsigned int mandel_len = 300; diff --git a/precompiled/maze.bin b/precompiled/maze.bin index 326826e..bd2a26e 100755 Binary files a/precompiled/maze.bin and b/precompiled/maze.bin differ diff --git a/precompiled/self.bin b/precompiled/self.bin index f01a530..46ba41c 100755 Binary files a/precompiled/self.bin and b/precompiled/self.bin differ