WIP C harness
This commit is contained in:
parent
5f3cbbb8a4
commit
ddefa0cac0
4 changed files with 23 additions and 3 deletions
2
Makefile
2
Makefile
|
@ -57,7 +57,7 @@ tests/btohex.elf: mem.o hex.o debug.o tests/btohex.o
|
||||||
tests/tohex.elf: hex.o tests/tohex.o
|
tests/tohex.elf: hex.o tests/tohex.o
|
||||||
$(LD) -m elf32lriscv -T link.ld $^ -o $@
|
$(LD) -m elf32lriscv -T link.ld $^ -o $@
|
||||||
|
|
||||||
tests/harness.elf: tests/harness.o
|
tests/harness.elf: tests/harness.o tests/charness.o
|
||||||
$(LD) -m elf32lriscv -T link.ld $^ -o $@
|
$(LD) -m elf32lriscv -T link.ld $^ -o $@
|
||||||
|
|
||||||
%.o : %.s
|
%.o : %.s
|
||||||
|
|
8
calc.h
Normal file
8
calc.h
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
#ifndef CALC_H
|
||||||
|
#define CALC_H
|
||||||
|
|
||||||
|
typedef unsigned char bool;
|
||||||
|
typedef unsigned char u8;
|
||||||
|
typedef unsigned int uint;
|
||||||
|
|
||||||
|
#endif
|
11
tests/charness.c
Normal file
11
tests/charness.c
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
#include "../calc.h"
|
||||||
|
|
||||||
|
// TODO: make these pascal strings
|
||||||
|
extern bool streq(u8 *, uint, u8 *, uint);
|
||||||
|
extern int read(u8 *, uint); // read from stdin
|
||||||
|
|
||||||
|
void _start(void) {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
|
|
||||||
.org 0
|
.org 0
|
||||||
# Provide program starting address to linker
|
# Provide program starting address to linker
|
||||||
.global _start
|
.global read
|
||||||
|
.global streq
|
||||||
|
|
||||||
# .extern fmt_decimal
|
# .extern fmt_decimal
|
||||||
|
|
||||||
|
@ -25,7 +26,7 @@ inbuf: .skip 80
|
||||||
|
|
||||||
.text
|
.text
|
||||||
|
|
||||||
_start:
|
_start2:
|
||||||
la a0, inbuf
|
la a0, inbuf
|
||||||
li a1, 80
|
li a1, 80
|
||||||
jal read
|
jal read
|
||||||
|
|
Loading…
Reference in a new issue