Skip to content

AlexCharlton/beaglev-fire-zephyr-and-baremetal-with-gateware

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

74 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BeagleV Fire Zephyr/Baremetal + Gateware + HSS

Template for developing Zephyr or baremetal applications on the BeagleV Fire. Only tested on Windows, but should work on anything supported by the Microchip tools (Libero/SoftConsole).

When developing on Windows, it's assumed you're using MSYS2. Zephyr should be installed in WSL, since it apparently does not work particularly well on Windows. The build script will automatically run itself in WSL.

Gateware programming depends on a FlashPro 5/6, for now.

Requirements

Cargo, to install flasher:

$ cd flasher
$ cargo install --path .

Install Libero and SoftConsole, for building the FPGA bitstream. Libero requires a license file. Follow the instructions here to install it.

Python3 required for the gateware builder. Install Python libraries:

$ pip3 install gitpython
$ pip3 install pyyaml
$ pip3 install requests

On *nix:

Configure the environment variables in scripts/script-config.sh

Usage

Programming a Zephyr application

Building Zephyr application:

$ ./scripts/build.sh apps/hello-smp

With a serial cable connected (I use this one), use flasher to program the image:

$ flasher [your-serial-port] build/zephyr.img
$ # eg. flasher COM5 build/zephyr.img

CTRL-Y enters FLASH mode, then reset the board to program the image.

flasher acts as a serial terminal, so it's generally useful to keep open to see the output/logs of the application. CTRL-T to exit.

flasher works by interrupting the HSS bootloader to enter its console, then executes the mmc and usbdmsc commands to mount the eMMC as a USB drive. It detects newly mounted drives, and writes the given image to it, before unmounting and rebooting the device.

Programming a baremetal application

The C example uses the RISC-V toolchain from SoftConsole and the Microchip platform.

$ ./scripts/build-baremetal.sh
$ flasher [your-serial-port] baremetal/mpfs-timer-example/build/application.img

See https://github.com/AlexCharlton/mpfs-hal/ for embedded Rust.

GDB debugging

With a JTAG debugger (FlashPro) connected, run:

$ ./scripts/connect-openocd.sh

Then in another terminal, run:

$ ./scripts/connect-gdb.sh

scripts/init.gdb can be modified to suit your needs.

Programming FPGA gateware + HSS

Run the apps/spi-erase app (built per the instructions above) to clear the SPI flash before programming the image for the first time. Otherwise, your changes will be overwritten by the golden image that is programmed into the BeagleV Fire. This only needs to be done once.

Build the FPGA + HSS bitstream:

$ ./scripts/build-hss-fpga-bitstream.sh

It takes serveral minutes to build.

Open FPExpress, open gateware/bitstream/FlashProExpress/BLINKY_<HASH>.job, run "Program". When it's done, the board will reboot.

Configuring HSS

$ cd gateware/sources/HSS
$ make config
...
$ cp .config ../../hss.def_config

About

Template for developing Zephyr or baremetal applications, using the FPGA, on the BeagleV Fire using C or Rust

Resources

Stars

Watchers

Forks

Packages

No packages published