38 lines
541 B
Python
38 lines
541 B
Python
|
|
import os
|
|
import sys
|
|
import time
|
|
|
|
|
|
|
|
|
|
|
|
CC="riscv64-unknown-elf-gcc"
|
|
OBJ="riscv64-unknown-elf-objcopy"
|
|
|
|
CFLAG=[
|
|
"-march=rv32i",
|
|
"-mabi=ilp32",
|
|
"-ffunction-sections",
|
|
"-fdata-sections",
|
|
"-ffast-math",
|
|
"-fno-common",
|
|
"-fno-builtin-printf",
|
|
"-Wall",
|
|
"-Werror",
|
|
"-g",
|
|
"-Os",
|
|
"-fno-omit-frame-pointer",
|
|
"-msave-restore"
|
|
]
|
|
|
|
SRC=[
|
|
"riscv/main.c"
|
|
]
|
|
|
|
TARGET="riscv"
|
|
|
|
if __name__ == "__main__":
|
|
os.system(f"{CC} {' '.join(CFLAG)} {' '.join(SRC)} -o {TARGET}.elf")
|
|
os.system(f"{OBJ} -O binary {TARGET}.elf {TARGET}.bin")
|