feagi-hal
Hardware Abstraction Layer (HAL) for FEAGI embedded neural networks
Platform abstraction and implementations for embedded systems.
Part of FEAGI 2.0 - Framework for Evolutionary AGI
Overview
feagi-hal provides a Hardware Abstraction Layer (HAL) with platform-agnostic traits and concrete implementations for running FEAGI neural networks on embedded systems. It sits between the platform-agnostic neural processing core and platform-specific hardware.
Architecture
┌─────────────────────────────────────────────────────────┐
│ Application (feagi-nano SDK or custom application) │
└─────────────────────────────────────────────────────────┘
↓ uses
┌─────────────────────────────────────────────────────────┐
│ feagi-hal (THIS CRATE) │
│ ├── hal/ Platform Abstraction Layer (traits) │
│ └── platforms/ Platform Implementations │
└─────────────────────────────────────────────────────────┘
↓ uses
┌─────────────────────────────────────────────────────────┐
│ feagi-core (neural processing) │
│ ├── feagi-types │
│ ├── feagi-neural │
│ ├── feagi-synapse │
│ └── feagi-runtime-embedded │
└─────────────────────────────────────────────────────────┘
Features
Platform Abstraction Layer (HAL)
- TimeProvider - Monotonic time and delays
- SerialIO - UART/serial communication
- GpioProvider - Digital I/O control
- Logger - Structured logging
- NeuralAccelerator - Hardware acceleration (Hailo, TPU, etc.)
Supported Platforms
| Platform | Status | Feature Flag | Target | Max Neurons (INT8) |
|---|---|---|---|---|
| ESP32 | ✅ Production | esp32 |
xtensa-esp32-none-elf |
2,000 |
| ESP32-S3 | ✅ Production | esp32-s3 |
xtensa-esp32s3-none-elf |
40,000 |
| ESP32-C3 | ✅ Production | esp32-c3 |
riscv32imc-esp-espidf |
1,500 |
| Arduino Due | ✅ Foundation | arduino-due |
thumbv7m-none-eabi |
1,000 |
| STM32F4 | ✅ Foundation | stm32f4 |
thumbv7em-none-eabihf |
2,500 |
| Raspberry Pi Pico | ✅ Foundation | rpi-pico |
thumbv6m-none-eabi |
3,500 |
| Hailo-8 | ✅ Foundation | hailo |
aarch64-unknown-linux-gnu |
1,000,000+ 🚀 |
Legend:
- ✅ Production: Fully tested on hardware, production-ready (ESP32 family)
- ✅ Foundation: Traits implemented, compiles successfully, needs hardware/FFI testing
- 🔧 Planned: Architecture designed, implementation pending
Note: Hailo-8 requires HailoRT C/C++ library and FFI bindings for hardware deployment. Architecture is complete!
Installation
Add to your Cargo.toml:
[]
= { = "2.0", = ["esp32"] }
Feature Flags
# Microcontrollers
= ["esp-idf-svc", "esp-idf-hal"] # ESP32 family
= ["arduino-hal"] # Arduino Due (future)
= ["stm32f4xx-hal"] # STM32F4 series (future)
# Neural accelerators
= ["hailo-sdk"] # Hailo-8 (future)
# Convenience bundles
= ["esp32", "esp32-s3", "esp32-c3"]
Usage
Quick Start (ESP32)
use *;
!
Build for ESP32
# Install ESP32 toolchain
# Build
# Flash
HAL Trait Definitions
TimeProvider
SerialIO
Logger
NeuralAccelerator
Adding a New Platform
See PORTING_GUIDE.md for step-by-step instructions.
Quick overview:
- Create
src/platforms/myplatform.rs - Implement HAL traits (
TimeProvider,SerialIO,Logger,Platform) - Add feature flag to
Cargo.toml - Add platform-specific HAL dependencies
- Test on hardware
Estimated time: 2-3 days per platform
Documentation
- API Documentation
- Porting Guide
- Platform Comparison
- feagi-nano SDK - High-level application framework
Who Uses This Crate?
Direct Users (Advanced)
- Researchers needing full control over neural network execution
- Product companies integrating FEAGI into existing embedded systems
- Custom neural network topologies
Indirect Users (via feagi-nano SDK)
- Embedded developers using NetworkBuilder API
- Robotics engineers using pre-built templates
- Students using ready-to-use binaries
Architecture Notes
Why Separate from feagi-nano?
- feagi-hal: Low-level, stable API for platform abstraction
- feagi-nano: High-level SDK with NetworkBuilder, templates, etc.
This separation allows:
- Other projects to use
feagi-haldirectly - Independent evolution of SDK features
- Reusable platform implementations
Design Principles
- Zero-cost abstractions - Traits compile to direct function calls
- Platform-agnostic core - Neural processing code works everywhere
- Minimal dependencies - Only platform HALs, no std
- Type-safe - Compile-time checks for platform compatibility
License
Licensed under Apache License 2.0
Copyright © 2025 Neuraville Inc.
Contributing
See CONTRIBUTING.md
Platform implementations welcome! We're looking for contributors to add support for:
- Arduino Due, Mega
- STM32F4, STM32H7
- Raspberry Pi Pico
- Nordic nRF52
- Hailo-8, Google Coral TPU