A21 — Code-Protected Firmware Library
Syscall-style ABI on bare metal
Turned a tightly coupled access-control codebase into a reusable, code-protected binary firmware library with an OS-like syscall ABI — so one physical board ships as multiple products, each just a simple business-logic app on the shared precompiled library.
- Client
- Access-control product line (name withheld — NDA)
- Delivery
- Delivered by our founder at IoTech Designs
- Role
- Research & Solution Architect — system architecture and core library
- Timeline
- 2019 – 2021
Stack
help The problem
In access control roughly 80% of the firmware is the same from board to board — readers, I/O handling, access logic. In this codebase it was all cross-linked, so the reusable majority could not be reused: every new product meant reworking shared code, and the same hardware could not be sold as different products without a rewrite. A second, harder constraint sat on top: the shared IP could not ship as source — not even as a static library, which still links into the customer's app where it can be picked apart.
build What we built
- The reusable core split out as a standalone firmware library distributed as a precompiled binary at a fixed memory location — never source, never a linkable object.
- Two-stage boot: a primary bootloader loads the library; the library in turn hands off to and starts the application.
- A syscall-style ABI — every service, from hardware peripherals (GPIO, I2C, SPI, ADC) to logical modules (inputs, outputs, card readers), exposed through a vector table at a known location, the way an OS exposes a syscall table. The app enters through a software interrupt (SVC); arguments and return codes are marshalled by stack-frame manipulation, so the interface stays stable with no linking between app and library.
- The library owns and arbitrates all resources centrally, so two logical modules cannot collide over the same hardware.
- The application is deliberately trivial — Arduino-simple C holding only business logic. A HAL wrapper beneath the library allows the MCU to be swapped later without touching either side.
check_circle The result
- done Shipped in production — the platform is used in commercial access-control products in the field.
- done One board → multiple products, with zero rework of the protected core. A new product becomes "write a small business-logic app".
- done OS-level architecture on bare metal: syscall ABI via SVC, vector table and stack-frame marshalling, central resource arbitration, a real code-protection strategy, and portability engineering.