Skip to content
VGA-style video generation for STM32F4 processors
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
doc Move library docs/tools into vga Apr 13, 2014
rast rast/field_16x4: clarify width, height, etc. Jul 3, 2015
tool Move library docs/tools into vga Apr 13, 2014
.gitignore Add .gitignore. Apr 13, 2014
BUILD rast/direct: use copy_words instead of unpacker. Jun 23, 2015
LICENSE Add LICENSE. May 11, 2014
README.mkdn arena: pull region prioritization out of ETL. Nov 30, 2014
arena.h Improve docs. Jun 17, 2015
bitmap.h Compatibility with freestanding ETL. Nov 2, 2014
copy_words.S copy_words: remove stray comment. Jun 12, 2015
copy_words.h Indicate alignment using alignas(). Nov 28, 2014
font_10x16.h Add an 80x37 text mode. Apr 13, 2014 graphics_1: estimate likelihood of special cases. Dec 14, 2014
graphics_1.h graphics_1: add default ctor. Jan 5, 2015 measurement: add low byte of E port as sigs. Jan 23, 2015
measurement.h Improve docs. Jun 17, 2015
rasterizer.h Timing tweaks for 800x600 mode. Jul 6, 2015
timing.h Enable lower-resolution modes with more CPU free. Jun 17, 2015 Timing tweaks for 800x600 mode. Jul 6, 2015
vga.h Improve docs. Jun 17, 2015


This library provides high-quality, high-resolution color graphics output from STM32F40x/1x microcontrollers, using very few external components.

This repository contains only the reusable library bits. To try it out, or just see an example of how it's used, see the m4vgalib-demos repository.

Brief Overview

The STM32F407 is a Cortex-M4 microcontroller that has neither a video controller, nor enough RAM for a framebuffer at any reasonable resolution.

m4vgalib works around this to produce stable 800x600 (or 640x480) video with 256 colors. Instead of a video controller, m4vgalib uses two timers, one DMA controller, and a GPIO port. Instead of a framebuffer, m4vgalib uses a modular rasterization system that lets applications "race the beam" -- prepare video output on the fly from some compact representation.

Out of the box, m4vgalib includes canned rasterizers for both palettized pixel graphics and attributed text graphics, with various formats and depths. Applications can change rasterizers at any scanline to achieve split-screen or raster effects.

Even though m4vgalib is maintaining a 320Mb/s data stream on a processor not designed for anything of the sort, most of the CPU and hardware resources are left available to applications. To avoid introducing jitter, applications must only agree to keep their filthy hands off AHB1 during certain phases of execution. (Interrupts are available to notify the application of this.)

The application runs as a "thread" parallel to m4vgalib, and it's even possible to run an application using an RTOS with a bit of porting effort. (Hint: the RTOS must coordinate with m4vgalib on the use of the PendSV handler.)

You can’t perform that action at this time.