[fpc-pascal]Using FPC to write an OS.

Marco van de Voort marcov at stack.nl
Fri Jan 3 00:55:25 CET 2003

> How do you use FPC for writing your own OS, kernel etc...
> I've read posts of this before, saying that you use the fakertl in the
> FPC sources. However that doesn't help much, I need a bit more detail
> please...

See it like this:

- FPC generates general 32-bit code, that is transformed into the right
  format by the assembler/linker. (though for some platforms FPC contains
  the assembler). This is in principle not OS dependant, only processor

- the rtl is OS dependant, so you'll need to start over. (partially)
    - A few things (like how to exit a program) need to be always defined.
	This (at least part of it) is what's defined in fakertl.
    - Some language features (like sets, operations on 64-bits types)
	require certain helpers to be defined in the rtl. A description is
	in the "internal" documentation has some info on that (which is
	usually outdated, but maybe still a good reference). I latex'ed it,
	and put the PDF on www.stack.nl/~marcov/comparch.pdf

        Most of these are processor dependant only though, that's why
	there is a processor dependant include in the fakertl.

Start with the fakertl, and try to build a minimal set of required features
for what you need in the kernel on top of it, build an ELF binary with it,
and start it with grub :-)

More information about the fpc-pascal mailing list