mirror of
https://github.com/Polprzewodnikowy/SummerCart64.git
synced 2024-11-22 05:59:15 +01:00
small cleanup
This commit is contained in:
parent
c02494855e
commit
b0b1ea309f
10
build.sh
10
build.sh
@ -3,10 +3,10 @@
|
||||
|
||||
PACKAGE_FILE_NAME="SummerCart64"
|
||||
FILES=(
|
||||
"./fw/output_files/SummerCart64.pof"
|
||||
"./hw/v1/ftdi-template.xml"
|
||||
"./fw/output_files/SC64_update.bin"
|
||||
"./fw/output_files/SC64_update.pof"
|
||||
"./hw/ftdi-template.xml"
|
||||
"./sw/cic/UltraCIC-III.hex"
|
||||
"./sw/riscv/build/controller.rom"
|
||||
"./LICENSE"
|
||||
)
|
||||
|
||||
@ -35,6 +35,10 @@ popd
|
||||
pushd fw
|
||||
echo "Building FPGA firmware"
|
||||
quartus_sh --flow compile ./SummerCart64.qpf
|
||||
quartus_cpf -c ./SummerCart64.cof
|
||||
cp output_files/SC64_firmware.pof output_files/SC64_update.pof
|
||||
cat output_files/sc64_firmware_ufm_auto.rpd output_files/sc64_firmware_cfm0_auto.rpd > output_files/SC64_update_LE.bin
|
||||
riscv32-unknown-elf-objcopy -I binary -O binary --reverse-bytes=4 output_files/SC64_update_LE.bin output_files/SC64_update.bin
|
||||
popd
|
||||
|
||||
|
||||
|
@ -1,3 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
docker run --mount type=bind,src="$(pwd)",target="/workdir" ghcr.io/polprzewodnikowy/sc64env:v1.0 /bin/bash ./build.sh
|
||||
docker run \
|
||||
--mount type=bind,src="$(pwd)",target="/workdir" \
|
||||
ghcr.io/polprzewodnikowy/sc64env:v1.0 \
|
||||
/bin/bash -c "./build.sh"
|
||||
|
42
fw/SummerCart64.cof
Normal file
42
fw/SummerCart64.cof
Normal file
@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="US-ASCII" standalone="yes"?>
|
||||
<cof>
|
||||
<output_filename>output_files/SC64_firmware.pof</output_filename>
|
||||
<n_pages>1</n_pages>
|
||||
<width>1</width>
|
||||
<mode>14</mode>
|
||||
<sof_data>
|
||||
<user_name>Page_0</user_name>
|
||||
<page_flags>1</page_flags>
|
||||
<bit0>
|
||||
<sof_filename>output_files/SummerCart64.sof<compress_bitstream>1</compress_bitstream></sof_filename>
|
||||
</bit0>
|
||||
</sof_data>
|
||||
<version>10</version>
|
||||
<create_cvp_file>0</create_cvp_file>
|
||||
<create_hps_iocsr>0</create_hps_iocsr>
|
||||
<auto_create_rpd>1</auto_create_rpd>
|
||||
<rpd_little_endian>0</rpd_little_endian>
|
||||
<options>
|
||||
<map_file>1</map_file>
|
||||
</options>
|
||||
<MAX10_device_options>
|
||||
<por>0</por>
|
||||
<io_pullup>1</io_pullup>
|
||||
<config_from_cfm0_only>0</config_from_cfm0_only>
|
||||
<isp_source>0</isp_source>
|
||||
<verify_protect>0</verify_protect>
|
||||
<epof>0</epof>
|
||||
<ufm_source>2</ufm_source>
|
||||
<ufm_filepath>../sw/n64/build/SummerLoader64.hex</ufm_filepath>
|
||||
<cfm0_filepath>../sw/riscv/build/controller.hex</cfm0_filepath>
|
||||
<cfm0_file_start_addr>305152</cfm0_file_start_addr>
|
||||
</MAX10_device_options>
|
||||
<advanced_options>
|
||||
<ignore_epcs_id_check>1</ignore_epcs_id_check>
|
||||
<ignore_condone_check>2</ignore_condone_check>
|
||||
<plc_adjustment>0</plc_adjustment>
|
||||
<post_chain_bitstream_pad_bytes>-1</post_chain_bitstream_pad_bytes>
|
||||
<post_device_bitstream_pad_bytes>-1</post_device_bitstream_pad_bytes>
|
||||
<bitslice_pre_padding>1</bitslice_pre_padding>
|
||||
</advanced_options>
|
||||
</cof>
|
@ -19,7 +19,7 @@
|
||||
#
|
||||
# Quartus Prime
|
||||
# Version 20.1.1 Build 720 11/11/2020 SJ Lite Edition
|
||||
# Date created = 21:23:28 September 18, 2021
|
||||
# Date created = 23:19:06 October 24, 2021
|
||||
#
|
||||
# -------------------------------------------------------------------------- #
|
||||
#
|
||||
@ -86,7 +86,6 @@ set_global_assignment -name SYSTEMVERILOG_FILE rtl/system/sc64.sv
|
||||
set_global_assignment -name SYSTEMVERILOG_FILE rtl/system/system.sv
|
||||
set_global_assignment -name SYSTEMVERILOG_FILE rtl/usb/usb_ft1248.sv
|
||||
set_global_assignment -name SIGNALTAP_FILE output_files/signaltap.stp
|
||||
set_global_assignment -name SLD_FILE db/signaltap_auto_stripped.stp
|
||||
|
||||
# Pin & Location Assignments
|
||||
# ==========================
|
||||
|
12
fw/build.sh
12
fw/build.sh
@ -1,3 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
docker run --mount type=bind,src="$(pwd)/..",target="/workdir" ghcr.io/polprzewodnikowy/sc64env:v1.0 /bin/bash -c "cd fw && quartus_sh --flow compile ./SummerCart64.qpf"
|
||||
docker run \
|
||||
--mount type=bind,src="$(pwd)/..",target="/workdir" \
|
||||
ghcr.io/polprzewodnikowy/sc64env:v1.0 \
|
||||
/bin/bash -c " \
|
||||
cd fw && \
|
||||
quartus_sh --flow compile ./SummerCart64.qpf && \
|
||||
quartus_cpf -c ./SummerCart64.cof && \
|
||||
cp output_files/SC64_firmware.pof output_files/SC64_update.pof && \
|
||||
cat output_files/sc64_firmware_ufm_auto.rpd output_files/sc64_firmware_cfm0_auto.rpd > output_files/SC64_update_LE.bin && \
|
||||
riscv32-unknown-elf-objcopy -I binary -O binary --reverse-bytes=4 output_files/SC64_update_LE.bin output_files/SC64_update.bin
|
||||
"
|
||||
|
@ -30,7 +30,7 @@ module cpu_cfg (
|
||||
R_SCR: bus.rdata = {
|
||||
cfg.cpu_ready,
|
||||
cfg.cpu_busy,
|
||||
cfg.usb_waiting,
|
||||
1'b0,
|
||||
cfg.cmd_error,
|
||||
21'd0,
|
||||
skip_bootloader,
|
||||
@ -65,7 +65,6 @@ module cpu_cfg (
|
||||
if (sys.reset) begin
|
||||
cfg.cpu_ready <= 1'b0;
|
||||
cfg.cpu_busy <= 1'b0;
|
||||
cfg.usb_waiting <= 1'b0;
|
||||
cfg.cmd_error <= 1'b0;
|
||||
cfg.sdram_switch <= 1'b0;
|
||||
cfg.sdram_writable <= 1'b0;
|
||||
@ -91,9 +90,8 @@ module cpu_cfg (
|
||||
{
|
||||
cfg.cpu_ready,
|
||||
cfg.cpu_busy,
|
||||
cfg.usb_waiting,
|
||||
cfg.cmd_error
|
||||
} <= bus.wdata[31:28];
|
||||
} <= {bus.wdata[31:30], bus.wdata[28]};
|
||||
end
|
||||
if (bus.wmask[0]) begin
|
||||
{
|
||||
|
@ -29,7 +29,7 @@ module n64_cfg (
|
||||
R_SR: bus.rdata = {
|
||||
cfg.cpu_ready,
|
||||
cfg.cpu_busy,
|
||||
cfg.usb_waiting,
|
||||
1'b0,
|
||||
cfg.cmd_error,
|
||||
12'd0
|
||||
};
|
||||
|
@ -2,7 +2,6 @@ interface if_config ();
|
||||
|
||||
logic cpu_ready;
|
||||
logic cpu_busy;
|
||||
logic usb_waiting;
|
||||
logic cmd_error;
|
||||
logic cmd_request;
|
||||
logic [7:0] cmd;
|
||||
@ -38,7 +37,6 @@ interface if_config ();
|
||||
modport n64 (
|
||||
input cpu_ready,
|
||||
input cpu_busy,
|
||||
input usb_waiting,
|
||||
input cmd_error,
|
||||
output cmd_request,
|
||||
output cmd,
|
||||
@ -50,7 +48,6 @@ interface if_config ();
|
||||
modport cpu (
|
||||
output cpu_ready,
|
||||
output cpu_busy,
|
||||
output usb_waiting,
|
||||
output cmd_error,
|
||||
input cmd_request,
|
||||
input cmd,
|
||||
|
2
sw/n64/.gitignore
vendored
2
sw/n64/.gitignore
vendored
@ -1,2 +1,2 @@
|
||||
/build
|
||||
/what
|
||||
*.z64
|
||||
|
@ -1,69 +1,28 @@
|
||||
ROOTDIR = $(N64_INST)
|
||||
|
||||
GCCN64PREFIX = $(ROOTDIR)/bin/mips64-elf-
|
||||
CC = $(GCCN64PREFIX)gcc
|
||||
AS = $(GCCN64PREFIX)as
|
||||
LD = $(GCCN64PREFIX)ld
|
||||
OBJCOPY = $(GCCN64PREFIX)objcopy
|
||||
OBJDUMP = $(GCCN64PREFIX)objdump
|
||||
|
||||
CHKSUM64 = $(ROOTDIR)/bin/chksum64
|
||||
MKSPRITE = $(ROOTDIR)/bin/mksprite
|
||||
N64TOOL = $(ROOTDIR)/bin/n64tool
|
||||
|
||||
HEADER_PATH = $(ROOTDIR)/mips64-elf/lib
|
||||
HEADER_NAME = header
|
||||
|
||||
PROG_NAME = SummerLoader64
|
||||
|
||||
ROM_SIZE = 1028k
|
||||
|
||||
SOURCE_DIR = src
|
||||
BUILD_DIR = build
|
||||
SOURCE_DIR = src
|
||||
PROGRAM_NAME = SummerLoader64
|
||||
|
||||
SRC_DIRS = $(SOURCE_DIR) $(sort $(dir $(wildcard $(SOURCE_DIR)/*/.)))
|
||||
INC_DIRS = $(addprefix -I, . $(SRC_DIRS)) -I./libsc64/inc
|
||||
SRC_FILES = $(wildcard $(patsubst %, %/*.c, . $(SRC_DIRS)))
|
||||
# IMG_FILES = $(wildcard $(patsubst %, %/*.png, . $(SRC_DIRS)))
|
||||
OBJ_FILES = $(addprefix $(BUILD_DIR)/, $(notdir $(IMG_FILES:.png=.o) $(SRC_FILES:.c=.o)))
|
||||
include $(N64_INST)/include/n64.mk
|
||||
|
||||
VPATH = $(SRC_DIRS)
|
||||
src = main.c sc64.c boot.c crc32.c
|
||||
|
||||
COMMONFLAGS = -march=vr4300 -mtune=vr4300
|
||||
ASFLAGS = $(COMMONFLAGS)
|
||||
CFLAGS = $(COMMONFLAGS) -std=gnu11 -Os -Wall -I$(ROOTDIR)/mips64-elf/include $(INC_DIRS) -ffunction-sections -fdata-sections -Wl,--gc-sections
|
||||
LINK_FLAGS = -L$(ROOTDIR)/mips64-elf/lib -ldragon -lc -lm -ldragonsys -Tn64.ld
|
||||
#-L./libsc64/lib -lsc64_libdragon
|
||||
N64_FLAGS = -l $(ROM_SIZE) -h $(HEADER_PATH)/$(HEADER_NAME) -o $(BUILD_DIR)/$(PROG_NAME).z64
|
||||
all: $(BUILD_DIR)/$(PROGRAM_NAME).hex
|
||||
|
||||
all: make_output_dir $(BUILD_DIR)/$(PROG_NAME).z64
|
||||
$(BUILD_DIR)/$(PROGRAM_NAME).elf: $(src:%.c=$(BUILD_DIR)/%.o)
|
||||
|
||||
$(OBJ_FILES): Makefile
|
||||
$(PROGRAM_NAME).z64: N64_ROM_TITLE="$(PROGRAM_NAME)"
|
||||
|
||||
$(BUILD_DIR)/$(PROG_NAME).z64: $(BUILD_DIR)/$(PROG_NAME).elf
|
||||
$(OBJCOPY) $(BUILD_DIR)/$(PROG_NAME).elf $(BUILD_DIR)/$(PROG_NAME).bin -O binary
|
||||
$(OBJDUMP) -S $(BUILD_DIR)/$(PROG_NAME).elf > $(BUILD_DIR)/$(PROG_NAME).lst
|
||||
$(N64TOOL) $(N64_FLAGS) -t $(PROG_NAME) $(BUILD_DIR)/$(PROG_NAME).bin
|
||||
$(CHKSUM64) $(BUILD_DIR)/$(PROG_NAME).z64
|
||||
truncate --size=90k $(BUILD_DIR)/$(PROG_NAME).z64
|
||||
$(OBJCOPY) $(BUILD_DIR)/$(PROG_NAME).z64 $(BUILD_DIR)/$(PROG_NAME).hex -I binary -O ihex
|
||||
|
||||
$(BUILD_DIR)/$(PROG_NAME).elf: $(OBJ_FILES)
|
||||
$(LD) -o $(BUILD_DIR)/$(PROG_NAME).elf $(OBJ_FILES) $(LINK_FLAGS)
|
||||
|
||||
$(BUILD_DIR)/%.o: %.c
|
||||
$(COMPILE.c) $(OUTPUT_OPTION) $<
|
||||
|
||||
# $(BUILD_DIR)/%.sprite: $(IMG_FILES)
|
||||
# $(MKSPRITE) 32 $< $@
|
||||
|
||||
# $(BUILD_DIR)/%.o: $(BUILD_DIR)/%.sprite
|
||||
# $(OBJCOPY) -I binary -O elf32-bigmips -B mips:4000 --rename-section .data=.rodata $< $@
|
||||
|
||||
make_output_dir:
|
||||
$(shell mkdir ./$(BUILD_DIR) 2> /dev/null)
|
||||
$(BUILD_DIR)/$(PROGRAM_NAME).hex: $(PROGRAM_NAME).z64
|
||||
sed 's/\x00*$$//' $(PROGRAM_NAME).z64 > $(BUILD_DIR)/$(PROGRAM_NAME)_stripped.z64
|
||||
@if [ $$(stat -L -c %s $(BUILD_DIR)/$(PROGRAM_NAME)_stripped.z64) -gt 92160 ]; then\
|
||||
echo "\n Error: stripped file size is larger than 90kB thus cannot fit inside FPGA flash.\n"; exit 1;\
|
||||
fi
|
||||
truncate --size=90k $(BUILD_DIR)/$(PROGRAM_NAME)_stripped.z64
|
||||
$(N64_OBJCOPY) -I binary -O ihex $(BUILD_DIR)/$(PROGRAM_NAME)_stripped.z64 $(BUILD_DIR)/$(PROGRAM_NAME).hex
|
||||
|
||||
clean:
|
||||
$(shell rm -rf ./$(BUILD_DIR) 2> /dev/null)
|
||||
rm -rf ./$(BUILD_DIR) ./$(PROGRAM_NAME).z64
|
||||
|
||||
.PHONY: all clean make_output_dir
|
||||
-include $(wildcard $(BUILD_DIR)/*.d)
|
||||
|
||||
.PHONY: all clean
|
||||
|
@ -1,3 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
docker run --mount type=bind,src="$(pwd)",target="/workdir" ghcr.io/polprzewodnikowy/sc64env:v1.0 /bin/bash -c "make clean all"
|
||||
docker run \
|
||||
--mount type=bind,src="$(pwd)",target="/workdir" \
|
||||
ghcr.io/polprzewodnikowy/sc64env:v1.0 \
|
||||
/bin/bash -c "make clean all"
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include "sc64.h"
|
||||
#include "boot/boot.h"
|
||||
#include "boot.h"
|
||||
|
||||
|
||||
int main(void) {
|
||||
|
@ -29,6 +29,7 @@ $(BUILD_DIR)/uc.elf: $(OBJS) SC64.ld
|
||||
$(BUILD_DIR)/controller.rom: $(BUILD_DIR)/uc.elf
|
||||
$(OBJCOPY) -R .bootloader $(BUILD_DIR)/uc.elf $(BUILD_DIR)/controller.elf
|
||||
$(OBJCOPY) -O binary --set-section-flags .bss=alloc,contents $(BUILD_DIR)/controller.elf $(BUILD_DIR)/controller.bin
|
||||
$(OBJCOPY) -I binary -O ihex $(BUILD_DIR)/controller.bin $(BUILD_DIR)/controller.hex
|
||||
python3 tools/bin2rom.py $@ < $(BUILD_DIR)/controller.bin
|
||||
@echo 'Size of controller modules:'
|
||||
@$(SIZE) -B -t --common $(OBJS)
|
||||
|
@ -1,3 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
docker run --mount type=bind,src="$(pwd)",target="/workdir" ghcr.io/polprzewodnikowy/sc64env:v1.0 /bin/bash -c "USER_FLAGS=\"-DDEBUG\" make clean all"
|
||||
docker run \
|
||||
--mount type=bind,src="$(pwd)",target="/workdir" \
|
||||
ghcr.io/polprzewodnikowy/sc64env:v1.0 \
|
||||
/bin/bash -c "USER_FLAGS=\"-DDEBUG\" make clean all"
|
||||
|
Loading…
Reference in New Issue
Block a user