Arduino uses a simple system that works - at a very rudimentary level - somewhat along the lines you describe for Topic 1, albeit entirely at runtime (and it imposes no requirement that pin assignments are configured in a single location).
https://github.com/arduino/ArduinoCore-samd/tree/master/variants
https://github.com/arduino/ArduinoCore-samd/blob/master/cores/arduino/wiring_digital.h
The table g_APinDescription
serves as the database, and pinMode()
and other functions manage the pin assignments.