Page 1 of 1
using gcc plz help
Posted: Mon Aug 15, 2005 12:54 am
by codemastersnake
Hello everyone!
Well I have decided to shift to gcc and ld for developing my OS....
I am creating a RM OS and don't know how to use gcc and ld for creating a DOS COM file i.e. raw binary file that can be loaded into memory as it is fo exeution...
I am presently using turbo C++ for that...
I use:
tcc -c -r- -mt -2 file.cpp
this gives me file.obj
then I use:
tlink /t file kstart, kernel.bin
I also have a ksatrt.asm file which calls main() which I compiled and used above....
this gives me kernel.bin file. But I don't know how to use gcc for 16bit RM OS... Ihave tried many shots in dark but no one got right....
please help.....
Re:using gcc plz help
Posted: Mon Aug 15, 2005 1:10 am
by Brendan
Hi,
Codemaster Snake wrote:I am creating a RM OS and don't know how to use gcc and ld for creating a DOS COM file i.e. raw binary file that can be loaded into memory as it is fo exeution...
I don't think there is a version of GCC that can produce 16 bit/real mode code (it's 32 bit or 64 bit only).
On Linux platforms, try the "BIN86" package (see
http://www.cix.co.uk/~mayday/). This includes a C compiler, assembler, LD, etc all designed for producing real mode code. I'm not sure if there's a DOS/Windows port or not (I assume it can be compiled with CYGWIN on Windows)...
Cheers,
Brendan
Re:using gcc plz help
Posted: Mon Aug 15, 2005 2:38 am
by raywill
Yes,I got similar problem.
As gcc does not generate 16 bits code,that adds me lots of problem.
I suggest giving up the idea of building a real mode OS.
Protected mode is a little ugly ,but useful,isn't it
Re:using gcc plz help
Posted: Mon Aug 15, 2005 7:46 am
by codemastersnake
So this means that I'kll have to switch my OS to PM to be able to use it with gcc...
That's a hell of a kind of problem... No I'll have to dig the **** of PM programming and then write my OS from the sctrach again....
Re:using gcc plz help
Posted: Mon Aug 15, 2005 7:50 am
by codemastersnake
Plz can anyone explain me this script:
Code: Select all
/* Link.ld */
OUTPUT_FORMAT("binary")
ENTRY(start)
SECTIONS
{
.text 0x100000 :
{
code = .; _code = .; __code = .;
*(.text)
. = ALIGN(4096);
}
.data :
{
__CTOR_LIST__ = .; LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2) *(.ctors) LONG(0) __CTOR_END__ = .;
__DTOR_LIST__ = .; LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2) *(.dtors) LONG(0) __DTOR_END__ = .;
data = .; _data = .; __data = .;
*(.data)
. = ALIGN(4096);
}
.bss :
{
bss = .; _bss = .; __bss = .;
*(.bss)
. = ALIGN(4096);
}
end = .; _end = .; __end = .;
}
INPUT(KStub.o Support.o OStream.o Interrupt.o kernel.o IStream.o Video.o string.o keyboard.o kbInt.o)
OUTPUT(bin\Kernel.bin)
Re:using gcc plz help
Posted: Mon Aug 15, 2005 8:14 am
by AR
Flat binary output
Symbol where execution starts (ie. entrypoint)
Text (ie. code) segment starting at 0x10000 physical/virtual
All .text segments from all source files
Segment ends on a page boundary
Code: Select all
__CTOR_LIST__ = .; LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2) *(.ctors) LONG(0) __CTOR_END__ = .;
Global constructor list, the other is the destructor list
Code: Select all
INPUT(KStub.o Support.o OStream.o Interrupt.o kernel.o IStream.o Video.o string.o keyboard.o kbInt.o)
Haven't seen this before but it clearly declares what object files are to be linked
Haven't seen this before either but it clearly declares the output file
Re:using gcc plz help
Posted: Mon Aug 15, 2005 10:47 am
by codemastersnake
So this means that I can use this only with 32bit protected mode OS.