Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
How can I create a flat binary file out of a single C source file, that can be loaded into a certain address and jumped to?
Lets say I have this in the c source file:
void k_main()
{
char *vid = ( char * ) 0xb8000;
int i = 0;
vid = 'A';
i++;
vid = 0x07;
while ( 1 )
{
}
}
I want this to be put into a flat binary file that can be loaded at an address and jumped to, it would then print the 'A' and then hang.
I have tried many tutorials on writing a simple c kernel, but I dont like them it should be much more simple, if gcc is so complex to use I will not use it.
You are going to have to use a linker script to tell gcc how to link the file. read the docs that come with gcc, it has an example simple linker script that does what you are looking for
where 0x600 is the absolute address where this code is going to reside. This assumes the GDT gives the base address as 0x0 and that you switch to pmode before you jump there.
There are several complications in practice, but this should get you something working.