Add program hex support in uriscv.

This commit is contained in:
colin.liang 2023-01-07 16:15:54 +08:00
parent c2e4068c8a
commit cca9d908ef
2 changed files with 2179 additions and 2 deletions

View File

@ -30,6 +30,7 @@ all: clean verilator
clean: clean:
rm -rf build obj_dir rm -rf build obj_dir
mkdir -p build
##################### Verilog Builds ##################################### ##################### Verilog Builds #####################################
top.v: top.v:
@ -47,7 +48,7 @@ verilator-build: top.v
##################### Simulation Runs ##################################### ##################### Simulation Runs #####################################
verilator: program.hex verilator-build bin verilator: program verilator-build bin
cd build && ../obj_dir/Vsoc_sim ${DEBUG_PLUS} cd build && ../obj_dir/Vsoc_sim ${DEBUG_PLUS}
sim: sim:
@ -55,7 +56,7 @@ sim:
##################### Test hex Build ##################################### ##################### Test hex Build #####################################
program.hex: $(TEST).o $(LINK) program: $(TEST).o $(LINK)
@echo Building $(TEST) @echo Building $(TEST)
$(GCC_PREFIX)-gcc $(ABI) -Wl,-Map=$(BUILD_DIR)/$(TEST).map -lgcc -T$(LINKPRO) -o $(BUILD_DIR)/$(TEST).bin $(BUILD_DIR)/$(TEST).o -nostartfiles $(TEST_LIBS) $(GCC_PREFIX)-gcc $(ABI) -Wl,-Map=$(BUILD_DIR)/$(TEST).map -lgcc -T$(LINKPRO) -o $(BUILD_DIR)/$(TEST).bin $(BUILD_DIR)/$(TEST).o -nostartfiles $(TEST_LIBS)
$(GCC_PREFIX)-objcopy -O verilog $(BUILD_DIR)/$(TEST).bin $(BUILD_DIR)/program.hex $(GCC_PREFIX)-objcopy -O verilog $(BUILD_DIR)/$(TEST).bin $(BUILD_DIR)/program.hex
@ -63,6 +64,9 @@ program.hex: $(TEST).o $(LINK)
$(GCC_PREFIX)-objdump -S $(BUILD_DIR)/$(TEST).bin > $(BUILD_DIR)/$(TEST).dis $(GCC_PREFIX)-objdump -S $(BUILD_DIR)/$(TEST).bin > $(BUILD_DIR)/$(TEST).dis
@echo Completed building $(TEST) @echo Completed building $(TEST)
# program:
# cp ${DEMODIR}/program.hex ./build/
%.o : %.s %.o : %.s
@mkdir -p $(BUILD_DIR) @mkdir -p $(BUILD_DIR)
$(GCC_PREFIX)-cpp -g $< > $(BUILD_DIR)/$*.cpp.s $(GCC_PREFIX)-cpp -g $< > $(BUILD_DIR)/$*.cpp.s

2173
uriscv/demo/program.hex Executable file

File diff suppressed because it is too large Load Diff