summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvin <git@vineetk.net>2025-04-17 16:03:17 -0400
committervin <git@vineetk.net>2025-04-17 16:03:17 -0400
commitfa0b37e4e90eed92766273e354d6f7b6d01d3554 (patch)
tree717f28a93dbc83730832e94eed7e371f5beb5c55
parentf267c351b754a8133f4f4a88863a42fc8cb65324 (diff)
add makefile to compile C code easier
-rw-r--r--Makefile15
1 files changed, 15 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..70e8c94
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,15 @@
1CC = riscv32-none-elf-gcc
2CP = riscv32-none-elf-objcopy
3CFLAGS = -fno-pic -nostdlib -fno-delete-null-pointer-checks --param=min-pagesize=0 -O3 -march=rv32i -mabi=ilp32 -Wall -Wextra -pedantic
4
5SRC = fibonacci.c
6ROM = riscvtest_rom_image.txt
7
8all:
9 ${CC} ${CFLAGS} ${SRC}
10 ${CP} -j .text -O binary a.out /dev/stdout \
11 | od -t x4 -w4 - | cut -d' ' -f2 | head -n -1 \
12 > ${ROM}
13
14clean:
15 rm -f a.out