Page 1 of 1
what exactly is a toolchain?
Posted: Mon Nov 19, 2007 9:34 am
by maverick777
Hi I am currently reading the guide
http://www.brokenthorn.com/Resources/OSDevIndex.html
Which being new to this kind of development Im really enjoying and even at worse case If I cant do OS dev, well educationally it has already benefited me. (Thanks to reading this site Ive got further in a week than I did in 1 month when I attempted this 1 year ago)
So currently Im getting into writing a stage 2 bootloader, however I hear people mentioning the term OS toolchain and would just like explained what this is in respect to what it achieves, its purpose .
My guess is that it involves say compiling your gcc and other needed tools on windows xp with cgywin but built for a target OS? Is this assumption true and if so how does one get the setup and get the built tools working with the OS, Its a huge subject I guess so any links that start out as basic as possible and building in small chunks to aid learning would be appreciated, also preferably someplace that explains everything in a concise way.
Thanks
Dave
Posted: Mon Nov 19, 2007 9:45 am
by AJ
Hi,
Have a look at
GCC Cross-Compiler on the wiki. A tool chain is the set of tools you use in conjunction with your target platform. For example, a windows toolchain for userland apps may just consist of Visual Studio, or Sharpdevelop for example. Your OS development toolchain may consist of GCC, binutils and newlib on Cygwin. A toolchain does not have to be cross-compiled in order to be called a toolchain.
A toolchain will be targetted at a specific platform or may be able to cope with a number of platforms. GCC is very versatile in this way. If you are using GCC on 32-bit (PC) Linux, it will most likely be targetted to produce ELF32 binaries and may have support for reading information in COFF binaries too. This means that by default, it will try to link in a number of linux runtime files and libraries. Creating a cross-compiler for your own OS, ensures that this does not happen. If you want to targed i386-pc-coff by default, you can do. If you want to target an 8 bit AVR uC, you can do.
Not very succinct, I know, but hopefully you get the idea. Read the link above (and the parent wiki page) for more info.
Cheers,
Adam
Posted: Mon Nov 19, 2007 11:34 am
by neon
For example, a windows toolchain for userland apps may just consist of Visual Studio, or Sharpdevelop for example. Your OS development toolchain may consist of GCC, binutils and newlib on Cygwin. A toolchain does not have to be cross-compiled in order to be called a toolchain.
I should probably be honest and just say that my toolchain only consists of only nasm and visual studio (The compilier+linker+ide) - for both os development and applications
It does not have the benifits of building a cross compilier, though. I just wanted to point out that there are alot of ways to develop you toolchain - just use the tools that are avilable to you, and that you feel most confortable with
Posted: Mon Nov 19, 2007 12:52 pm
by JAAman
For example, a windows toolchain for userland apps may just consist of Visual Studio
actually, Visual Studio is the name commonly used (improperly) to describe an entire toolchain -- not just one program, this example would be better written as:
windows development toolchain:
compiler: MS CC
linker: MS link
library: MS MFC
assembler: MS MASM
GUI: MS Visual Studio
...
all of these are commandline tools, which are freely available (most have been for more than 10+ years) -- the only reason people associate them with visual studio, is because that is the default toolchain that visual studio is set to work with when you first install it (though any piece or pieces can be changed)
Posted: Mon Nov 19, 2007 2:31 pm
by maverick777
Ok
, I will check out the link and I think I get a rough idea from the comments also .
Thanks all!
Posted: Mon Nov 19, 2007 5:38 pm
by maverick777
Just finished all the guides prior to the Kernel Setup: MSVC++ 2005 one
, on the brokenthorn site , seems like Im going to be reading alot about tool chains after all
, Im understanding what Im reading(Its retaining it alls that is the prob eek
, think when I get to the point Im writing my own stuff I will draw big memmory map posters on my wall haha) but the more I read the more I am starting to see the needs for abstractions now lol
Posted: Mon Nov 19, 2007 6:06 pm
by crazygray
Because I like using machine code I use HxD Hex Editor and fasm to check and make sure the instructions are correct.
I personally hate vs express I don't know about the other versions.
Posted: Mon Nov 19, 2007 6:59 pm
by maverick777
Fair comment CG :-)but Im using it purely to finish of a guide, a very good guide at that
but once I have got vc setup accordingly Im going to look into setting up a gcc toolchain for my os and mess about writing some assembly routines learning more of asm while the guy writes up more guides . I saw in another post you really like writing in hex
, I was wandering if you knew anyplace that would give me all the assembly language opcodes and instructions , in a really straight forward format? e.g
Mov a,b <Opcode>
etc
Thanks
Posted: Mon Nov 19, 2007 7:22 pm
by neon
I can probably point you to the
Intel Manuals, Volumes 2A and 2B - it containes all instructions and opcode formats
Posted: Mon Nov 19, 2007 7:41 pm
by crazygray
thats what I learned from.
Posted: Tue Nov 20, 2007 8:43 am
by maverick777
Thanks
yeah it looks like its in a good format, the only thing is I have an amd 64 dual core x2........Is it the case that aside from a few Model specific registers the actual architecture is the same and thus the intel manual will be fine for me?
I did download an amd 64 manual but I didnt see opcodes in it but maybe I just didnt look hard enough
Posted: Tue Nov 20, 2007 11:01 am
by JAAman
yes, aside from a few (rare) instructions, they are identical -- thats why your program can work on both -- aside from a few minor details, they are exactly the same from the ISR standpoint
intel 2B:appendix B gives you most of what you need (including a nice chart in table B-13 -- though you will need the information in the previous charts for filling in bit-fields), the rest is in 2A:2 (the mod/RM and SIB encodings) -- i highly recommend this method over using chapter 3, since it is simpler and more complete (and easier to use)
the actual architecture is the same and thus the intel manual will be fine for me?
this is actually 2 different questions:
the actual architecture is actually
very different
yes the intel manuals will work fine for almost everything -- because the
ISR architecture is the same
for the AMD manuals, there is no equivalent chart like B-12, only the opcode maps (located in volume 3, appendix A -- intels opcode map is also in appendix A) -- of course maybe its changed, my AMD manuals are quite old (i dont keep them up-to-date)