diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2023-10-29 14:38:33 +0200 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2023-10-29 14:38:33 +0200 |
| commit | 5d29afb530ffdaab4b5032b7422da988b31c0867 (patch) | |
| tree | 0135976b951fa4c860a043f07e6d555e40c60d1f /triscv/src/main.c | |
| parent | 80d78c5589d42f81b04e671b28c103a2112458d1 (diff) | |
| download | tri-5d29afb530ffdaab4b5032b7422da988b31c0867.tar.gz tri-5d29afb530ffdaab4b5032b7422da988b31c0867.zip | |
initial working compiled program on simulator
Diffstat (limited to 'triscv/src/main.c')
| -rw-r--r-- | triscv/src/main.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/triscv/src/main.c b/triscv/src/main.c index 87a3b05..37be2cb 100644 --- a/triscv/src/main.c +++ b/triscv/src/main.c @@ -31,7 +31,7 @@ static void usage() fprintf(stderr, cmdline_usage); } -static const char *read_simulation_file(const char *file, size_t *len) +static void *read_simulation_file(const char *file, size_t *len) { FILE *f = fopen(file, "rb"); if (!f) { @@ -55,6 +55,7 @@ static const char *read_simulation_file(const char *file, size_t *len) return NULL; fread(buf, s, 1 , f); + fclose(f); return buf; } @@ -93,7 +94,7 @@ int main(int argc, char *argv[]) /* map one trinary page */ struct mem *mem = mem_create(19683); size_t len = 0; - const char *buf = read_simulation_file(argv[optind], &len); + const uint32_t *buf = read_simulation_file(argv[optind], &len); mem_init(mem, buf, len); mmu_map_dev(mmu, 0, mem_dev(mem)); |
