Page 1 of 1

GCC/Binutils, I want to help

Posted: Mon Feb 15, 2010 12:35 pm
by joniwalker
I want to help with the tutorial for GCC/Binutils.
Sorry for my bad english.

I have an working VS 2008 Solution configured for cygwin GCC/Binutils using an simple Makefile.
With you want I can write an tutorial for this, or send the code to you.
Its launch bochs and I plan to atach to it with GDB 7.0.

Re: GCC/Binutils, I want to help

Posted: Tue Feb 16, 2010 2:30 pm
by gedd
If you want help on gcc/binutils you can visit wiki.osdev.org, there you will have all the answers.

Re: GCC/Binutils, I want to help

Posted: Sat Feb 20, 2010 1:00 am
by Fanael
He doesn't want help, he wants to help, presumably with writing a chapter about configuring Cygwin for operating systems' development. Did I understand correctly?

Re: GCC/Binutils, I want to help

Posted: Sat Feb 20, 2010 3:34 pm
by joniwalker
Fanael wrote:He doesn't want help, he wants to help, presumably with writing a chapter about configuring Cygwin for operating systems' development. Did I understand correctly?
Yes, is this that I want.

Re: GCC/Binutils, I want to help

Posted: Sun Feb 21, 2010 12:32 am
by Mike
Hello,

It is great that you would like to contribute :D If you wish, please feel free to do so - it can be uploaded as-is so all credit goes to the original author.

The final tutorial

Posted: Sun Feb 21, 2010 2:08 pm
by joniwalker
Mike, you must write the final tutorial for the web site. Changing the design of the tutorial.

Download the base files on the attachment.

First, create the subdirs:
  • vcproj
  • src
Next, you need create a Makefile C/C++ project on the vcproj subdir.
Then, on the main dir, copy the *.bat files and the dobuild.sh file from the base files.

On the src dir, put the Makefile, the Makerules and the kernel.ld from the src dir from base files.

On each code subdir, put a Makefile with the next code:

Code: Select all

LIBNAME=The name of the current dir

include $(ROOT)/Makerules

# This not work yet
export-lib-dir:
	@shell export CURLIBDIR=`pwd`
$(ROOT) is set on domake.bat
For this you need to set the CYGPATH variable to the path of cygwin.
You need to change the compilers in Makerules file
You can use the i586-elf-gcc, for this, see wiki.osdev.org/GCC_Cross-Compiler
You need to put these files on the $(CYGPATH)/usr/cross/

Then add the name of the code dirs on the main Makefile:

Code: Select all

DIRS = Name of the code dirs with the makefile above.
Back to VS 2008 or VC Express.
Go to properties of the project, in Debugging, type the command line of the emulator.
On the NMake, type:
Build command line: cd $(SolutionDir) <NewLine> build.bat
Rebuild command line: cd $(SolutionDir) <NewLine> rebuild.bat
Clean command line: cd $(SolutionDir) <NewLine> clean.bat
Output: The final executable.
Common language runtime: No support
Preprocessor definition: X86;__ELF__;_DEBUG and anymore that you want, splited by ;.
Include search path: $(SolutionDir)\src\include\

If you change the preprocessor definitions, go to the makerules and edit the DEFINES to some like this:

Code: Select all

DEFINES=-DX86 -DDEBUG -DMULTIBOOT_KERNEL -DWhat you want
The DEFINESASM is only for asm code.

With these Makefiles, you can use:
  • C code with .c extension.
  • C++ code with .cpp extension.
  • NASM code with .asm extension.
  • GNU ASM code with .S extension.
And press Ok.
On the main makefile:
Edit to change the cp command to copy to the correct dir.