Skip to content

Uotan-Dev/FirmwareKit.Comm.Fex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FirmwareKit.Comm.Fex

NuGet Version License: MIT

A high-performance .NET communication library for Allwinner processors. It supports memory read/write, code execution via FEL mode, and FES protocol operations. Designed for firmware flashing, bootloader development, and system debugging tools.

Installation

Install via NuGet:

dotnet add package FirmwareKit.Comm.Fex

Quick Start

1. Initialize Context and Connect Device

It is recommended to use EfexContext.Open for automatic device probing and verification:

using FirmwareKit.Comm.Fex;

// Default uses Allwinner standard VID: 0x1F3A, PID: 0xEFE8
using var ctx = EfexContext.Open();

if (ctx == null)
{
    Console.WriteLine("No device detected in FEL mode.");
    return;
}

Console.WriteLine($"Device Detected: {ctx.Resp.DeviceName}");

2. FEL Mode Memory Operations

Easily perform memory operations and execute code in FEL mode:

// Read memory from device
byte[] buffer = new byte[1024];
var readResult = ctx.FelRead(0x40000000, buffer, progress => {
    Console.WriteLine($"Read {progress} bytes...");
});

// Write data to device memory
byte[] dataToLoad = File.ReadAllBytes("u-boot-spl.bin");
var writeResult = ctx.FelWrite(0x40000000, dataToLoad);

// Execute code at specified address
var execResult = ctx.FelExec(0x40000000);

if (execResult == SunxiEfexError.Success)
{
    Console.WriteLine("Execution command sent successfully.");
}

3. Error Handling

The library provides a detailed enum to describe operation results:

SunxiEfexError result = ctx.FelExec(0x8000);
if (result != SunxiEfexError.Success)
{
    Console.WriteLine($"Operation failed: {result.ToErrorMessage()}");
}

Developer Guide

Architecture Support

Built-in payload factories for specific boot-time operations across different architectures:

  • AArch64: 64-bit ARM support.
  • Arm32: Traditional 32-bit ARM support.
  • RISC-V: Experimental RISC-V support.

Cross-Platform Compatibility

.NET Standard 2.0/2.1: Compatible with legacy .NET Framework and Unity environments. • Modern .NET (8/9/10): Deeply optimized with support for Native AOT and high-performance I/O. • Multi-backend Support: - Windows: Uses WinUSB drivers. - Linux: Powered by LibUsb. - macOS: Native IOKit support.

License

This project is licensed under the MIT License.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages