You can also use following command (after cloning `rtems-source-builder` and entering the directory) to check whether your host computer is set up correctly:
```
source-builder/sb-check
```
## Trivial File Transfer Protocol (TFTP) setup
Trivial File Transfer Protocol (TFTP) allows to boot an application to BeagleV-Fire board without need to flash RTEMS application to eMMC. Following steps are necessary to install TFTP on Debian based systems.
```
sudo ufw allow tftp
sudo apt install tftpd-hpa
sudo apt install tftp
sudo chown tftp:tftp /srv/tftp
sudo systemctl restart tftpd-hpa
```
Following configuration can be used for TFTP (available in `/etc/default/tftpd-hpa`):
```
TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/srv/tftp"
TFTP_ADDRESS=":69"
TFTP_OPTIONS="--secure"
```
Then you can create `beglev-fire/rtems` directory in `/srv/tftp` to which you will copy your application image and FPGA image. For more convenient access add `tftp` directory to user access.
Note that this build may take a lot of time even on good computers. RTEMS has to build all its dependencies (gcc, gdb, binutils etc). This step is done only once and everything is build into `/opt/rtems/7`. Therefore you can do this more times for different RTEMS version, placing each one into different directory in `opt`.
This build takes a lot of computer resources, therefore it might make it unusable for the time of the build.
## BSP build
This chapter describes BSP build for BeagleV-Fire board. However build for other boards/architectures is similar, you can use `./rtems-bsps` command to list all supported BSPs.
You might need to install `u-boot-tools` package to build the template application.
## BeagleV-Fire Internal eMMC Boot
The BeagleV-Fire boots applications from eMMC soldered on the board. The actual boot process starts by starting Microchip's HSS (Hart Software Services) loaded from eNVM. The HSS software can establish OpenSBI environment and start HSS payload from eMMC on specified RV64 cores (the HARTs u54_1, u54_2, u54_3 and u54_4 are complete RV64GC cores then there is one management RV63IMAC core). The payload is started in specified mode, for the Linux kernel or U-boot typically in M-mode.
But RTEMS expect full control over the chip so it requires to start in M-mode (machine mode).
The [hss-payload-generator](https://github.com/polarfire-soc/hart-software-services/tree/master/tools/hss-payload-generator) is required to prepare payload for HSS service. It can be compiled from referenced sources even without need of whole [Libero](https://www.microchip.com/en-us/products/fpgas-and-plds/fpga-and-soc-design-tools/fpga) package.
The minimal HSS build configuration for RTEMS stored in `rtems-config.yaml` file
```
# First, we can optionally set a name for our image, otherwise one will be created dynamically
set-name: 'PolarFire-SoC-HSS::RTEMSImage'
# Next, we'll define the entry point addresses for each hart, as follows: