Bus Spider
The Bus Spider is open source network enabled electronic multi-tool for enthusiasts and professionals.
This project is heavily influenced and inspired by the Bus Pirate http://dangerousprototypes.com/docs/Bus_Pirate
The Bus Spider aims to implement Bus Pirate's protocol and preserve compatibility while providing more functions.
Network capabilities of the Bus Spider will allow to use it as core device for remote control and debug.
This repo contains source codes for Bus Spider hardware and software for implementation on the Terasic DE10-Nano development board.
Table of contents
- Running Bus Spider from prebuilt images
- Building Bus Spider from scratch
- Prerequirements
- Clone Bus Spider repository and prepare it to build
- Install RISC-V GNU toolchain and QEMU from Bus Spider repository
- Building U-Boot bootloader image
- Building FPGA bitstream
- Building Linux kernel image for HPS
- Building Linux rootfs for HPS
- Building Bus Spider RISC-V SoC firmware
- Burn images to SD-card
- Start Bus Spider
- Configuring Bus Spider to use NFS rootfs
- Uploading Bus Spider SoC firmware from HPS hosted Linux
- Accessing Bus Spider CLI from HPS hosted Linux
- DE10-Nano base Bus Spider connectivity list
- Work with Bus Spider
- Resetting Bus Spider RISC-V SoC from HPS hosted Linux
- Links
Running Bus Spider from prebuilt images
Pending
Building Bus Spider from scratch
Prerequirements
This instruction is valid for Debian 9 "Stretch". See https://www.debian.org for details. 4GB of RAM is needed if you are running Quartus Prime software to build FPGA bitstream. This instruction may work for Ubuntu 16.04 but results are not guaranteed.
- Make sure that basic utilities are available
output of these commands shouldn't be empty:
which tar
which dd
which sudo
which xz
- Make sure that disk utilities are available
output of these commands shouldn't be empty:
which fdisk
which e2fsprogs
which dosfstools
- Make sure that serial communication utilities are available:
output of this command shouldn't be empty:
which minicom
alternatively you can use screen
or picocom
- Make sure that
git
is available:
output of this command shouldn't be empty:
which git
- Install ARM GNU toolchain for building HPS Linux kernel and U-Boot:
sudo apt-get install -y make gcc gawk bc libssl-dev
sudo apt-get install -y gcc-arm-linux-gnueabihf
- Install packages for ARM Debian rootfs regeneration
sudo apt-get install -y binfmt-support qemu qemu-user-static debootstrap
- Install
fusesoc
version 1.8.1:
sudo apt-get install -y python3-pip
sudo pip3 install fusesoc==1.8.1
- Install
Quartus Prime Lite
version 17.1
We recommend install Quartus Prime Lite into /opt/altera/17.1
directory.
- Install packages required for riscv-gnu-toolchain & riscv-qemu build
sudo apt-get install -y zlib1g-dev
sudo apt-get install -y texinfo bison flex libgmp-dev libmpfr-dev libmpc-dev
sudo apt-get install -y python pkg-config libglib2.0-dev libpixman-1-dev
- Create global user-writable RISC-V tools install path
sudo mkdir -p /opt/riscv
sudo chown $USER /opt/riscv
Clone Bus Spider repository and prepare it to build
git clone --recursive https://github.com/miet-riscv-workgroup/de10-nano-bus-spider
cd de10-nano-bus-spider
OUTPUT=output
mkdir -p $OUTPUT
Install RISC-V GNU toolchain and QEMU from Bus Spider repository
- Install RISC-V QEMU
( cd riscv-qemu && ./configure --target-list=riscv32-softmmu,riscv64-softmmu --prefix=/opt/riscv )
make -C riscv-qemu install
- Install RISC-V GNU toolchain
( cd riscv-gnu-toolchain && ./configure --prefix=/opt/riscv --with-arch=rv32i )
( make -C riscv-gnu-toolchain newlib )
Building U-Boot bootloader image
Result of this step is u-boot-with-spl.sfp
--- U-Boot bootloader image
make -s -C u-boot ARCH=arm socfpga_de10_nano_defconfig
make -s -C u-boot ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-
cp u-boot/u-boot-with-spl.sfp $OUTPUT
Building FPGA bitstream
Result of this step is de10-nano-bus-spider_0.rbf
--- Cyclone V SoC FPGA bitstream
( QP=/opt/altera/17.1/quartus && export PATH=$PATH:$QP/sopc_builder/bin:$QP/bin && \
cd riscv-soc-cores && fusesoc --cores cores/ build de10-nano-bus-spider )
cp riscv-soc-cores/build/de10-nano-bus-spider_0/bld-quartus/de10-nano-bus-spider_0.rbf $OUTPUT
Building Linux kernel image for HPS
Results of this step are:
socfpga_cyclone5_de10_nano.dtb
--- device tree blob for ARM Linux kernelzImage
--- ARM Linux kernel image
make -s -C linux ARCH=arm socfpga_de10_nano_defconfig
make -s -C linux ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-
cp linux/arch/arm/boot/zImage $OUTPUT
cp linux/arch/arm/boot/dts/socfpga_cyclone5_de10_nano.dtb $OUTPUT
Building Linux rootfs for HPS
Result of this step is debian-stretch-armhf.tar.xz
--- ARM Linux rootfs
( cd output && sudo ../scripts/mk-debian-rootfs.sh )
Building Bus Spider RISC-V SoC firmware
Result of this step is bus_spider.nmon
--- RISC-V SoC firmware
make -s -C bus-spider-firmware CROSS_COMPILE=/opt/riscv/bin/riscv32-unknown-elf- bus_spider.nmon
cp bus-spider-firmware/bus_spider.nmon $OUTPUT
Burn images to SD-card
Partition SD-card:
Pending
Check partition table on SD-card:
Pending
Output of this command should be:
+---+------+----+-----------+
| N | Size | Id | Type |
+===+======+====+===========+
| 1 | 8M | a2 | unknown |
+---+------+----+-----------+
| 2 | 128M | 0b | W95 FAT32 |
+---+------+----+-----------+
| 3 | ---- | 83 | Linux |
+===+======+====+===========+
Partition 1 is for U-Boot. Double check it's ID=0xA2.
Partition 2 is for Linux kernel image, Device Tree files and FPGA bitstreams.
Partition 3 is for local Linux rootfs
dd if=u-boot-with-spl.sfp of=/dev/sdX1
Start Bus Spider
- Plug prepared SD-card in DE10-Nano SD-card slot
- Connect DE10-Nano to the LAN using Ethernet cable
- Connect DE10-Nano UART to the PC using miniUSB cable
- Power up DE10-Nano
Configuring Bus Spider to use NFS rootfs
TFTP-server setup
Pending
NFS-server setup
Pending
First run U-boot configuration
Pending
=> setenv ethaddr 00:01:02:03:04:05
=> saveenv
Saving Environment to MMC... Writing to MMC(0)... OK
=>
Using U-Boot scripts for running Linux with NFS rootfs
Pending
First run Linux configuration
Pending
- Use ssh to access Bus Spider Linux Host (HPS subsystem)
- Add AL0 and AL1 minicom configurations:
mkdir -p /etc/minicom
cat <<EOF > /etc/minicom/minirc.AL0
pu port /dev/ttyAL0
pu baudrate 115200
pu bits 8
pu parity N
pu stopbits 1
pu escape-key ^B
pu rtscts No
EOF
cat <<EOF > /etc/minicom/minirc.AL1
pu port /dev/ttyAL1
pu baudrate 115200
pu bits 8
pu parity N
pu stopbits 1
pu escape-key ^B
pu rtscts No
EOF
Uploading Bus Spider SoC firmware from HPS hosted Linux
Pending
Accessing Bus Spider CLI from HPS hosted Linux
Pending
DE10-Nano base Bus Spider connectivity list
- FIXME: add connectivity schematic
- FIXME: use Quartus sdc-files to check devboard-UEXT connectivity
Work with Bus Spider
I2C
- see LCD1X9.md
- see TinyRTC.md
SPI
Resetting Bus Spider RISC-V SoC from HPS hosted Linux
GPIO=/sys/class/gpio; echo 2040 > $GPIO/export
echo high > $GPIO/gpio2040/direction; echo low > $GPIO/gpio2040/direction
# https://www.kernel.org/doc/Documentation/gpio/sysfs.txt
# GPIO=/sys/class/gpio
# echo 2040 > $GPIO/export
# echo 2047 > $GPIO/export
# echo high > $GPIO/gpio2040/direction
# echo high > $GPIO/gpio2047/direction
# echo low > $GPIO/gpio2040/direction
# echo low > $GPIO/gpio2047/direction
Links
Bus Pirate
- http://dangerousprototypes.com/docs/Bus_Pirate
- SparkFun's Bus Pirate v3.6a Hookup Guide
- https://github.com/sparkfun/Bus_Pirate
- https://github.com/BusPirate/Bus_Pirate
- https://www.seeedstudio.com/Bus-Pirate-v3.6-universal-serial-interface-p-609.html