File System

One of the most important features of the HotRIO microcontroller software running on the manager microcontrollers in the HotRIO ecosystem is the use of a hybrid filesystem. This approach to managing the filesystem is closely aligned with that of the Linux operating system, where the filesystem serves a dual purpose: as both a persistent storage medium and a seamless interface for interacting with devices and their drivers.

Filesystem Design in HotRIO Firmware

Each microcontroller in the HotRIO ecosystem is paired with an external memory module attached via one of its interfaces. This external memory serves two primary functions:

  • Storage for FPGA Bitstream: The external memory contains the FPGA bitstream required to configure the FPGA during the startup procedure of the microcontroller. This bitstream is critical for initializing the FPGA to perform its intended tasks.

  • Persistent Storage via FATFS: The remaining memory space, not allocated for the FPGA bitstream, is dedicated to maintaining a FATFS filesystem. This filesystem acts as persistent memory for the microcontroller, storing configuration files, logs, or any data that needs to survive across reboots or power cycles.

Hybrid Filesystem Structure

The filesystem on the microcontroller is divided into two distinct but seamlessly integrated areas, which are presented transparently to the user:

  • The “Hardware” Filesystem: This part of the filesystem is allocated in the FATFS partition of the external memory. It is used to store persistent data that the system or user needs to preserve, such as configuration files, logs, or other application-specific data.

  • The “Virtual” Filesystem: This virtual filesystem represents device functionality exposed as files and folders by the microcontroller’s drivers. These files are not linked to physical storage; instead, they act as entry points for interaction with the hardware. Through these virtual files, users and applications can control peripherals, configure devices, and perform operations on the underlying hardware, such as reading sensor data or controlling motors.

Filesystem Interaction

The user interface for interacting with the filesystem closely mimics the familiar structure of a Linux system. Through simple commands such as cd and ls, users can navigate both the hardware and virtual filesystems. The firmware transparently manages the distinction between these two filesystems, allowing users to interact with them seamlessly as if they were part of a single, unified filesystem.

Key operations include:

  • Navigating the Filesystem: Users can use the cd command to navigate through the directories, switching between the hardware filesystem (which contains data stored on the EEPROM via FATFS) and the virtual filesystem (which exposes driver functionalities).

  • Listing Files: The ls command can be used to view files and directories, whether they’re part of the hardware storage (e.g., configuration files or logs) or part of the virtual filesystem (e.g., control files for device drivers).

How the Virtual Filesystem Enhances Device Interaction

The primary innovation behind the HotRIO filesystem is its ability to expose device interactions as simple file operations. The user can perform common file operations—such as copying or moving files—while interacting with the hardware. For example:

  • Copying Files: The user might copy data from the FATFS filesystem (e.g., configuration files) into a virtual file that represents a device or peripheral (e.g., a temperature sensor or motor controller). This action might configure the device to the desired state.

  • Configuring Devices: Similarly, the user can modify or configure devices by copying the contents of one file into another. This allows for simple, intuitive configuration of peripherals, as the user only needs to manipulate files instead of interacting with complex driver APIs.

This combination of storage and device control through a unified filesystem interface provides a intuitive way to interact with both data and hardware, greatly simplifying the development and user experience in the HotRIO ecosystem.

The firmware manages the separation between the FATFS and virtual filesystems at a low level, abstracting the distinction from the user. This transparent management ensures that users can interact with both filesystems through the same interface without needing to differentiate between them. System calls related to file operations, such as reading, writing, and navigating directories, are routed appropriately depending on the target (physical storage on FATFS or device control through the virtual filesystem).

The virtual filesystem provides a set of driver-exposed file entries that map directly to hardware control interfaces, allowing users to perform file-based operations (e.g., file reads/writes) to configure, control, or retrieve data from devices. As a result, users can seamlessly invoke hardware operations (such as configuring a device or sending commands to peripherals) through standard file system commands (e.g., cp, mv, cat).

This dual functionality enables transparent interaction between storage and device control, abstracting the complexity of underlying memory management, hardware abstraction layers, and driver APIs. The unified filesystem interface ensures that users and developers can manage both persistent data and hardware peripherals with minimal knowledge of the underlying architecture, significantly simplifying the development and operational workflows within the HotRIO ecosystem.