[HN Gopher] TinyBIOS - A minimalist open-source BIOS project for... ___________________________________________________________________ TinyBIOS - A minimalist open-source BIOS project for fun Author : peter_d_sherman Score : 125 points Date : 2022-11-19 15:27 UTC (7 hours ago) (HTM) web link (github.com) (TXT) w3m dump (github.com) | adrian_b wrote: | The main task for any BIOS is to initialize the memory | controller, which for modern DDR4 or DDR5 memory is a very | complex and undocumented task, so it must be done usually by a | binary firmware blob provided by Intel or AMD. | | The usual operating systems might be able to initialize the | peripherals, but they expect an already working memory and a | memory map provided by the BIOS. | | After a quick browsing through the sources, it seems that this | project has not progressed so far yet, even if it probes for | working memory and it may be able to use the cache memory as RAM | on some CPU models (as all BIOSes must do, before the memory | controller is initialized). | | Under an emulator like QEMU, a BIOS can work even if it is not | able to initialize a real memory controller, but on real bare- | metal hardware that has to work. | buildbot wrote: | The fact that DDR works at all is kinda black magic, every boot | the memory controller does a training routine to understand the | analog aspects of the specific ram and board in order to | actually make it function at all. | https://www.systemverilog.io/ddr4-initialization-and-calibra... | | Edit: Reading the article is really cool, I just searched it as | a reference but it is very in depth! | packetlost wrote: | A lot of wifi/other wireless analog devices go through | analogous training procedures. Things like timing and delays | are pretty important to these types of systems and you don't | have a clock edge to synchronize against like you do in wired | protocols like SPI (though I imagine DDR initialization | _does_ have pins used for this or similar). | monocasa wrote: | Yeah, DDR does have a synchronous clock. One of the points | of calibration is making sure the signals are actually | sampled correctly wrt to the clock signal since the bit | times are so short even small differences of trace length | matter. The length matching is just to get it in the | ballpark that can be corrected with per pin delays. | | Ironically perhaps, at bit times like these it's easier to | not have a clock signal and simply perform clock recovery | like PCIe does, but that comes with higher latency for the | interface. | monocasa wrote: | These days in x86 SoCs, DRAM is normally initialized by other | cores smaller like the ME and PSP before the main core which | would run the bios come up. For instance, apparently oxide's | code doesn't have to bring up DRAM despite being the first code | to run on the main cores. | mkopec wrote: | On AMD Zen and later that is true, but on Intel the BIOS is | still responsible for DRAM init (done via Intel's FSP) | snvzz wrote: | Checked sources just to see what assembler was used. | | It uses NASM, my go-to assembler. A great choice. | 13of40 wrote: | A86 is a great minimalist assembler for 16-bit code. In the | humble words of its author: | | "A86 (with its 32-bit version A386) is the finest assembler | available, at any cost under any terms, for the Intel 86-family | of microprocessors (IBM-PC, compatibles, and not-so- | compatibles)." | | Actually, come to think of it, I'm not sure if a86.exe is a | 16-bit binary or 32, so it might not run on modern Windows. | rkagerer wrote: | The demo image is the clearest boot logging I've ever seen, while | still being succinct. I wish all BIOS's presented themselves so | straighforwardly. | mjovanovic0 wrote: | Side question: what IDE/editor ASM developers use today? | snvzz wrote: | I favor KDE's kate as editor, nasm as assembler, gnu make as | build system. | monocasa wrote: | Whatever they're comfortable with. There isn't really much IDE | support for ASM, so it doesn't really matter what you pick as | long as you can do dirty things with the build system. I tend | to just use vscode. | Karrot_Kream wrote: | Does anyone have any recs to learn about what goes into a basic | BIOS? The TinyBIOS source is super easy to read but I'm looking | more for something like xv6 which is both fun to read and also | pedagogic (a tall order I'm asking for free, I know ;) | jamesy0ung wrote: | I'm quite sure the PC Engines alix2 uses TinyBIOS | spaam wrote: | maybe you thinking about | https://en.wikipedia.org/wiki/Coreboot? | st_goliath wrote: | Most of the ALIX boards use something called TinyBIOS[1][2]. | Browsing through the source tree from the pcengines site, it | doesn't seem to share any relation with this project here. | | The current APU boards use Coreboot[3] | | [1] https://www.pcengines.ch/alix.htm | | [2] https://www.pcengines.ch/tinybios.htm | | [3] https://www.pcengines.ch/apu2.htm ___________________________________________________________________ (page generated 2022-11-19 23:00 UTC)