pcb-rnd knowledge pool


A brief history of m4 footprints

m4fp_history by Tibor 'Igor2' Palinkas on 2020-11-22

Tags: insight, m4, parametric, footprint

node source



Abstract: n/a

  Note: you can find these old versions of PCB and router (from the pre-gEDA era) in the PCB history project; they are even compilable on modern Linux desktop!

Early component support

PCB was first called 'router' and ran on the Atari ST. It got ported to UNIX in the mid '90s. Early versions of router and PCB did not have support for footprints of any sort. The user simply placed vias manually on the grid where component pins would be.

From version PCB 1.1 (1993), Element got introduced in the file format. Early boards contained one Element block that contained all pins and silk lines of all components. PCB could not draw directly on the silk layer, the only way to access silk was to add element lines. There was no netlist support at all, you had to draw your board while looking at the schematics.

From version PCB 1.3 (1995), the example/demo board shipped with PCB got multiple Elements and a directory called packages appeared in the distribution. This was already a library of static file footprints (no m4 yet), but there was no library window.

Introduction of m4

In PCB 1.4.3 (1996) there was already support for m4 footprints. Since it was still before netlist, it had a huge collection of heavy m4 footprints, e.g. 291 m4 definitions for different 74xxx TTLs with symbolic pin descriptions.

In fact the authors liked the m4 idea so much that the library contained only m4 footprints, no static file footprints! For many versions on, the de facto standard for creating footprints was using m4. There was even a library window, browsing m4 footprints - in fact, it probably didn't even handle non-m4 footprints.

Later on rats nest and the basic netlist idea got implemented. In PCB 1.5.3 (1997) these concepts were already usable. Meanwhile all stock footprints still got shipped as m4.

The gEDA era

In the late '90s gEDA started. It was focusing on a schematics editor (gschem) first, then when a layout editor was needed, they found the PCB project and hooked up. In the early 2000s the two project got more connections, most notably on the level of a netlist based forward annotation.

However importing the netlist only left the user manually placing footprints from the library in gEDA/pcb. The workaround for this was gsch2pcb, an independent tool in between gschem and gEDA/pcb that generated the netlist and edited the pcb board file to remove excess elements and generated files to import new elements specified on the schematics.

Around the same time, users grew to like static file footprints more and gEDA/pcb started to support them again, in parallel to m4 footprints. Static file footprints became the 'newlib' while m4 footprints still maintained in 'oldlib'.

Fall of m4

A few years later 'newlib' took over. Most users didn't want to bother with understanding m4 anymore, plus it was non-trivial to run it on windows. Some time between late 2006 and early 2007, developers decided to make m4 a soft dependency: they simply generated "all" m4 footprints with all relevant combination of parameters and saved them as static file footprints. This collection got merged with manually drawn static footprint.

The resulting lib is found in lib/pcblib-newlib in geda/pcb source distribution. This is the "newest" newlib.

By now, majority of the users use these pre-generated, static file footprint versions of the footprints that were once programmed in m4. The original m4 lib is still shipped with geda/pcb, but the knowledge on how to use them have bit-rotten. Most probably the code that can still deal with the special case m4 footprints will eventually bit-rot too.

The future of m4 footprints

There are a few fundamental problems with the original m4 footprint idea:

The solution is trivial: rewrite the code to not care about m4. Define parametric footprints as "any executable that prints a footprint" without assuming what language it is written in.

And that is exactly what pcb-rnd does, allowing the user to write parametric footprints (footprint generators) in any language: