mirror of
				https://github.com/openhwgroup/cvw
				synced 2025-02-11 06:05:49 +00:00 
			
		
		
		
	Merge pull request #499 from davidharrishmc/dev
Updated build root, stimecmp
This commit is contained in:
		
						commit
						a042eb5e32
					
				
							
								
								
									
										6
									
								
								.gitmodules
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								.gitmodules
									
									
									
									
										vendored
									
									
								
							@ -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
 | 
			
		||||
@ -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
 | 
			
		||||
 | 
			
		||||
@ -39,7 +39,7 @@ Image:
 | 
			
		||||
	# source ../setup.sh; $(MAKE) disassemble
 | 
			
		||||
 | 
			
		||||
install:
 | 
			
		||||
	sudo cp -r $(BUILDROOT) $(RISCV)/$(BUILDROOT)
 | 
			
		||||
	sudo mv -r $(BUILDROOT) $(RISCV)/$(BUILDROOT)
 | 
			
		||||
 | 
			
		||||
# Temp rule for debugging
 | 
			
		||||
test:
 | 
			
		||||
 | 
			
		||||
@ -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}
 | 
			
		||||
@ -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
 | 
			
		||||
@ -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;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user