SummerCart64/sw/cic/build.sh
2023-11-26 21:16:22 +01:00

34 lines
699 B
Bash
Executable File

#!/bin/bash
set -e
TOOLCHAIN="riscv32-unknown-elf-"
CFLAGS=" \
-march=rv32i \
-mabi=ilp32 \
-Os \
-Wl,--gc-sections \
-ffunction-sections \
-fdata-sections \
-ffreestanding \
-nostartfiles \
-nostdlib \
-nodefaultlibs \
-fno-builtin \
-mcmodel=medany \
"
case "$1" in
all)
${TOOLCHAIN}gcc $CFLAGS -T cic.ld -o cic.elf startup.S cic.c
echo "Size of cic:"
${TOOLCHAIN}size -B -d cic.elf
${TOOLCHAIN}objdump -S -D cic.elf > cic.lst
${TOOLCHAIN}objcopy -O binary cic.elf cic.bin
python3 ./convert.py cic.bin cic.mem
;;
clean)
rm -f cic.elf cic.lst cic.bin cic.mem
;;
esac