what exactly is a toolchain?

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.
Post Reply
maverick777
Member
Member
Posts: 65
Joined: Wed Nov 14, 2007 3:19 pm

what exactly is a toolchain?

Post 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
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Post 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
User avatar
neon
Member
Member
Posts: 1567
Joined: Sun Feb 18, 2007 7:28 pm
Contact:

Post 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 :)
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
User avatar
JAAman
Member
Member
Posts: 879
Joined: Wed Oct 27, 2004 11:00 pm
Location: WA

Post 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)
maverick777
Member
Member
Posts: 65
Joined: Wed Nov 14, 2007 3:19 pm

Post by maverick777 »

Ok :-) , I will check out the link and I think I get a rough idea from the comments also .

Thanks all!
maverick777
Member
Member
Posts: 65
Joined: Wed Nov 14, 2007 3:19 pm

Post 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
User avatar
crazygray
Member
Member
Posts: 73
Joined: Sat Nov 03, 2007 10:17 am
Location: Toky,Japan

Post 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.
Imagine if a creature came from a 4 dimensional world, would he think you to be flat?
maverick777
Member
Member
Posts: 65
Joined: Wed Nov 14, 2007 3:19 pm

Post 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 :-)
User avatar
neon
Member
Member
Posts: 1567
Joined: Sun Feb 18, 2007 7:28 pm
Contact:

Post by neon »

I can probably point you to the Intel Manuals, Volumes 2A and 2B - it containes all instructions and opcode formats ;)
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
User avatar
crazygray
Member
Member
Posts: 73
Joined: Sat Nov 03, 2007 10:17 am
Location: Toky,Japan

Post by crazygray »

thats what I learned from. :D
Imagine if a creature came from a 4 dimensional world, would he think you to be flat?
maverick777
Member
Member
Posts: 65
Joined: Wed Nov 14, 2007 3:19 pm

Post 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 :-)
User avatar
JAAman
Member
Member
Posts: 879
Joined: Wed Oct 27, 2004 11:00 pm
Location: WA

Post 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)
Post Reply