WinAVR and Windows Vista
When Windows Vista was relatively new, many people reported problems with WinAVR installed on Vista. Main cause of the problem was a new version of msvcrt.dll that did additional parameter checking. A bug in GCC that had gone unnoticed because of the lack of this parameter checking in earlier versions suddenly caused problems. The problems were not limited to Vista but also occurred on Windows 98 and Windows XP installations with a recent version of the same DLL. The error was the dreaded _spawnvp error:
On my website I provided a fix for this problem in the form of a binary patch for avr-gcc.exe. Currently this patch is not needed anymore since later versions of WinAVR had the fix included. If you have the latest version of WinAVR, no fix is needed. The _spawnvp problem has been solved largely in version 20070525 (May 2007) with the exception of some _spawnvp problems caused by a different problem on Windows 98 like systems. The recent 20071221 version should solve all spawnvp problems. With this version, there is no need to apply the patch I made earlier.
Other problems
To add to the confusion, there are two other problems. One is independent of the Windows or WinAVR version used, the other is specific to Vista 64-bits.
Cygwin heap problem
The first is the "Couldn't reserve space for cygwin's heap," error, such as:
C:\WinAVR\utils\bin\sh.exe: *** Couldn't reserve space for cygwin's heap, Win32 error 0
This error shows every up now and then depending on a lot of factors. This error occurs in all tools, such as sh.exe, make.exe, avr-gcc.exe and others. There is no real solution for this problem, since it is inherent to the way cygwin works and cannot be completely eliminated. The only thing you can do is reduce the chance this error occurs. Something that often helps is changing the base address of msys-1.0.dll in the utils\bin directory of WinAVR. You can do this with the rebase utility from Microsoft (0x30000000 is a good base) but if you don't know what all this stuff means you can download a modified msys-1.0.dll from this page.
Note: The latest release of WinAVR (20071221) already contains a rebased version of this msys DLL so this modified version has no additional advantage.
sync_with_child problem
This bug only seems to show up on Vista 64-bits and is caused by a bug in the CreateProcess API function used by MSYS/MingW (platform for some of the utilities in WinAVR). Symptoms are errors similar to:
37434 [main] sh 4208 sync_with_child: *** child state waiting for longjmp
A workaround for this bug is known and is also explained in this bug report for MingW but since WinAVR uses a much older version (and the bugfix is probably not included in the main release yet anyway) the bug is still present in WinAVR 20071221. I have made a modified msys-1.0.dll that fixes this bug and should allow you to use WinAVR on Vista 64-bits.
What do I do?
- Download the latest WinAVR. At the moment of writing this is 20071221.
- If you use AVR Studio together win WinAVR, make sure you are using the latest AVR Studio. Older versions may not be compatible with later WinAVR versions!
- Install WinAVR and if needed, AVR Studio. Be sure to run the installers as administrator if you have User Access Control (UAC) on.
- Do not install WinAVR in a directory with spaces or other special characters in its name.
Try out WinAVR and see if it causes any problems. If you see the spawnvp error you are not running the latest version. The cygwin heap problem only has a very small chance of showing up with the latest version. Check if your PATH variable does not still point to an earlier installation if you experience any of these problems.
If the cygwin heap problem shows up and you have the latest WinAVR there is probably not much you can do. For earlier versions of WinAVR (20070525 and earlier) you can try the rebased msys DLL. Download msys-rebased.zip and overwrite the existing msys-1.0.dll in the utils\bin subdirectory of your WinAVR directory. Note: from version 20071221 this rebased DLL does not change anything as it is the same as the one supplied with WinAVR.
If you are using Vista 64-bits, you will probably have the sync_with_child or similar errors. In that case download msys-1.0-vista64.zip with a modified msys-1.0.dll. This also includes the rebase fix already, which was already present in the latest version of WinAVR. This patch also works with 20070525 but it is strongly recommended you use the latest version.
Older version
If for some specific reason you absolutely have to use WinAVR 20071221, you can download a patched avr-gcc.exe: avrgcc122.zip. Only use this patch if you are stuck with this specific version, otherwise use the instructions above.
Links
For more technical details please follow the following links:
- AVR freaks topic: AVR GCC dont run on VISTA
- GCC Bugzilla Bug 30972]GCC Bugzilla Bug 30972
- [ 1646333 ] Windows Vista Error (WinAVR bug report)
- [ 1674783 ] Problem with Vista 64 bit (MingW bug report)
Credits
Thanks to Harald Thois for testing the fix on Vista 64-bit.
Contact
If you still have problems after applying this patch, you can contact me. My e-mail address can be found on my contact page. But before you do, please make sure you followed the instructions on this page correctly!