Hi,
i started creating an hobby operating system with freebasic. it is micro kernel based, with a file server (including support for hard disk and fat file system), and a gui server.
There is small little apps written: (text editor, demo program, Flat Assembler port + Frontend, terminal + command line interpreter, and 2 utility to test the terminal : cat and echo)
the sources are available there : https://github.com/stephaneweg/onyx-kernel
the next steps would be to port the FreeBasic compiler on it. (for now i would like to port only the compiler, not the runtime, because the apps does'nt use it for now) does someone already did it , how hard would it to port it?
Freebasic operating system
-
- Posts: 3
- Joined: Oct 20, 2016 17:55
Re: Freebasic operating system
I am not sure if I understood right: your programs are low level enough to work without the runtime, but you want to port the compiler to your OS (so you would be able to compile from inside your new operating system)?
Usually, when porting a compiler, the opposite is done: first you port the runtime (so you can cross compile from another OS), and then you port the compiler itself.
Anyway, as far as I know the FreeBasic compiler makes heavy use of its own runtime, so you cannot port it to a new platform if you don't have the runtime for that platform first. Strings, for example, are managed by the runtime library (otherwise FreeBasic could only use Zstrings pointers), and the compiler does use strings in several parts of it.
Usually, when porting a compiler, the opposite is done: first you port the runtime (so you can cross compile from another OS), and then you port the compiler itself.
Anyway, as far as I know the FreeBasic compiler makes heavy use of its own runtime, so you cannot port it to a new platform if you don't have the runtime for that platform first. Strings, for example, are managed by the runtime library (otherwise FreeBasic could only use Zstrings pointers), and the compiler does use strings in several parts of it.
-
- Posts: 3
- Joined: Oct 20, 2016 17:55
Re: Freebasic operating system
exactly, for now i dont use the runtime at all (i use -nodeflibs arguments; then ld is used to link them with the executable header to generate an executable elf for my os) ; for the programs i created includes files to invoke kernel functions, sending ipc messages to the system services (which are separate user processes), etc...angros47 wrote:I am not sure if I understood right: your programs are low level enough to work without the runtime, but you want to port the compiler to your OS (so you would be able to compile from inside your new operating system)?
i think that if i could port the minimal required function from the runtime, and glue them to specific os functions (like open files, allocate memory, etc...) it would be possible to port the compiler, no?
but i know also that it use gcc or gas as backend, it would be nice if it could use FASM as backend too
Re: Freebasic operating system
To run the compiler, you would need to port at least:
- basic I/O functions (to read and write on files, and to display error messages)
- basic file functions (check if file exists, open it, create a new file to write in it, close it, call external programs)
- string functions (to parse the source code, and the command line parameters)
- dynamic memory allocation (needed to use strings)
If you port them, you have basically ported the whole runtime library, because there is not much else inside it.
- basic I/O functions (to read and write on files, and to display error messages)
- basic file functions (check if file exists, open it, create a new file to write in it, close it, call external programs)
- string functions (to parse the source code, and the command line parameters)
- dynamic memory allocation (needed to use strings)
If you port them, you have basically ported the whole runtime library, because there is not much else inside it.
Re: Freebasic operating system
Hi. I want to test your OS in VirtualBox but I don't see any ISOs.