添加基础指令解析和运行
This commit is contained in:
37
make_riscv.py
Normal file
37
make_riscv.py
Normal file
@@ -0,0 +1,37 @@
|
||||
|
||||
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")
|
Reference in New Issue
Block a user