Merge branch '78-add-basic-software' into 'AXI-Rewrite'
Resolve "Add Basic Software" Closes #78 See merge request bslathi19/super6502!67
This commit is contained in:
20
.gitignore
vendored
20
.gitignore
vendored
@@ -1,2 +1,22 @@
|
|||||||
.vscode
|
.vscode
|
||||||
.~lock*
|
.~lock*
|
||||||
|
|
||||||
|
.user_venv/
|
||||||
|
|
||||||
|
|
||||||
|
# Software build files
|
||||||
|
*.map
|
||||||
|
*.list
|
||||||
|
*.bin
|
||||||
|
*.o
|
||||||
|
|
||||||
|
|
||||||
|
# Efinix Debugger
|
||||||
|
*.log*
|
||||||
|
*.vcd
|
||||||
|
*.gtkw
|
||||||
|
*debug_profile*
|
||||||
|
|
||||||
|
|
||||||
|
*.mem
|
||||||
|
|
||||||
|
|||||||
@@ -4,12 +4,12 @@ variables:
|
|||||||
stages:
|
stages:
|
||||||
- build
|
- build
|
||||||
|
|
||||||
build hw:
|
build:
|
||||||
stage: build
|
stage: build
|
||||||
tags:
|
tags:
|
||||||
- efinity
|
- efinity
|
||||||
- linux
|
- linux
|
||||||
script:
|
script:
|
||||||
- source init_env.sh
|
- source init_env.sh
|
||||||
- make hw
|
- make
|
||||||
|
|
||||||
|
|||||||
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -4,3 +4,6 @@
|
|||||||
[submodule "hw/super6502_fpga/src/sub/axi_crossbar"]
|
[submodule "hw/super6502_fpga/src/sub/axi_crossbar"]
|
||||||
path = hw/super6502_fpga/src/sub/axi_crossbar
|
path = hw/super6502_fpga/src/sub/axi_crossbar
|
||||||
url = ../axi_crossbar.git
|
url = ../axi_crossbar.git
|
||||||
|
[submodule "sw/toolchain/cc65"]
|
||||||
|
path = sw/toolchain/cc65
|
||||||
|
url = ../cc65.git
|
||||||
|
|||||||
34
Makefile
34
Makefile
@@ -1,9 +1,33 @@
|
|||||||
all: hw
|
ROM_TARGET=test_code/loop_test
|
||||||
|
|
||||||
.PHONY: hw
|
INIT_HEX=hw/super6502_fpga/init_hex.mem
|
||||||
hw:
|
HEX=sw/$(ROM_TARGET)/$(notdir $(ROM_TARGET)).bin
|
||||||
$(MAKE) -C hw
|
|
||||||
|
|
||||||
|
all: fpga_image
|
||||||
|
|
||||||
|
# FPGA
|
||||||
|
.PHONY: fpga_image
|
||||||
|
fpga_image: $(INIT_HEX)
|
||||||
|
$(MAKE) -C hw/super6502_fpga
|
||||||
|
|
||||||
|
|
||||||
|
# SW
|
||||||
|
.PHONY: toolchain
|
||||||
|
toolchain:
|
||||||
|
$(MAKE) -C sw/toolchain/cc65 -j $(shell nproc)
|
||||||
|
|
||||||
|
$(INIT_HEX): toolchain script/generate_rom_image.py $(HEX)
|
||||||
|
python script/generate_rom_image.py -i $(HEX) -o $@
|
||||||
|
|
||||||
|
$(HEX):
|
||||||
|
$(MAKE) -C sw/$(ROM_TARGET) $(notdir $@)
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
$(MAKE) -C hw $@
|
$(MAKE) -C hw/super6502_fpga $@
|
||||||
|
$(MAKE) -C sw/$(ROM_TARGET) clean
|
||||||
|
|
||||||
|
.PHONY: distclean
|
||||||
|
distclean: clean
|
||||||
|
$(MAKE) -C sw/toolchain/cc65 clean
|
||||||
|
|||||||
0
doc/hw/super6502.md
Normal file
0
doc/hw/super6502.md
Normal file
@@ -1,6 +0,0 @@
|
|||||||
all:
|
|
||||||
$(MAKE) -C super6502_fpga
|
|
||||||
|
|
||||||
.PHONY: clean
|
|
||||||
clean:
|
|
||||||
$(MAKE) -C super6502_fpga $@
|
|
||||||
@@ -1,65 +0,0 @@
|
|||||||
@00000000
|
|
||||||
8d00a9
|
|
||||||
200cd02
|
|
||||||
801a03d0
|
|
||||||
fe80f5
|
|
||||||
0
|
|
||||||
0
|
|
||||||
0
|
|
||||||
0
|
|
||||||
0
|
|
||||||
0
|
|
||||||
0
|
|
||||||
0
|
|
||||||
0
|
|
||||||
0
|
|
||||||
0
|
|
||||||
0
|
|
||||||
0
|
|
||||||
0
|
|
||||||
0
|
|
||||||
0
|
|
||||||
0
|
|
||||||
0
|
|
||||||
0
|
|
||||||
0
|
|
||||||
0
|
|
||||||
0
|
|
||||||
0
|
|
||||||
0
|
|
||||||
0
|
|
||||||
0
|
|
||||||
0
|
|
||||||
0
|
|
||||||
0
|
|
||||||
0
|
|
||||||
0
|
|
||||||
0
|
|
||||||
0
|
|
||||||
0
|
|
||||||
0
|
|
||||||
0
|
|
||||||
0
|
|
||||||
0
|
|
||||||
0
|
|
||||||
0
|
|
||||||
0
|
|
||||||
0
|
|
||||||
0
|
|
||||||
0
|
|
||||||
0
|
|
||||||
0
|
|
||||||
0
|
|
||||||
0
|
|
||||||
0
|
|
||||||
0
|
|
||||||
0
|
|
||||||
0
|
|
||||||
0
|
|
||||||
0
|
|
||||||
0
|
|
||||||
0
|
|
||||||
0
|
|
||||||
0
|
|
||||||
ff000000
|
|
||||||
ff00ff00
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
<efx:project xmlns:efx="http://www.efinixinc.com/enf_proj" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="super6502_fpga" description="" last_change_date="Sat Mar 02 2024 10:46:33 PM" location="/home/byron/Projects/super6502/hw/super6502_fpga" sw_version="2023.1.150" last_run_state="pass" last_run_tool="efx_pgm" last_run_flow="bitstream" config_result_in_sync="sync" design_ood="sync" place_ood="sync" route_ood="sync" xsi:schemaLocation="http://www.efinixinc.com/enf_proj enf_proj.xsd">
|
<efx:project xmlns:efx="http://www.efinixinc.com/enf_proj" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="super6502_fpga" description="" last_change_date="Sun Mar 03 2024 14:48:43" location="/home/byron/Projects/super6502/hw/super6502_fpga" sw_version="2023.1.150" last_run_state="pass" last_run_tool="efx_pgm" last_run_flow="bitstream" config_result_in_sync="sync" design_ood="sync" place_ood="sync" route_ood="sync" xsi:schemaLocation="http://www.efinixinc.com/enf_proj enf_proj.xsd">
|
||||||
<efx:device_info>
|
<efx:device_info>
|
||||||
<efx:family name="Trion" />
|
<efx:family name="Trion" />
|
||||||
<efx:device name="T20F256" />
|
<efx:device name="T20F256" />
|
||||||
@@ -81,9 +81,4 @@
|
|||||||
<efx:param name="cold_boot" value="off" value_type="e_bool" />
|
<efx:param name="cold_boot" value="off" value_type="e_bool" />
|
||||||
<efx:param name="cascade" value="off" value_type="e_option" />
|
<efx:param name="cascade" value="off" value_type="e_option" />
|
||||||
</efx:bitstream_generation>
|
</efx:bitstream_generation>
|
||||||
<efx:debugger>
|
|
||||||
<efx:param name="work_dir" value="work_dbg" value_type="e_string" />
|
|
||||||
<efx:param name="auto_instantiation" value="off" value_type="e_bool" />
|
|
||||||
<efx:param name="profile" value="NONE" value_type="e_string" />
|
|
||||||
</efx:debugger>
|
|
||||||
</efx:project>
|
</efx:project>
|
||||||
21
init_env.sh
21
init_env.sh
@@ -8,23 +8,6 @@ export KICAD7_SYMBOL_DIR=$REPO_TOP/hw/kicad_library/symbols
|
|||||||
export KICAD7_3DMODEL_DIR=$REPO_TOP/hw/kicad_library/3dmodels
|
export KICAD7_3DMODEL_DIR=$REPO_TOP/hw/kicad_library/3dmodels
|
||||||
export KICAD7_FOOTPRINT_DIR=$REPO_TOP/hw/kicad_library/footprints
|
export KICAD7_FOOTPRINT_DIR=$REPO_TOP/hw/kicad_library/footprints
|
||||||
|
|
||||||
|
|
||||||
# if [ ! -d "$ENV" ]; then
|
|
||||||
# mkdir -p "$ENV"
|
|
||||||
# fi
|
|
||||||
|
|
||||||
# if [ ! -f "$ENV/efinity-2023.1.150-rhe-x64.tar.bz2" ]; then
|
|
||||||
# scp 192.168.50.101:/export/scratch/efinity-2023.1.150-rhe-x64.tar.bz2 "$ENV"
|
|
||||||
# fi
|
|
||||||
|
|
||||||
# if [ ! -d "$ENV/efinity" ]; then
|
|
||||||
# pv "$ENV/efinity-2023.1.150-rhe-x64.tar.bz2" | tar xj --directory "$ENV"
|
|
||||||
# scp 192.168.50.101:/export/scratch/libffi.so.6 "$ENV/efinity/2023.1/lib/"
|
|
||||||
# fi
|
|
||||||
|
|
||||||
# source "$ENV/efinity/2023.1/bin/setup.sh"
|
|
||||||
# export PATH=$PATH:"$EFXPT_HOME/bin"
|
|
||||||
|
|
||||||
if [ -n "$EFX_SETUP" ]; then
|
if [ -n "$EFX_SETUP" ]; then
|
||||||
source $EFX_SETUP
|
source $EFX_SETUP
|
||||||
else
|
else
|
||||||
@@ -32,7 +15,7 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# python -m venv .user_venv --system-site-packages
|
python3 -m venv .user_venv
|
||||||
# . .user_venv/bin/activate
|
. .user_venv/bin/activate
|
||||||
|
|
||||||
# pip install -r requirements.txt
|
# pip install -r requirements.txt
|
||||||
|
|||||||
40
script/generate_rom_image.py
Normal file
40
script/generate_rom_image.py
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
import getopt
|
||||||
|
import sys
|
||||||
|
|
||||||
|
# ROM size in bytes
|
||||||
|
ROM_SIZE = 2**16
|
||||||
|
DATA_WIDTH = 32
|
||||||
|
|
||||||
|
NUM_ENTRIES = ROM_SIZE // (DATA_WIDTH//8)
|
||||||
|
|
||||||
|
def main(argv):
|
||||||
|
inputfile = ''
|
||||||
|
outputfile = ''
|
||||||
|
opts, args = getopt.getopt(argv,"hi:o:",["ifile=","ofile="])
|
||||||
|
for opt, arg in opts:
|
||||||
|
if opt == '-h':
|
||||||
|
print ('test.py -i <inputfile> -o <outputfile>')
|
||||||
|
sys.exit()
|
||||||
|
elif opt in ("-i", "--ifile"):
|
||||||
|
inputfile = arg
|
||||||
|
elif opt in ("-o", "--ofile"):
|
||||||
|
outputfile = arg
|
||||||
|
|
||||||
|
with open(outputfile, "w") as init_file, open(inputfile, "rb") as hex_file:
|
||||||
|
init_file.write("@00000000\n")
|
||||||
|
|
||||||
|
while True:
|
||||||
|
hex_bytes = hex_file.read(4)
|
||||||
|
if len(hex_bytes) == 0:
|
||||||
|
break
|
||||||
|
|
||||||
|
val = int.from_bytes(hex_bytes, byteorder="little")
|
||||||
|
init_file.write(f"{val:x}\n")
|
||||||
|
|
||||||
|
if len(hex_bytes) < 4:
|
||||||
|
break
|
||||||
|
|
||||||
|
print("Done!")
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main(sys.argv[1:])
|
||||||
39
sw/test_code/loop_test/Makefile
Normal file
39
sw/test_code/loop_test/Makefile
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
CC=../../toolchain/cc65/bin/cl65
|
||||||
|
LD=../../toolchain/cc65/bin/cl65
|
||||||
|
CFLAGS=-T -t none -I. --cpu "65C02"
|
||||||
|
LDFLAGS=-C link.ld -m $(NAME).map
|
||||||
|
|
||||||
|
NAME=loop_test
|
||||||
|
|
||||||
|
BIN=$(NAME).bin
|
||||||
|
HEX=$(NAME).hex
|
||||||
|
|
||||||
|
LISTS=lists
|
||||||
|
|
||||||
|
SRCS=$(wildcard *.s) $(wildcard *.c)
|
||||||
|
SRCS+=$(wildcard **/*.s) $(wildcard **/*.c)
|
||||||
|
OBJS+=$(patsubst %.s,%.o,$(filter %s,$(SRCS)))
|
||||||
|
OBJS+=$(patsubst %.c,%.o,$(filter %c,$(SRCS)))
|
||||||
|
|
||||||
|
# Make sure the kernel linked to correct address, no relocation!
|
||||||
|
all: $(HEX)
|
||||||
|
|
||||||
|
$(HEX): $(BIN)
|
||||||
|
objcopy --input-target=binary --output-target=verilog $(BIN) $(HEX)
|
||||||
|
|
||||||
|
$(BIN): $(OBJS)
|
||||||
|
$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) -o $@
|
||||||
|
|
||||||
|
%.o: %.c $(LISTS)
|
||||||
|
$(CC) $(CFLAGS) -l $(LISTS)/$<.list -c $< -o $@
|
||||||
|
|
||||||
|
%.o: %.s $(LISTS)
|
||||||
|
$(CC) $(CFLAGS) -l $(LISTS)/$<.list -c $< -o $@
|
||||||
|
|
||||||
|
$(LISTS):
|
||||||
|
mkdir -p $(addprefix $(LISTS)/,$(sort $(dir $(SRCS))))
|
||||||
|
|
||||||
|
.PHONY: clean
|
||||||
|
clean:
|
||||||
|
rm -rf $(OBJS) $(BIN) $(HEX) $(LISTS) $(NAME).map
|
||||||
|
|
||||||
30
sw/test_code/loop_test/link.ld
Normal file
30
sw/test_code/loop_test/link.ld
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
MEMORY
|
||||||
|
{
|
||||||
|
RAM: start = $0000, size = $200;
|
||||||
|
ROM: start = $FF00, size = $100, file = %O;
|
||||||
|
}
|
||||||
|
|
||||||
|
SEGMENTS {
|
||||||
|
ZEROPAGE: load = RAM, type = zp, define = yes;
|
||||||
|
DATA: load = ROM, type = rw, define = yes;
|
||||||
|
CODE: load = ROM, type = ro;
|
||||||
|
RODATA: load = ROM, type = ro;
|
||||||
|
VECTORS: load = ROM, type = ro, start = $FFFA;
|
||||||
|
}
|
||||||
|
|
||||||
|
FEATURES {
|
||||||
|
CONDES: segment = STARTUP,
|
||||||
|
type = constructor,
|
||||||
|
label = __CONSTRUCTOR_TABLE__,
|
||||||
|
count = __CONSTRUCTOR_COUNT__;
|
||||||
|
CONDES: segment = STARTUP,
|
||||||
|
type = destructor,
|
||||||
|
label = __DESTRUCTOR_TABLE__,
|
||||||
|
count = __DESTRUCTOR_COUNT__;
|
||||||
|
}
|
||||||
|
|
||||||
|
SYMBOLS {
|
||||||
|
# Define the stack size for the application
|
||||||
|
__STACKSIZE__: value = $0200, type = weak;
|
||||||
|
__STACKSTART__: type = weak, value = $0800; # 2k stack
|
||||||
|
}
|
||||||
26
sw/test_code/loop_test/main.s
Normal file
26
sw/test_code/loop_test/main.s
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
.export _init, _nmi_int, _irq_int
|
||||||
|
|
||||||
|
.segment "VECTORS"
|
||||||
|
|
||||||
|
.addr _nmi_int ; NMI vector
|
||||||
|
.addr _init ; Reset vector
|
||||||
|
.addr _irq_int ; IRQ/BRK vector
|
||||||
|
|
||||||
|
.zeropage
|
||||||
|
tmp: .res 1
|
||||||
|
|
||||||
|
.code
|
||||||
|
|
||||||
|
_nmi_int:
|
||||||
|
_irq_int:
|
||||||
|
|
||||||
|
_init:
|
||||||
|
lda #$00
|
||||||
|
@start:
|
||||||
|
sta tmp
|
||||||
|
cmp tmp
|
||||||
|
bne @end
|
||||||
|
ina
|
||||||
|
bra @start
|
||||||
|
|
||||||
|
@end: bra @end
|
||||||
1
sw/toolchain/cc65
Submodule
1
sw/toolchain/cc65
Submodule
Submodule sw/toolchain/cc65 added at 71b58f7967
Reference in New Issue
Block a user