ENGINEERING 229 upvotes 2025

Bare metal printf – C standard library without OS

229 pts
Hacker News Signal
2025 · Shared by @todsacerdoti
Bare metal printf – C standard library without OS by @todsacerdoti

Retrospective Overview & Key Insights

Distilled reflections, business mechanics, and tactical takeaways:

In this technical retrospective (2025), @todsacerdoti shares practical architectural lessons learned from running, scaling, or migrating production software under lean constraints.

Core Principles for Independent Builders:
1
Defaulting to simpler architectures (such as monolithic frameworks, SQLite, or managed VPS) prevents early engineering bankruptcy.
2
Evaluating true compute and egress costs reveals that high cloud bills can often be slashed by 80%+ through judicious re-platforming.
3
Code you write at 2 AM as a solo engineer must be easy to debug six months later without complex microservice dependencies.
Community Debate Themes:

HN engineers debated the tradeoffs between cloud convenience and raw server economics, database indexing strategies, and resisting premature architectural complexity.

Community Discussions & Critical Reviews

Key perspectives, counter-arguments, and peer founder insights debated on Hacker News (81 total discussions):

CH @ChuckMcM Peer Contributor
EI @einpoklum Peer Contributor
DA @dailykoder Peer Contributor

``` // QEMU UART registers - these addresses are for QEMU's 16550A UART #define UART_BASE 0x10000000 #define UART_THR (*(volatile char *)(UART_BASE + 0x00)) // Transmit Holding Register #define UART_RBR (*(volatile char *)(UART_BASE + 0x00)) // Receive Buffer Register #define UART_LSR (*(volatile char *)(UART_BASE + 0x05)) // Line Status Register ``` This looks odd. Why are receive and transmit buffer the same and why would you use such a weird offset? Iirc RISC-V allows that, but my gut says I'd still align this to the word size.

RO @Rochus Peer Contributor

Newlib is huge and complex (even including old K&R syntax) and adapting the build process to a new system is not trivial. I spent a lot of time with it when I re-targeted chibicc and cparser to EiGen, and finally switched to PDCLib for libc and a part of uClibc for libm; see https://github.com/rochus-keller/EiGen/tree/master/ecc/lib ↗. The result is platform independent besides esentially one file.

NE @Neywiny Peer Contributor

In school we were taught that the OS does the printf. I think the professors were just trying to generalize to not go on tangents. But, once I learned that no embedded libc variants had printf just no output path, it got a lot easier to figure out how to get it working. I wish I knew about SWO and the magic of semihosting back then. I don't think those would be hard to explain and interestingly it's one of the few things students asked about that in the field I'm also asked how to do by coworkers (the setting up _write).

HISTORICAL ERA Post-ZIRP & AI (2023–2026)
COMMUNITY SCORE 229 points
TOTAL DISCUSSIONS 81 comments
TOPICS & TECH STACK:
More Retrospectives by @todsacerdoti