Project Utilities

Mango provides a number of utilities to simplify using the reference PetaLinux projects.

mango_wlan_util Script

The reference PetaLinux project installs a helper shell script to /usr/sbin/mango_wlan_util. The mango_wlan_util script wraps the fpga_manager, remoteproc, and modprobe calls necessary to configure the PL, boot the RPU, and load the kernel driver. It also supports printing version information extracted from the running design to verify which binaries are loaded.

When using the 802.11 MAC/PHY design on multiple nodes be sure to pass a different MAC address to the -m <mac_address> argument. AP/STA applications will not work if two nodes are configured with the same address.

Boot script mango_boot.sh

Mango’s reference PetaLinux project looks for a shell script named mango_boot.sh at the root of the node’s SD card. If found, this script will be executed automatically by the root user after the kernel has finished booting. This script is a convenient place to run commands required on every boot, such as loading the Mango 802.11 MAC/PHY binaries.

By default the mango_boot.sh script:

  • Computes a MAC address to use for the wireless NIC, derived from the node’s unique Ethernet MAC address
  • Boots the Mango 802.11 design using the mango_wlan_util utility script

The SD card is mounted at /media/card/ by the Mango reference PetaLinux projects. Users should customize the mango_boot.sh script to suit their application.

mango_wlan_nl_ref Application

The mango_wlan driver provides a Netlink interface for exchanging messages with userspace applications at runtime. The Netlink interface supports injecting packets for direct transmission, receiving packets via monitor interfaces, and retrieving raw waveforms captured by the Rx PHY and writing them to the filesystem.

Mango provides a reference userspace application mango_wlan_nl_ref that demonstrates how to use this Netlink interface:

By default the mango_wlan_nl_ref application runs in Rx mode, listening for all wireless receptions reported to the driver. Each reception is logged to the console, and (for OFDM receptions) the raw IQ waveform is written to the filesystem.

For example:

These five receptions were all OFDM (phy_mode 1 indicates a NONHT waveform). The captured waveforms are stored in the filesystem:

Each bin file contains the raw IQ samples captured at the input to the Rx PHY core. The IQ data are stored as packed binary with each I/Q value stored as a signed 16-bit integer. Sample MATLAB code for reading these bin files:

Customizing u-boot

PetaLinux uses u-boot as the second-stage boot loader. In Mango reference designs u-boot loads the image.ub image which contains the device tree, kernel image, and root filesystem.

By default u-boot will load image.ub image from the SD card.

u-boot also supports loading images via TFTP. This is a very useful flow when iterating on the PetaLinux design, as it allows rebooting a node without removing/updating/replacing the SD card. In the TFTP flow only BOOT.BIN and uEnv.txt are stored on the SD card.

The uEnv.txt text file overrides variables in the u-boot default environment. Mango release archives provide a template at sd_root/uEnv.txt which is copied below.

The serverip variable defines the TFTP server IP address. PetaLinux automatically sets this variable to the IP address of the PC which built the BOOT.BIN image (i.e. a Mango PC if using the reference images). Set this variable to your TFTP server’s IP address.

The uenvcmd variable defines the u-boot command that loads the final image. By default this variable is run sdboot which loads image.ub from the SD card. To boot via TFTP set this variable to run netboot.