Merge branch 'main' of github.com:ross144/cvw

This commit is contained in:
Rose Thompson 2023-11-21 23:31:21 -06:00
commit e1bcc85f10
11 changed files with 27 additions and 144 deletions

6
.gitmodules vendored
View File

@ -14,9 +14,6 @@
[submodule "addins/coremark"]
path = addins/coremark
url = https://github.com/eembc/coremark
[submodule "addins/branch-predictor-simulator"]
path = addins/branch-predictor-simulator
url = https://github.com/synxlin/branch-predictor-simulator.git
[submodule "addins/FreeRTOS-Kernel"]
path = addins/FreeRTOS-Kernel
url = https://github.com/FreeRTOS/FreeRTOS-Kernel.git
@ -29,3 +26,6 @@
[submodule "addins/riscv-arch-test"]
path = addins/riscv-arch-test
url = https://github.com/riscv-non-isa/riscv-arch-test
[submodule "addins/branch-predictor-simulator"]
path = addins/branch-predictor-simulator
url = https://github.com/ross144/branch-predictor-simulator

@ -1 +1 @@
Subproject commit af0c6f8cb62f48ee43e74c21e799102e03951ce2
Subproject commit 3e424e902f2088d0c9f482f3900ab780affb6350

View File

@ -47,7 +47,7 @@ sudo apt update -y
sudo apt upgrade -y
sudo apt install -y git gawk make texinfo bison flex build-essential python3 libz-dev libexpat-dev autoconf device-tree-compiler ninja-build libpixman-1-dev ncurses-base ncurses-bin libncurses5-dev dialog curl wget ftp libgmp-dev libglib2.0-dev python3-pip pkg-config opam z3 zlib1g-dev automake autotools-dev libmpc-dev libmpfr-dev gperf libtool patchutils bc
# Other python libraries used through the book.
sudo pip3 install matplotlib scipy scikit-learn adjustText lief
sudo pip3 install sphinx sphinx_rtd_theme matplotlib scipy scikit-learn adjustText lief
# needed for Ubuntu 22.04, gcc cross compiler expects python not python2 or python3.
if ! command -v python &> /dev/null

View File

@ -1,5 +1,6 @@
RISCV := /opt/riscv
BUILDROOT := ${RISCV}/buildroot
#BUILDROOT := ${RISCV}/buildroot-test
BUILDROOT := buildroot
IMAGES := ${BUILDROOT}/output/images
WALLY := $(shell dirname $(shell pwd))
WALLYLINUX := $(shell pwd)
@ -18,7 +19,7 @@ DRIVER := ${PACKAGE_SOURCE}/fpga-axi-sdc.c
PATCHFILE := $(BRPACKAGES)/package-2023.05.1.patch
# Device tree files
DTS ?= $(shell find -type f -regex ".*\.dts" | sort)
DTS ?= $(shell find devicetree -type f -regex ".*\.dts" | sort)
DTB := $(DTS:%.dts=%.dtb)
DTB := $(foreach name, $(DTB), $(IMAGES)/$(shell basename $(name)))
@ -29,13 +30,17 @@ OBJDUMPS := $(foreach name, $(OBJDUMPS), $(DIS)/$(name).objdump)
.PHONY: all generate disassemble install clean cleanDTB cleanDriver test
all:
$(MAKE) install
all: download Image disassemble install
Image:
make -C $(BUILDROOT) --jobs
$(MAKE) generate
# TODO: Need to find a way to set the PATH for child processes.
# source ../setup.sh; $(MAKE) disassemble
install:
sudo mv $(BUILDROOT) $(RISCV)/$(BUILDROOT)
# Temp rule for debugging
test:
echo $(shell find $(BUILDROOT)/output/build -maxdepth 2 -type d -regex ".*/linux-[0-9]+\.[0-9]+\.[0-9]+$$")
@ -55,15 +60,20 @@ $(RISCV):
# Disassembly rules ---------------------------------------------------
disassemble:
find $(BUILDROOT)/output/build/linux-* -maxdepth 1 -name "vmlinux" | xargs cp -t $(BUILDROOT)/output/images/
mkdir -p $(DIS)
make -j $(OBJDUMPS)
make -j $(OBJDUMPS).addr
$(DIS)/%.objdump: $(IMAGES)/%.elf
riscv64-unknown-elf-objdump -DS $< >> $@
extractFunctionRadix.sh $@
$(DIS)/%.objdump: $(IMAGES)/%
riscv64-unknown-elf-objdump -S $< >> $@
extractFunctionRadix.sh $@
$(IMAGES)/vmlinux:
linuxDir=$$(find $(BUILDROOT)/output/build -maxdepth 2 -type d -regex ".*/linux-[0-9]+\.[0-9]+\.[0-9]+$$") ;\
@ -76,7 +86,7 @@ $(IMAGES)/busybox:
# Generating new Buildroot directories --------------------------------
# This directive should be run as: make install BUILDROOT=path/to/buildroot
install: $(BUILDROOT)/package/fpga-axi-sdc $(WALLYBOARD)
download: $(BUILDROOT)/package/fpga-axi-sdc $(WALLYBOARD)
cp $(WALLYBOARD)/main.config $(BUILDROOT)/.config
# CONFIG DEPENDENCIES 2023.05.1 ---------------------------------------

View File

@ -1,45 +0,0 @@
BUILDROOT := ${RISCV}/buildroot2023
IMAGES := ${BUILDROOT}/output/images
DIS := ${IMAGES}/disassembly
all:
make disassemble
make generate
generate:
# generating device tree binary
dtc -I dts -O dtb ../devicetree/wally-virt.dts > ${IMAGES}/wally-virt.dtb
dtc -I dts -O dtb ../devicetree/wally-vcu108.dts > ${IMAGES}/wally-vcu108.dtb
disassemble:
mkdir -p ${DIS}
# disassemblies
make -j ${DIS}/fw_jump.objdump ${DIS}/vmlinux.objdump ${DIS}/busybox.objdump ${DIS}/vmlinux.objdump.addr
# filesystem
make ${DIS}/rootfs/bin/busybox
# mkdir -p ${DIS}/rootfs
# -cd ${DIS}/rootfs; cpio -id --nonmatching 'dev/console' < ../../rootfs.cpio
${DIS}/fw_jump.objdump: ${IMAGES}/fw_jump.elf
riscv64-unknown-elf-objdump -S ${IMAGES}/fw_jump.elf >> ${DIS}/fw_jump.objdump
${IMAGES}/vmlinux: ${BUILDROOT}/output/build/linux-5.10.7/vmlinux
cp ${BUILDROOT}/output/build/linux-5.10.7/vmlinux ${IMAGES}/vmlinux
${DIS}/vmlinux.objdump: ${IMAGES}/vmlinux
riscv64-unknown-elf-objdump -S ${IMAGES}/vmlinux >> ${DIS}/vmlinux.objdump
${DIS}/vmlinux.objdump.addr: ${DIS}/vmlinux.objdump
-cd ${DIS}; extractFunctionRadix.sh vmlinux.objdump
${DIS}/busybox.objdump: ${DIS}/rootfs/bin/busybox
riscv64-unknown-elf-objdump -S ${DIS}/rootfs/bin/busybox >> ${DIS}/busybox.objdump
${DIS}/rootfs/bin/busybox:
mkdir -p ${DIS}/rootfs
-cd ${DIS}/rootfs; cpio -id --nonmatching 'dev/console' < ../../rootfs.cpio
clean:
rm -f ${IMAGES}/wally-virt.dtb
rm -rf ${DIS}

View File

@ -1,80 +0,0 @@
script_dir=$(readlink -f ./)
personal_config=$(readlink -f ../buildroot-config-src)
shared_config=$RISCV/buildroot-config-src
if [ -d "$shared_config" ]; then
echo "Hold the horses, friend!" >&2
echo "There is already a buildroot-config-src folder in \$RISCV" >&2
if [ ! -f "$shared_config/.owner" ]; then
echo "Oy vey -- it was improperly created too!" >&2
echo "I see no .owner file in it!" >&2
echo "Maybe just delete it." >&2
exit 1
fi
owner=$(cat $shared_config/.owner)
echo "It was created by $owner." >&2
echo "Please contact them before overwriting their source files." >&2
exit 1
fi
echo "Starting new buildroot session"
# Copy configs to shared location
echo "Elevate permissions to copy ../buildroot-config-src to \$RISCV"
sudo cp -r "$personal_config" "$shared_config"
sudo chown -R cad $shared_config
# Document who created these configs
whoami>.owner
sudo mv .owner $shared_config
# Copy over main.config
echo "Copying main.config to buildroot/.config."
sudo cp $shared_config/main.config $RISCV/buildroot/.config
sudo chown cad $RISCV/buildroot/.config
echo "=============================================="
echo "I'm about to sign you in as cad."
echo ""
echo "You can go straight to the \$RISCV/buildroot"
echo "and run \`make\` if you want."
echo ""
echo "You can also run:"
echo " * \`make menuconfig\`"
echo " * \`make linux-menuconfig\`"
echo " * \`make busybox-menuconfig\`"
echo "but if you do, you have to make extra certain"
echo "that you LOAD and SAVE configs from/to "
echo "\$RISCV/buildroot-config-src."
echo ""
echo "Run \`exit\` to sign out when you are done."
echo "And then any configs that were modified in"
echo "\$RISCV/buildroot-config-src will be copied"
echo "back to ../buildroot-config-src."
echo "=============================================="
read -p "Press any key to sign in as cad" -n1 -s
echo ""
cd $RISCV
sudo su cad
cd $script_dir
echo ""
echo "Ending buildroot session"
if [ ! -d "$shared_config" ]; then
echo "Warning: $shared_config has already been deleted."
exit 0
fi
if [ ! -f "$shared_config/.owner" ]; then
echo "Oy vey -- no .owner file found.">&2
echo "Not sure whether to delete $shared_config.">&2
exit 1
fi
owner=$(cat "$shared_config"/.owner)
if [ $owner != $(whoami) ]; then
echo "Whoah there! It seems $owner created $shared_config.">&2
echo "Ask them before deleting their work.">&2
exit 1
fi
echo "Copying modified configs from \$RISCV/buildroot-config-src back to ../buildroot-config-src."
for file in $personal_config/*; do
file=$(basename $file)
cp $shared_config/$file $personal_config/$file
done
echo "Elevate permissions to remove personal configs from shared location."
sudo rm -r $shared_config

View File

@ -11,7 +11,7 @@ help() {
# defaults
imageDir=$RISCV/buildroot/output/images
DEVICE_TREE=../devicetree/wally-virt.dtb
DEVICE_TREE=${imageDir}/wally-virt.dtb
# Process options and arguments. The following code grabs the single
# sdcard device argument no matter where it is in the positional
@ -36,8 +36,6 @@ done
# File location variables
imageDir=$BUILDROOT/output/images
#imageDir=$RISCV/buildroot/output/images
imageDir=~/repos/buildroot-sept2023/output/images
tvDir=$RISCV/linux-testvectors
tcpPort=1239

View File

@ -8,7 +8,7 @@ rawBootmemFile="$tvDir/bootmemGDB.bin"
bootmemFile="$tvDir/bootmem.bin"
rawUntrimmedBootmemFile="$tvDir/untrimmedBootmemFileGDB.bin"
untrimmedBootmemFile="$tvDir/untrimmedBootmemFile.bin"
DEVICE_TREE=../devicetree/wally-virt.dtb
DEVICE_TREE=${imageDir}/wally-virt.dtb
read -p "Warning: running this script will overwrite the contents of:
* $rawRamFile

View File

@ -2,7 +2,7 @@
imageDir=$RISCV/buildroot/output/images
tvDir=$RISCV/linux-testvectors
recordFile="$tvDir/all.qemu"
DEVICE_TREE=../devicetree/wally-virt.dtb
DEVICE_TREE=${imageDir}/wally-virt.dtb
read -p "Warning: running this script will overwrite $recordFile
Would you like to proceed? (y/n) " -n 1 -r

View File

@ -6,7 +6,7 @@ recordFile="$tvDir/all.qemu"
traceFile="$tvDir/all.txt"
trapsFile="$tvDir/traps.txt"
interruptsFile="$tvDir/interrupts.txt"
DEVICE_TREE=../devicetree/wally-virt.dtb
DEVICE_TREE=${imageDir}/wally-virt.dtb
read -p "Warning: running this script will overwrite the contents of:
* $traceFile

View File

@ -111,10 +111,10 @@ module csrs import cvw::*; #(parameter cvw_t P) (
flopenr #(32) SCOUNTERENreg(clk, reset, WriteSCOUNTERENM, CSRWriteValM[31:0], SCOUNTEREN_REGW);
if (P.SSTC_SUPPORTED) begin : sstc
if (P.XLEN == 64) begin : sstc64
flopenl #(P.XLEN) STIMECMPreg(clk, reset, WriteSTIMECMPM, CSRWriteValM, 64'hFFFFFFFFFFFFFFFF, STIMECMP_REGW);
flopenr #(P.XLEN) STIMECMPreg(clk, reset, WriteSTIMECMPM, CSRWriteValM, STIMECMP_REGW);
end else begin : sstc32
flopenl #(P.XLEN) STIMECMPreg(clk, reset, WriteSTIMECMPM, CSRWriteValM, 32'hFFFFFFFF, STIMECMP_REGW[31:0]);
flopenl #(P.XLEN) STIMECMPHreg(clk, reset, WriteSTIMECMPHM, CSRWriteValM, 32'hFFFFFFFF, STIMECMP_REGW[63:32]);
flopenr #(P.XLEN) STIMECMPreg(clk, reset, WriteSTIMECMPM, CSRWriteValM, STIMECMP_REGW[31:0]);
flopenr #(P.XLEN) STIMECMPHreg(clk, reset, WriteSTIMECMPHM, CSRWriteValM, STIMECMP_REGW[63:32]);
end
end else assign STIMECMP_REGW = 0;