TODO give an overview of petalinux, the three different parts (hw, os, and sw), and complain about Xilinx a little bit :smile:
# Overview
# Overview
Petalinux is a modified version of the [Yoco Project](https://www.yoctoproject.org/). Petalinux was created and is maintained by Xilinx for their hardware platforms. [Here](https://support.xilinx.com/s/article/968413?language=en_US) is a good article giving a rough overview of Petalinux.
Petalinux is a modified version of the [Yoco Project](https://www.yoctoproject.org/). Petalinux was created and is maintained by Xilinx for their hardware platforms. [Here](https://support.xilinx.com/s/article/968413?language=en_US) is a good article giving a rough overview of Petalinux.
...
@@ -25,7 +23,7 @@ Check out our [Petalinux Ubuntu Development Environment](https://git.ece.iastate
...
@@ -25,7 +23,7 @@ Check out our [Petalinux Ubuntu Development Environment](https://git.ece.iastate
# Hardware - Vivado
# Hardware - Vivado
Check out our [Vivado/Vitis Install](https://git.ece.iastate.edu/sd/sdmay23-47/-/wikis/Vivado-and-Vitis-Install) guide to learn how to install Vivado on your Ubuntu development environment.
Check out our [Vivado/Vitis Install](https://git.ece.iastate.edu/sd/sdmay23-47/-/wikis/Vivado-and-Vitis-Install) guide to learn how to install Vivado on your Ubuntu development environment.
TODO link to external Vivado resources to learn how to use
Check out our [Petalinux Hardware Design](https://git.ece.iastate.edu/sd/sdmay23-47/-/wikis/Petalinux-Hardware-Design) page for all the documentation and setup process.
# OS - Petalinux
# OS - Petalinux
...
@@ -45,7 +43,13 @@ On the petalinux side, the serial gadget shows up as a readable/writable file in
...
@@ -45,7 +43,13 @@ On the petalinux side, the serial gadget shows up as a readable/writable file in
The configuration of the two Gadgets is done using ConfigFS. The script that runs on petalinux startup that does the filesystem-based configuration is located [here](https://git.ece.iastate.edu/sd/sdmay23-47/-/blob/master/petalinux/os/project-spec/meta-user/recipes-apps/bootscript/files/bootscript).
The configuration of the two Gadgets is done using ConfigFS. The script that runs on petalinux startup that does the filesystem-based configuration is located [here](https://git.ece.iastate.edu/sd/sdmay23-47/-/blob/master/petalinux/os/project-spec/meta-user/recipes-apps/bootscript/files/bootscript).
## Device Tree
## Device Tree
TODO
The device tree is used to define hardware (including memory allocation) in Petalinux. The file can is located at [petalinux/os/project-spec/meta-user/recipes-bsp/device-tree/files/system-user.dtsi](https://git.ece.iastate.edu/sd/sdmay23-47/-/blob/master/petalinux/os/project-spec/meta-user/recipes-bsp/device-tree/files/system-user.dtsi), and any changes to it require a rebuild of petalinux to take effect.
### Reserved Memory
The reserved-memory node outlines parts of memory that we set aside so Petalinux doesn't use. They contain the following entries:
- vdev0vring0, vdev0vring1, vdev0buffer - Required for RPMsg protocol
- rproc_0_reserved - Required for remoteproc to launch the baremetal app
- shared_memory - The baremetal app writes sample data to this memory region, and Petalinux reads from it when obtaining sample data
## Baremetal App
## Baremetal App
One of the downsides of using Petalinux is that it adds a lot of overhead to certain hardware operations. The best way to get around this issue is to run an application directly on one of the two CPU cores. This is referred to as a baremetal app.
One of the downsides of using Petalinux is that it adds a lot of overhead to certain hardware operations. The best way to get around this issue is to run an application directly on one of the two CPU cores. This is referred to as a baremetal app.
...
@@ -72,6 +76,13 @@ We are using the OpenAMP library to communicate between Petalinux and baremetal
...
@@ -72,6 +76,13 @@ We are using the OpenAMP library to communicate between Petalinux and baremetal
OpenAMP is compatable with linux remoteproc, rpmsg, and VirtIO components, which we use to send commands and data from petalinux -> baremetal and baremetal -> petalinux.
OpenAMP is compatable with linux remoteproc, rpmsg, and VirtIO components, which we use to send commands and data from petalinux -> baremetal and baremetal -> petalinux.
The necessary functions for the comm and sampling applications are located in ```rpc.c``` and ```rpc.h``` of each app.
# Bootscript
When Petalinux boots, we need it to automatically configure the USB gadgets, give itself a static IP, enable certain hardware features, and launch the comm app (which itself launches the sampling app on the other CPU core). This is all done in a bash script that runs on boot. Keep in mind that the last few commands in the script (mainly ```./CyDAQ_comm.elf &```) might be commented out. This is because the development process is a lot easier when the app doesn't auto start. Regardless, those lines must not be commented out when building petalinux to distribute for labs!
The script can be found [here](https://git.ece.iastate.edu/sd/sdmay23-47/-/blob/master/petalinux/os/project-spec/meta-user/recipes-apps/bootscript/files/bootscript).
# External Resources
# External Resources
Check out our [Useful Resources](https://git.ece.iastate.edu/sd/sdmay23-47/-/wikis/Useful-Resources) page for links to official documentation and other guides we used to develop this project.
Check out our [Useful Resources](https://git.ece.iastate.edu/sd/sdmay23-47/-/wikis/Useful-Resources) page for links to official documentation and other guides we used to develop this project.