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.
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:
- Install Zephyr + SDK: https://docs.zephyrproject.org/latest/develop/getting_started/index.html
- Install HSS Payload Generator: https://git.beagleboard.org/beaglev-fire/hart-software-services/-/tree/main-beaglev-fire/tools/hss-payload-generator
Configure the environment variables in scripts/script-config.sh
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.
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.
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.
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.
$ cd gateware/sources/HSS
$ make config
...
$ cp .config ../../hss.def_config