The Firmware Setup for the Raspberry Pi Zero 2W is a dual operation system with a bare-metal program running alongside an Ubuntu OS. The intent of this is to use a Linux environment to handle network connectivity and packet sending while still allowing the crazyflie firmware to run as a FreeRTOS program (as it natively does on a crazyflie). The system architecture is designed to operate as follows
The Ubuntu portion of the system runs on 3 cores from the Pi Zero and the bare-metal program runs on one. They share data through a shared memory space which allows information like setpoints, parameter updates, etc to be sent from the ground station to the drone firmware.
# Prerequisites
- The current system is set up for Ubuntu Server 22.10 (64-bit) on the Raspberry Pi Zero 2W[OS Install Info](https://git.ece.iastate.edu/danc/MicroCART/-/wikis/Pi-Zero-Setup-Guide#os-install)
- Network Connection and SSH ability to the Raspberry Pi through the IASTATE network [Network Connection Info](https://git.ece.iastate.edu/danc/MicroCART/-/wikis/Pi-Zero-Setup-Guide#register-on-iastate-network)
- Access to either a Ubuntu Machine or VM
# U-Boot Setup
The following instructions are to set up u-boot to work as a bootloader and package the boot instructions to info the device to boot in a specific configuration. These instructions are adapted from the two following repos
- https://github.com/TImada/raspi4_freertos
- https://github.com/eggman/FreeRTOS-raspi3
## Cross-compiler
The U-Boot program will need to be cross-compiled for the ARM arch from a Ubuntu machine. The following steps describe how to set up the needed cross-compiler.
1. Download the [ARM GUN Toolchain](https://developer.arm.com/-/media/Files/downloads/gnu-a/9.2-2019.12/binrel/gcc-arm-9.2-2019.12-x86_64-aarch64-none-elf.tar.xz?revision=ea238776-c7c7-43be-ba0d-40d7f594af1f&rev=ea238776c7c743beba0d40d7f594af1f&hash=62661FC8024B11FD84FB4C10C4907E1F) onto the development system
2. Extract the compressed release
```
$ tar -xJf <toolchain binary> -C <destination directory>
2. Now you can place the sd-card back in the Raspberry Pi and Attempt to Boot
3. If the u-boot install was successful you should see this image in the top right and be prompted to `Press any key to disable auto boot` 