diff --git a/fpga/proberange b/fpga/proberange index a5eccb7f9..715cba46e 100755 --- a/fpga/proberange +++ b/fpga/proberange @@ -1,4 +1,28 @@ #!/usr/bin/python3 +########################################### +## proberange.sh +## +## Written: Jacob Pease jacobpease@protonmail.com +## Created: 6 April 2023 +## Modified: 16 August 2023 +## +## A component of the CORE-V-WALLY configurable RISC-V project. +## +## Copyright (C) 2021-23 Harvey Mudd College & Oklahoma State University +## +## SPDX-License-Identifier: Apache-2.0 WITH SHL-2.1 +## +## Licensed under the Solderpad Hardware License v 2.1 (the “License”); you may not use this file +## except in compliance with the License, or, at your option, the Apache License version 2.0. You +## may obtain a copy of the License at +## +## https:##solderpad.org#licenses#SHL-2.1# +## +## Unless required by applicable law or agreed to in writing, any work distributed under the +## License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +## either express or implied. See the License for the specific language governing permissions +## and limitations under the License. +################################################################################################ import sys diff --git a/fpga/probes b/fpga/probes index 5868bc80f..83c2ddf7c 100755 --- a/fpga/probes +++ b/fpga/probes @@ -1,4 +1,28 @@ #!/usr/bin/python3 +########################################### +## probe.sh +## +## Written: Jacob Pease jacobpease@protonmail.com +## Created: 6 April 2023 +## Modified: 16 August 2023 +## +## A component of the CORE-V-WALLY configurable RISC-V project. +## +## Copyright (C) 2021-23 Harvey Mudd College & Oklahoma State University +## +## SPDX-License-Identifier: Apache-2.0 WITH SHL-2.1 +## +## Licensed under the Solderpad Hardware License v 2.1 (the “License”); you may not use this file +## except in compliance with the License, or, at your option, the Apache License version 2.0. You +## may obtain a copy of the License at +## +## https:##solderpad.org#licenses#SHL-2.1# +## +## Unless required by applicable law or agreed to in writing, any work distributed under the +## License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +## either express or implied. See the License for the specific language governing permissions +## and limitations under the License. +################################################################################################ import sys diff --git a/linux/buildroot-config-src/buildroot-2023.05.1/linux.config b/linux/buildroot-config-src/buildroot-2023.05.1/linux.config index aa0a5480b..f4f0fa169 100644 --- a/linux/buildroot-config-src/buildroot-2023.05.1/linux.config +++ b/linux/buildroot-config-src/buildroot-2023.05.1/linux.config @@ -213,7 +213,6 @@ CONFIG_GENERIC_HWEIGHT=y CONFIG_FIX_EARLYCON_MEM=y CONFIG_PGTABLE_LEVELS=5 CONFIG_LOCKDEP_SUPPORT=y -CONFIG_RISCV_DMA_NONCOHERENT=y CONFIG_AS_HAS_INSN=y # @@ -246,8 +245,8 @@ CONFIG_MODULE_SECTIONS=y CONFIG_TUNE_GENERIC=y CONFIG_RISCV_ALTERNATIVE=y CONFIG_RISCV_ISA_C=y -CONFIG_RISCV_ISA_SVPBMT=y -CONFIG_RISCV_ISA_ZICBOM=y +# CONFIG_RISCV_ISA_SVPBMT is not set +# CONFIG_RISCV_ISA_ZICBOM is not set CONFIG_TOOLCHAIN_HAS_ZIHINTPAUSE=y CONFIG_TOOLCHAIN_NEEDS_EXPLICIT_ZICSR_ZIFENCEI=y CONFIG_FPU=y @@ -1427,22 +1426,14 @@ CONFIG_CRC32_SLICEBY8=y CONFIG_ZLIB_INFLATE=y # CONFIG_XZ_DEC is not set CONFIG_DECOMPRESS_GZIP=y -CONFIG_GENERIC_ALLOCATOR=y CONFIG_HAS_IOMEM=y CONFIG_HAS_IOPORT_MAP=y CONFIG_HAS_DMA=y CONFIG_NEED_DMA_MAP_STATE=y CONFIG_ARCH_DMA_ADDR_T_64BIT=y CONFIG_DMA_DECLARE_COHERENT=y -CONFIG_ARCH_HAS_SETUP_DMA_OPS=y -CONFIG_ARCH_HAS_SYNC_DMA_FOR_DEVICE=y -CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU=y -CONFIG_ARCH_HAS_DMA_PREP_COHERENT=y CONFIG_SWIOTLB=y # CONFIG_DMA_RESTRICTED_POOL is not set -CONFIG_DMA_NONCOHERENT_MMAP=y -CONFIG_DMA_COHERENT_POOL=y -CONFIG_DMA_DIRECT_REMAP=y # CONFIG_DMA_API_DEBUG is not set # CONFIG_DMA_MAP_BENCHMARK is not set # CONFIG_IRQ_POLL is not set diff --git a/linux/sdcard/flash-sd.sh b/linux/sdcard/flash-sd.sh index f41fdfe7d..d57347698 100755 --- a/linux/sdcard/flash-sd.sh +++ b/linux/sdcard/flash-sd.sh @@ -4,14 +4,18 @@ # set -e # Output colors -GREEN='\033[1;32m' -RED='\033[1;31m' -NC='\033[0m' -NAME="$GREEN"${0:2}"$NC" +GREEN="\e[32m" +RED="\e[31m" +BOLDRED="\e[1;91m" +BOLDGREEN="\e[1;32m" +NC="\e[0m" +NAME="$BOLDGREEN"${0:2}:"$NC" +ERRORTEXT="$BOLDRED"ERROR:"$NC" # File location variables RISCV=/opt/riscv -IMAGES=$RISCV/buildroot/output/images/ +BUILDROOT=$RISCV/buildroot +IMAGES=$BUILDROOT/output/images FW_JUMP=$IMAGES/fw_jump.bin LINUX_KERNEL=$IMAGES/Image DEVICE_TREE=$IMAGES/wally-vcu108.dtb @@ -19,31 +23,61 @@ DEVICE_TREE=$IMAGES/wally-vcu108.dtb # Mount Directory MNT_DIR=wallyimg +# Usage function +usage() { echo "Usage: $0 [-z] [-b ] " 1>&2; exit 1; } + +# Process options and arguments. The following code grabs the single +# sdcard device argument no matter where it is in the positional +# parameters list. +ARGS=() +while [ $OPTIND -le "$#" ] ; do + if getopts "hzb:" arg ; then + case "${arg}" in + h) usage + ;; + z) WIPECARD=y + ;; + b) BUILDROOT=${OPTARG} + ;; + esac + else + ARGS+=("${!OPTIND}") + ((OPTIND++)) + fi +done + +SDCARD=${ARGS[0]} + if [ "$#" -eq "0" ] ; then - echo "$NAME: $RED ERROR $NC: You must supply the SD card device." - echo "usage: ./flash-sd.sh " + usage +fi + +# Check to make sure sd card device exists + +if [ ! -e "$SDCARD" ] ; then + echo -e "$NAME $ERRORTEXT SD card device does not exist." exit 1 fi -if [ ! -e "$1" ] ; then - echo "$NAME:$RED ERROR $NC: SD card device does not exist." - exit 1 -fi - -if [ ! -z "$2" ] ; then - MNT_DIR=$2 -fi - -# If images are not built, exit -if [ ! -e $FW_JUMP ] || [ ! -e $LINUX_KERNEL ] ; then - echo 'ERROR: Missing images in buildroot output directory.' - echo ' Build images before running this script.' +# If no images directory, images have not been built +if [ ! -d $IMAGES ] ; then + echo -e "$ERRORTEXT Buildroot images directory does not exist" + echo ' Make sure you have built the images before' + echo ' running this script.' exit 1 +else + # If images are not built, exit + if [ ! -e $FW_JUMP ] || [ ! -e $LINUX_KERNEL ] ; then + echo -e '$ERRORTEXT Missing images in buildroot output directory.' + echo ' Build images before running this script.' + exit 1 + fi fi +# Ensure device tree binaries exist if [ ! -e $DEVICE_TREE ] ; then - echo 'ERROR: Missing device tree file' - exit 1 + echo -e '$ERRORTEXT Missing device tree files' + make -C ../ generate BUILDROOT=$BUILDROOT fi # Size of OpenSBI and the Kernel in 512B blocks @@ -57,23 +91,25 @@ KERNEL_START=$(( $FW_JUMP_START + $FW_JUMP_SIZE )) FS_START=$(( $KERNEL_START + $KERNEL_SIZE )) # Print out the sizes of the binaries in 512B blocks -echo -e "$NAME: Device tree block size: $DST_SIZE" -echo -e "$NAME: OpenSBI FW_JUMP block size: $FW_JUMP_SIZE" -echo -e "$NAME: Kernel block size: $KERNEL_SIZE" +echo -e "$NAME Device tree block size: $DST_SIZE" +echo -e "$NAME OpenSBI FW_JUMP block size: $FW_JUMP_SIZE" +echo -e "$NAME Kernel block size: $KERNEL_SIZE" -read -p "Warning: Doing this will replace all data on this card.\nContinue? y/n: " -n 1 -r +read -p "Warning: Doing this will replace all data on this card. Continue? y/n: " -n 1 -r echo if [[ $REPLY =~ ^[Yy]$ ]] ; then - DEVBASENAME=$(basename $1) - CHECKMOUNT=$(lsblk | grep "sdb4" | tr -s ' ' | cut -d' ' -f 7) + DEVBASENAME=$(basename $SDCARD) + CHECKMOUNT=$(lsblk | grep "$DEVBASENAME"4 | tr -s ' ' | cut -d' ' -f 7) if [ ! -z $CHECKMOUNT ] ; then sudo umount -v $CHECKMOUNT fi - + #Make empty image - echo -e "$NAME: Creating blank image" - sudo dd if=/dev/zero of=$1 bs=64k status=progress && sync + if [ ! -z $WIPECARD ] ; then + echo -e "$NAME Wiping SD card. This could take a while." + sudo dd if=/dev/zero of=$SDCARD bs=64k status=progress && sync + fi # GUID Partition Tables (GPT) # =============================================== @@ -83,19 +119,19 @@ if [[ $REPLY =~ ^[Yy]$ ]] ; then # to 1 sector boundaries I think? This would normally be set to 2048 # apparently. - sudo sgdisk -z $1 + sudo sgdisk -z $SDCARD sleep 1 - echo -e "$NAME: Creating GUID Partition Table" + echo -e "$NAME Creating GUID Partition Table" sudo sgdisk -g --clear --set-alignment=1 \ --new=1:34:+$DST_SIZE: --change-name=1:'fdt' \ --new=2:$FW_JUMP_START:+$FW_JUMP_SIZE --change-name=2:'opensbi' --typecode=1:2E54B353-1271-4842-806F-E436D6AF6985 \ --new=3:$KERNEL_START:+$KERNEL_SIZE --change-name=3:'kernel' \ --new=4:$FS_START:-0 --change-name=4:'filesystem' \ - $1 + $SDCARD - sudo partprobe $1 + sudo partprobe $SDCARD sleep 3 @@ -103,18 +139,18 @@ if [[ $REPLY =~ ^[Yy]$ ]] ; then DD_FLAGS="bs=4k iflag=fullblock oflag=direct conv=fsync status=progress" echo -e "$NAME: Copying device tree" - sudo dd if=$DEVICE_TREE of="$1"1 $DD_FLAGS + sudo dd if=$DEVICE_TREE of="$SDCARD"1 $DD_FLAGS echo -e "$NAME: Copying OpenSBI" - sudo dd if=$FW_JUMP of="$1"2 $DD_FLAGS + sudo dd if=$FW_JUMP of="$SDCARD"2 $DD_FLAGS echo -e "$NAME: Copying Kernel" - sudo dd if=$LINUX_KERNEL of="$1"3 $DD_FLAGS + sudo dd if=$LINUX_KERNEL of="$SDCARD"3 $DD_FLAGS - sudo mkfs.ext4 "$1"4 + sudo mkfs.ext4 "$SDCARD"4 sudo mkdir /mnt/$MNT_DIR - sudo mount -v "$1"4 /mnt/$MNT_DIR + sudo mount -v "$SDCARD"4 /mnt/$MNT_DIR sudo umount -v /mnt/$MNT_DIR @@ -123,5 +159,5 @@ if [[ $REPLY =~ ^[Yy]$ ]] ; then fi echo -echo "GPT Information for $1 ===================================" -sudo sgdisk -p $1 +echo "GPT Information for $SDCARD ===================================" +sudo sgdisk -p $SDCARD