Reputation: 159
Hello I have been following the Cambridge Computer Labs: Baking Pi guide where you can build your own simple OS for the ARM CPU for the raspberry pi is assembly. My question is that how would you be able to implement a simple C compiler so i could run basic C programs in the OS (and how would you be able to even compile without the necessary headers? Would you need to implement them your self)
Upvotes: 0
Views: 118
Reputation: 25873
Well, that's a HUGE task...
Upvotes: 3
Reputation: 2842
You have to compile the c library into an assembly file for the ARM cpu on a different machine. Then you're left with a binary file that you load into memory on the ARM machine, and you set the pc register to the start of the compiler if you want to start running it. You'll have to know the semantics of where pointers are located that point to your source files and such. http://www.osdev.org/ has a lot of information about bootstrapping a c compiler.
Upvotes: 0