Sunxi.FEL (Sunxi v0.2.1)

Copy Markdown View Source

An Elixir wrapper for the sunxi-fel utility.

Summary

Functions

Loads and executes a U-Boot SPL image.

Loads and executes U-Boot.

Lists connected Allwinner devices in FEL mode.

Reads data from the device's memory at the specified address.

Writes data to the device's memory at the specified address.

Functions

execute_spl(path, opts \\ [])

@spec execute_spl(
  String.t(),
  keyword()
) :: :ok | {:error, any()}

Loads and executes a U-Boot SPL image.

If the file additionally contains a main U-Boot binary (e.g., u-boot-sunxi-with-spl.bin), this command also transfers that to memory (at the default address from the image), but won't execute it.

Options

  • :device - A Sunxi.Device struct representing the target device.
  • :on_progress - A callback function that receives progress updates. The callback receives a map: %{percentage: integer, speed: float, eta: String.t | nil}. speed is in kB/s.

execute_uboot(path, opts \\ [])

@spec execute_uboot(
  String.t(),
  keyword()
) :: :ok | {:error, any()}

Loads and executes U-Boot.

This is similar to execute_spl/2, but actually starts U-Boot execution when the sunxi-fel utility exits.

Options

  • :device - A Sunxi.Device struct representing the target device.
  • :on_progress - A callback function that receives progress updates. The callback receives a map: %{percentage: integer, speed: float, eta: String.t | nil}. speed is in kB/s.

list_devices()

@spec list_devices() :: [Sunxi.Device.t()] | {:error, any()}

Lists connected Allwinner devices in FEL mode.

read_memory(address, size, opts \\ [])

@spec read_memory(non_neg_integer(), non_neg_integer(), keyword()) ::
  {:ok, binary()} | {:error, any()}

Reads data from the device's memory at the specified address.

Options

  • :device - A Sunxi.Device struct representing the target device.

write_memory(address, data, opts \\ [])

@spec write_memory(non_neg_integer(), binary(), keyword()) :: :ok | {:error, any()}

Writes data to the device's memory at the specified address.

Options

  • :device - A Sunxi.Device struct representing the target device.
  • :on_progress - A callback function that receives progress updates. The callback receives a map: %{percentage: integer, speed: float, eta: String.t | nil}. speed is in kB/s.