Compile your own OS with Visual Studio
Compile your own OS with Visual Studio
Hi !
Is it possible to develop and to compile an OS under Visual Studio ?
I don't know how to do ! I didn't manage to indicate a binary output format...
It would be fine if someone could explain me the different step...
(I want to use the MS Visual Studio, beause I don't like le AT&T inline assembler of GCC...)
Thanks a lot ! ::)
Is it possible to develop and to compile an OS under Visual Studio ?
I don't know how to do ! I didn't manage to indicate a binary output format...
It would be fine if someone could explain me the different step...
(I want to use the MS Visual Studio, beause I don't like le AT&T inline assembler of GCC...)
Thanks a lot ! ::)
Re:Compile your own OS with Visual Studio
I also hate the AT&T syntax used by most C compilers.
Unfortunatly AFAIK Visual C++ 2.0 and higher can not be used to create executables for anything other then windows (or another supported platform such as WinCE, if support is installed).
One of the reasons I don't use C at all is that there are no good compilers out there with support for a decent assembler. I use TASM as my assembler but haven't looked into Borland C. You might try that.
The thing with using C is that you always have to deal with platform-dependant crap being added to your code. And finding hacks to get the compiler to cut it out. And in the end you end up writting your own library anyway.
Don't get me wrong, there are people who swear by C/C++ for OS development! For me, I'm very comfortable working with assembler so that's what I use. Good luck finding a C compiler that will work for you. Who knows, maybe someone here knows a way to get VC++ to output platform-independant code.
Just my $0.02.
-Robert
Unfortunatly AFAIK Visual C++ 2.0 and higher can not be used to create executables for anything other then windows (or another supported platform such as WinCE, if support is installed).
One of the reasons I don't use C at all is that there are no good compilers out there with support for a decent assembler. I use TASM as my assembler but haven't looked into Borland C. You might try that.
The thing with using C is that you always have to deal with platform-dependant crap being added to your code. And finding hacks to get the compiler to cut it out. And in the end you end up writting your own library anyway.
Don't get me wrong, there are people who swear by C/C++ for OS development! For me, I'm very comfortable working with assembler so that's what I use. Good luck finding a C compiler that will work for you. Who knows, maybe someone here knows a way to get VC++ to output platform-independant code.
Just my $0.02.
-Robert
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Compile your own OS with Visual Studio
if AT&T is your sole reason, then you might like the intel-syntax trick ..
asm (".syntax intel noprefix")
asm (".syntax intel noprefix")
Re:Compile your own OS with Visual Studio
If you combine Pype's intel syntax trick with a VC++ Makefily project, you can easily get your existing OS to build from VC++ (still uses GCC to compile, which is why you still need the intel syntax trick). Then you get to keep the benefits of an easily reusable makefile, the intel syntax, and MS's syntax coloring (and stuff like visual studio if you use it).
This is the method I use and it works pretty well.
- Brandon
This is the method I use and it works pretty well.
- Brandon
Re:Compile your own OS with Visual Studio
Or you could simply code your assembly functions separately and assemble them with the assembler of your choice. But then, I never really cared for inline assembly anyway, so I'm biased...
Re:Compile your own OS with Visual Studio
No, what you mean is: "Visual C++ can't create anything other than PE executables". It's inconvenient to use VC++ to build a kernel, but not impossible, and certainly not impossible for user-mode apps.Robert Lee wrote:Unfortunatly AFAIK Visual C++ 2.0 and higher can not be used to create executables for anything other then windows (or another supported platform such as WinCE, if support is installed).
Re:Compile your own OS with Visual Studio
thanks to you all !
So, I must use :
in a make file ? Is it what you suggest Brandon ?
I'm very interested in your solution !
So, I must use :
but were ?Pype.Clicker wrote: if AT&T is your sole reason, then you might like the intel-syntax trick ..
asm (".syntax intel noprefix")
in a make file ? Is it what you suggest Brandon ?
Could you explain me that in more details please ?bkilgore wrote: If you combine Pype's intel syntax trick with a VC++ Makefily project, you can easily get your existing OS to build from VC++ (still uses GCC to compile, which is why you still need the intel syntax trick). Then you get to keep the benefits of an easily reusable makefile, the intel syntax, and MS's syntax coloring (and stuff like visual studio if you use it).
This is the method I use and it works pretty well.
- Brandon
I'm very interested in your solution !
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Compile your own OS with Visual Studio
just issue that asm instruction before any of your inlined asm (it may be in a kind of global.h that will be included first in any C file, or repeated at the top of every .H/.C file that declares some asm("...") stuff ...
Re:Compile your own OS with Visual Studio
..
Last edited by Perica on Sun Dec 03, 2006 9:14 pm, edited 1 time in total.
Re:Compile your own OS with Visual Studio
Thanks for those precisions, I will try it this week-end...
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Compile your own OS with Visual Studio
@perica: i haven't tryed your macros, but i fear they'll make troubles as soon as commas will be used...
maybe replacing "#define iAsm(x)" by "#define iAsm(x...) " could help
maybe replacing "#define iAsm(x)" by "#define iAsm(x...) " could help
Re:Compile your own OS with Visual Studio
With recent GCC compilers, you can use the following command line parameter :
to override the default AT&T syntax.
Code: Select all
gcc #your params here# -masm=intel
Re:Compile your own OS with Visual Studio
I think it's pretty funny how people today flame the AT&T syntax... IMHO, that shows you've never programmed anything else but an x86, and never in anything else but Intel syntax.
Ask people from the good ol' times of 6802 or 680x0 CPUs, or those writing PPC code, or quite a lot others: As with almost everything else, the "Intel way" is quite screwed up, it's just so commonplace that most people accept it as being "right"...
I seriously suggest giving AT&T syntax a try beyond the initial frustration phase. I am very thankful for not having to think "backwards" with every other statement, and the prefixes add explicitness which I consider A Good Thing (tm).
One statement makes my toenails curl:
Somewhere down the road, you have to make the transition from ASM to HLL anyway (unless you want to force your users writing everything in ASM, too). I prefer getting my co-developers into the "comfort zone" as quickly as possible, which means I try to make the ASM-HLL transition as early as feasible.
Ask people from the good ol' times of 6802 or 680x0 CPUs, or those writing PPC code, or quite a lot others: As with almost everything else, the "Intel way" is quite screwed up, it's just so commonplace that most people accept it as being "right"...
I seriously suggest giving AT&T syntax a try beyond the initial frustration phase. I am very thankful for not having to think "backwards" with every other statement, and the prefixes add explicitness which I consider A Good Thing (tm).
One statement makes my toenails curl:
Which means "inline assembler", which also means you don't seperate your assembler from your HLL (high level language), which usually isn't that good a design decision IMHO.One of the reasons I don't use C at all is that there are no good compilers out there with support for a decent assembler.
That's not a "hack" but a "command line option". Welcome to kernel space which simply cannot be the default setting to a toolchain by anyone's standards.The thing with using C is that you always have to deal with platform-dependant crap being added to your code. And finding hacks to get the compiler to cut it out.
...or porting it, which is probably the more efficient way. (BTW, anyone knowing a good Public Domain C lib?)And in the end you end up writting your own library anyway.
Somewhere down the road, you have to make the transition from ASM to HLL anyway (unless you want to force your users writing everything in ASM, too). I prefer getting my co-developers into the "comfort zone" as quickly as possible, which means I try to make the ASM-HLL transition as early as feasible.
The goal of an OS developer is not to write platform independent code, but to enable platform independent code (if that is a feature of the OS). At least as I understand it: Your job is hard, so that the job of all others is easy.Who knows, maybe someone here knows a way to get VC++ to output platform-independant code.
Every good solution is obvious once you've found it.
Re:Compile your own OS with Visual Studio
Hi, well I think it is pretty cool to use visual c++ for editing os code. Why is it inconvenient? I think with method that bkilgore tells, visual c++ can be used to code a kernel but as far as I could observe you can just use its good editing and source code handling features. Also I got tired of working with notepad maybe a change will be good becuase with vc++ you can set background and foreground colors to something that does not tire your eyes, you know after working with notepad about 3-4 hours of coding, I just start seeing stars and my head aches very badly... I remembered old days of windows programming... ;D BTW, I also donot like inline assembly...
Re:Compile your own OS with Visual Studio
I have yet to find any IDE that comes with an editor that suits my needs. AmigaOS' StormC offered integration with GoldED, which is one of the best editors I've ever used.Ozguxxx wrote: Also I got tired of working with notepad maybe a change will be good becuase with vc++ you can set background and foreground colors to something that does not tire your eyes, you know after working with notepad about 3-4 hours of coding, I just start seeing stars and my head aches very badly...
Editors for Windows:
UltraEdit, http://www.ultraedit.com - better than TextPad IMHO; crippled Shareware (demo does not save).
TextPad, http://www.textpad.com - the "standard"; uncrippled Shareware (but remember, software worth using is software worth buying!).
Editor for Windows and Linux:
SciTE, http://www.scintilla.org/SciTE.html - GPL'ed; the GUI is not as elaborate, but the feature set is quite complete.
Some people also swear on Emacs, but as you see from my list of suggestions, I prefer GUI editors.
Every good solution is obvious once you've found it.