Hasty Briefsbeta

Bilingual

Fun with CSF firmware (RK3588 GPU firmware)

a day ago
  • #GPU
  • #Firmware
  • #Embedded
  • The Mali v10 GPUs require firmware (mali_csffw.bin) to be present in firmware directories like /lib/firmware for the GPU to function.
  • The firmware runs on a Cortex-M7 microcontroller within the GPU, handling tasks previously managed by the kernel.
  • The MCU operates at up to 990 MHz on RK3588 and controls its own page tables to access memory.
  • Memory access involves three layers: MCU's MPU, MCU memory mappings, and GPU MMU, each with distinct permissions and controls.
  • Interrupts facilitate communication between the kernel, MCU, userspace, and GPU components for tasks like initialization and power management.
  • MMIO regions at 0x04000000 and 0x40000000 are critical for shared buffers and hardware control, respectively.
  • The firmware image (mali_csffw.bin) includes memory mappings and tracebuffer configurations, with some sections marked as GPL-2.
  • Attempts to use Rust for firmware development faced tooling challenges, leading to a hybrid approach with C.
  • GDB integration was achieved for debugging the MCU, requiring a patched kernel for access via debugfs.
  • MicroPython was ported to the MCU, offering a scripting environment for firmware development and user interaction.