1. Download and install Visual Studio 2005 Express Edition from http://msdn.microsoft.com/vstudio/express/ . Its free !
2. Read the instructions at
http://user.chem.tue.nl/jakvijn/tonc/setup.htm#sec-msvc
specifically the sed tweaking required to massage the gcc compiler diagnostic messages to match the output expected by Visual Studio.
3. Make a copy of the existing Visual HAM project makefile and edit it to define the path to the Visual HAM installation directory at the very top of the file. E.g. for my case I made a copy of the makefile called makefile.mak and added the line
HAMDIR = d:\gameboy\vh
4. Start Visual Studio 2005, navigate the menu
File -> New -> Project
Under the 'Project Types' tree, select 'General'
Select 'Makefile Project'
5. In the Makefile application wizard dialog that pops up, select 'Debug Configuration Settings'
6. In the next dialog enter the make commands for Build, Clean and Rebuild as per your makefile target.
E.g.for my 'Debug Configuration' Build, the target was vbawin in the makefile
make -f makefile.mak vbawin 2>&1 | sed -e 's/\(\w\+\):\([0-9]\+\):/\1(\2):/'
You can similarly do the same for the Clean and Rebuild options, and again for the 'Release Configuration Settings'. For my example, the Clean target is
make -f makefile.mak clean
In the same dialog give your project the name that you want for your application. Later you will import the source code from your VHAM project into this Visual Studio project.
7. The cygwin stream editor sed is not installed with VHAM, so go to www.cygwin.com and install cygwin. I had enough free disk space so I went with the default installation. Doesn't hurt to have a complete set of Unix-style command line utilities in Windows.
8. Under Windows Start->Control Panel->System->Advanced Settings->User environment variables edit the path variable to add the directory with the cygwin executables and libraries.
E.g. my cygwin installation was in d:\cygwin, so I appended d:\cygwin\bin to the path string.
9. Delete the older cygwin*.dll libraries in your HAMDIR\gcc-arm\bin and HAMDIR\tools\win32. Or rename them to something harmless e.g. cygwin*.dll -> cygwin*.old.dll
Now you should have only one set of cygwin libraries, the up-to-date version in your cygwin\bin directory.
10. Start up Visual Studio 2005. Add the path to the gcc-arm executables.To do this, navigate to Tools->Options->Projects_and_Solutions->VC++ directories.
Select Executables
Add the paths to the Visual Ham executables, in my example it was
d:\gameboy\vh\tools\win32
d:\gameboy\vh\bin
d:\gameboy\vh\gcc-arm\bin
11. Double click on the Visual Studio .sln file created by the makefile application wizard. Now import the source code from your VHAM project. Click on the Solution Explorer tab on the left and then add the files by right clicking Header Files->Add and Source Files->Add. Copy the edited makefile file from step 3 into the Visual Studio project directory containing the .vcproj file. You're done!
12. Here's an example of successful compilation using F7 under Visual Studio 2005
13. Here's an example of a compile error - with the magic massaging of the gcc stderr output using sed, double clicking on the error message takes you to the offending source code line just as it does for native Visual C++ compiles.
For a new project, all you have to do is repeat steps 4,5, 6 and 11. If you are starting a new project from scratch, pick any existing Visual Ham makefile, e.g. from the vham demo sub-directory, and edit the list of object files to replace them with your own...
A sample project with source code can be downloaded here.
The Visual Studio 2005 IDE code and data structure navigation, source code highlighting and Intellisense are a big improvement for sure !