From 17c241dc532c945d7d53498515f20bd042a2f688 Mon Sep 17 00:00:00 2001 From: "David (Pololu)" Date: Fri, 2 Oct 2015 13:16:50 -0700 Subject: [PATCH] Updated the README, Atmel Studio extension, and NSIS installer to support Atmel Studio 7. The NSIS installer seems to work, but the extension is not working and there is something wrong with the included .cproj examples that causes Atmel Studio to not tell the compiler what chip to compile for. --- README.txt | 39 ++---- atmel_studio/extension.vsixmanifest.template | 4 +- atmel_studio/generate_extension.sh | 4 +- atmel_studio/generate_stk500_xml.sh | 9 +- atmel_studio/generate_templates.sh | 4 +- installer.nsi.template | 137 +++++++++---------- 6 files changed, 85 insertions(+), 112 deletions(-) diff --git a/README.txt b/README.txt index e7fc1f9..31d25b4 100644 --- a/README.txt +++ b/README.txt @@ -39,7 +39,7 @@ Additionally, this library supports: == Installation instructions == Detailed installation instructions for Windows, Linux, and Mac OS X -and tutorials for using Atmel Studio 6 can be found in the Pololu AVR +and tutorials for using Atmel Studio can be found in the Pololu AVR Programming Quick Start Guide: http://www.pololu.com/docs/0J51 @@ -106,7 +106,8 @@ for Windows or the Pololu AVR Development Bundle which includes it. Otherwise, you should determine the location of your avr-gcc files. This will typically be one of: -* C:\Program Files (x86)\Atmel\Atmel Toolchain\AVR8 GCC\Native\3.4.1051\avr8-gnu-toolchain\avr +* C:\Program Files (x86)\Atmel\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr +* C:\Program Files (x86)\Atmel\Atmel Toolchain\AVR8 GCC\Native\3.4.1061\avr8-gnu-toolchain\avr * C:\Program Files (x86)\Atmel\Atmel Studio 6.0\extensions\Atmel\AVRGCC\3.4.0.65\AVRToolchain\avr * C:\Program Files (x86)\Atmel\AVR Studio 5.1\extensions\Atmel\AVRGCC\3.3.1.27\AVRToolchain\avr * C:\Program Files (x86)\Atmel\AVR Studio 5.0\AVR Toolchain\avr @@ -117,15 +118,15 @@ This will typically be one of: In this folder you will find an "include" folder that has AVR header files such as avr/io.h and a "lib" folder that has AVR libraries such -as lib/libc.a. +as libc.a. In the library's top-level folder, type "make show_prefix". The Makefile will tell you where it thinks your avr-gcc files are. If the folder names displayed are correct, then you can run "make install" to install the library files. You will need to run this command with the correct permissions, so "sudo make install" will usually be required -in Linux, and in Windows Vista/7 you will have to right-click on -install.bat and select "Run as administrator". +in Linux, and in Windows you will have to right-click on install.bat +and select "Run as administrator". If "make show_prefix" does not show the correct folders, or the steps above don't work for you for any other reason, then you can install @@ -147,14 +148,13 @@ Finally, copy the entire "pololu" subfolder into your avr-gcc You are now ready to use the Pololu AVR library. -== Manually installing special files for Atmel Studio 6 == +== Manually installing special files for Atmel Studio 7 == -If you are using Atmel Studio 6 in Windows, then you might want to -install our Atmel Studio 6 templates so you can easily make new -projects for Pololu boards, and you might want to install the STK500 -XML files needed to program these boards from Atmel Studio 6. These -files are normally installed by the Pololu AVR Library Installer for -Windows, but you can do it manually if you need to. +If you are using Atmel Studio 7 in Windows, then you might want to +install our Atmel Studio 7 templates so you can easily make new +projects for Pololu boards. These files are normally installed by the +Pololu AVR Library Installer for Windows, but you can do it manually +if you need to. You will need to have a binary distribution instead of a copy of the source repository. @@ -164,20 +164,7 @@ To install the templates, simply double click on atmel_studio\extension.vsix and follow the instructions to install the extension into Atmel -Studio 6. - -Next, copy the files in the - - atmel_studio\stk500_xml - -folder to the - - tools\STK500\xml - -folder in your Atmel Studio 6 installation. The next time you start -Atmel Studio 6, you should see ATmega328P, ATmega1284P, and ATmega644P -in the "Device" dropdown box of the "Device Programming" dialog box when -an STK500 is selected. +Studio 7. == Using the Pololu AVR Library == diff --git a/atmel_studio/extension.vsixmanifest.template b/atmel_studio/extension.vsixmanifest.template index bd82bd2..e467baa 100644 --- a/atmel_studio/extension.vsixmanifest.template +++ b/atmel_studio/extension.vsixmanifest.template @@ -4,7 +4,7 @@ Pololu AVR Library Templates Pololu Corporation 1.YYMMDD - An extension for AVR Studio 5 and Atmel Studio 6 that provides project templates for using the Pololu AVR C/C++ Library. + An extension for Atmel Studio 6 and 7 that provides project templates for using the Pololu AVR C/C++ Library. 1033 http://www.pololu.com/docs/0J20 http://www.pololu.com/docs/0J20 @@ -12,10 +12,10 @@ icon.png preview.png - AVRStudio AtmelStudio AtmelStudio AtmelStudio + AtmelStudio false diff --git a/atmel_studio/generate_extension.sh b/atmel_studio/generate_extension.sh index 68918b1..11fd112 100755 --- a/atmel_studio/generate_extension.sh +++ b/atmel_studio/generate_extension.sh @@ -1,7 +1,7 @@ #!/bin/sh -# This script generates the AVR Studio 5 extension file, extension.vsix. -# The extension can then be installed to AVR Studio 5 by double-clicking on it +# This script generates the Atmel Studio extension file, extension.vsix. +# The extension can then be installed to Atmel Studio by double-clicking on it # in Windows or by running vsixinstaller.exe, as we do in the library installer. # Prerequisites: Execute generate_templates.sh. diff --git a/atmel_studio/generate_stk500_xml.sh b/atmel_studio/generate_stk500_xml.sh index f4ca5ee..4d3cbfd 100755 --- a/atmel_studio/generate_stk500_xml.sh +++ b/atmel_studio/generate_stk500_xml.sh @@ -1,11 +1,12 @@ #!/bin/sh -# Generates the XML files that we need to add to AVR Studio to make +# Generates the XML files that we need to add to Atmel Studio 6 to make # it support programming some of the AVRs we use on our Orangutans. # If these XML files are installed in -# C:\Program Files (x86)\Atmel\AVR Studio 5.0\tools\stk500\xml +# C:\Program Files (x86)\Atmel\AVR Studio 6.2\tools\stk500\xml # then new entries will appear in the Device dropdown box in the -# AVR Programming dialog. +# Device Programming dialog. +# These files are not needed in Atmel Studio 7. set -ue @@ -27,4 +28,4 @@ do EOF -done \ No newline at end of file +done diff --git a/atmel_studio/generate_templates.sh b/atmel_studio/generate_templates.sh index 3f499b2..b3af716 100755 --- a/atmel_studio/generate_templates.sh +++ b/atmel_studio/generate_templates.sh @@ -1,8 +1,6 @@ #!/bin/sh -# Generates the zip files for our AVR Studio 5 templates. -# These templates support AVR Studio 5.1 but not 5.0 -# because the file extensions for projects and solutions changed. +# Generates the zip files for our Atmel Studio templates. set -ue diff --git a/installer.nsi.template b/installer.nsi.template index e4a1cb9..cde9e51 100644 --- a/installer.nsi.template +++ b/installer.nsi.template @@ -31,40 +31,42 @@ Page directory "" "" checkDirectory Page custom optionsPage optionsPageLeave Page instfiles -Var /GLOBAL VSShellPath +Var VS10ShellPath +Var VS14ShellPath Var Dialog DirText "Setup will install the Pololu AVR C/C++ Library (version ${LIB_VER}) in the following folder. To install in a different folder, click Browse and select another folder. Click Next to continue." # Toolchain variables Var WinAVRPath -Var AS51Path Var AS60Path Var AS61Path Var AS61PathAvr Var AS62Path Var AS62PathAvr +Var AS70Path Var WinAVRBox -Var AS51Box Var AS60Box Var AS61Box Var AS62Box +Var AS70Box Var WinAVRIntegrate -Var AS51Integrate Var AS60Integrate Var AS61Integrate Var AS62Integrate +Var AS70Integrate # When the installer starts, detect the different things we need to detect. Function .onInit Call WinAVRCheck - Call AS51Check Call AS60Check Call AS61Check Call AS62Check - Call VSShellCheck + Call AS70Check + Call VS10ShellCheck + Call VS14ShellCheck # Check the assumptions we make when calling NSD_GetState and NSD_SetState. ${If} ${BST_CHECKED} != 1 @@ -76,10 +78,10 @@ Function .onInit # By default, any checkbox that is available will be checked. StrCpy $WinAVRIntegrate "1" - StrCpy $AS51Integrate "1" StrCpy $AS60Integrate "1" StrCpy $AS61Integrate "1" StrCpy $AS62Integrate "1" + StrCpy $AS70Integrate "1" FunctionEnd !macro CreateToolchainCheckBox Name Path Checked Box Y @@ -113,10 +115,10 @@ Function optionsPage Pop $0 !insertmacro CreateToolchainCheckBox "WinAVR" $WinAVRPath $WinAVRIntegrate $WinAVRBox 20u - !insertmacro CreateToolchainCheckBox "AVR Studio 5.1" $AS51Path $AS51Integrate $AS51Box 40u - !insertmacro CreateToolchainCheckBox "Atmel Studio 6.0" $AS60Path $AS60Integrate $AS60Box 60u - !insertmacro CreateToolchainCheckBox "Atmel Studio 6.1" $AS61Path $AS61Integrate $AS61Box 80u - !insertmacro CreateToolchainCheckBox "Atmel Studio 6.2" $AS62Path $AS62Integrate $AS62Box 100u + !insertmacro CreateToolchainCheckBox "Atmel Studio 6.0" $AS60Path $AS60Integrate $AS60Box 40u + !insertmacro CreateToolchainCheckBox "Atmel Studio 6.1" $AS61Path $AS61Integrate $AS61Box 60u + !insertmacro CreateToolchainCheckBox "Atmel Studio 6.2" $AS62Path $AS62Integrate $AS62Box 80u + !insertmacro CreateToolchainCheckBox "Atmel Studio 7.0" $AS70Path $AS70Integrate $AS70Box 100u nsDialogs::Show FunctionEnd @@ -125,17 +127,16 @@ FunctionEnd # Stores the user's choices from the check boxes. Function optionsPageLeave ${NSD_GetState} $WinAVRBox $WinAVRIntegrate - ${NSD_GetState} $AS51Box $AS51Integrate ${NSD_GetState} $AS60Box $AS60Integrate ${NSD_GetState} $AS61Box $AS61Integrate ${NSD_GetState} $AS62Box $AS62Integrate + ${NSD_GetState} $AS70Box $AS70Integrate FunctionEnd # Install the header (.h) and archive (.a) files that allow # compilation of programs that use the library. -# We check the existence of the directories here because the toolchain location for -# AVR Studio 5.1 looks like it will change often and we'd like to give useful error -# messages. +# We check the existence of the directories here because the toolchain location +# might change and we'd like to give useful error messages. !macro InstallIntoToolChain AvrPath ${if} ${FileExists} "${AvrPath}\lib" SetOutPath "${AvrPath}\lib" @@ -173,15 +174,6 @@ Section !insertmacro InstallIntoToolChain "$WinAVRPath\avr" end_winavr: - StrCmp $AS51Path "" end_as51 - IntCmp $AS51Integrate 0 end_as51 - DetailPrint "Installing library into AVR Studio 5.1..." - ; NOTE: For the AVR Studio 5.1 beta, this path didn't have the ".27" in it. - !insertmacro InstallIntoToolChain "$AS51Path\extensions\Atmel\AVRGCC\3.3.1.27\AVRToolChain\avr" - !insertmacro InstallSTK500Xml "$AS51Path\tools\STK500\xml" - ExecWait "$\"$VSShellPath\Common7\IDE\vsixinstaller.exe$\" /skuName:AvrStudio /skuVersion:5.1 /quiet $\"$INSTDIR\atmel_studio\extension.vsix$\"" - end_as51: - StrCmp $AS60Path "" end_as60 IntCmp $AS60Integrate 0 end_as60 DetailPrint "Installing library into Atmel Studio 6.0..." @@ -196,7 +188,7 @@ Section MessageBox MB_OK|MB_ICONEXCLAMATION "The Pololu AVR C/C++ Library installer was unable to find the avr folder for Atmel Studio 6.0's AVR toolchain. You might have to find your AVR toolchain's avr folder (probably inside $AS60Path\extensions\Atmel\AVRGCC\ ) and then manually copy the $INSTDIR\libpololu_*.a files to avr\lib and copy the $INSTDIR\pololu folder to avr\include. Please report this problem at http://forum.pololu.com/." ${endif} !insertmacro InstallSTK500Xml "$AS60Path\tools\STK500\xml" - ExecWait "$\"$VSShellPath\Common7\IDE\vsixinstaller.exe$\" /skuName:AtmelStudio /skuVersion:6.0 /quiet $\"$INSTDIR\atmel_studio\extension.vsix$\"" + ExecWait "$\"$VS10ShellPath\Common7\IDE\vsixinstaller.exe$\" /skuName:AtmelStudio /skuVersion:6.0 /quiet $\"$INSTDIR\atmel_studio\extension.vsix$\"" end_as60: StrCmp $AS61Path "" end_as61 @@ -209,7 +201,7 @@ Section MessageBox MB_OK|MB_ICONEXCLAMATION "The Pololu AVR C/C++ Library installer was unable to find the avr folder for Atmel Studio 6.1's 8-bit GNU toolchain. You might have to find your AVR toolchain's avr folder (probably near $AS61Path ) and then manually copy the $INSTDIR\libpololu_*.a files to avr\lib and copy the $INSTDIR\pololu folder to avr\include. Please report this problem at http://forum.pololu.com/." ${endif} !insertmacro InstallSTK500Xml "$AS61Path\tools\STK500\xml" - ExecWait "$\"$VSShellPath\Common7\IDE\vsixinstaller.exe$\" /skuName:AtmelStudio /skuVersion:6.1 /quiet $\"$INSTDIR\atmel_studio\extension.vsix$\"" + ExecWait "$\"$VS10ShellPath\Common7\IDE\vsixinstaller.exe$\" /skuName:AtmelStudio /skuVersion:6.1 /quiet $\"$INSTDIR\atmel_studio\extension.vsix$\"" end_as61: StrCmp $AS62Path "" end_as62 @@ -222,9 +214,21 @@ Section MessageBox MB_OK|MB_ICONEXCLAMATION "The Pololu AVR C/C++ Library installer was unable to find the avr folder for Atmel Studio 6.2's 8-bit GNU toolchain. You might have to find your AVR toolchain's avr folder (probably near $AS62Path ) and then manually copy the $INSTDIR\libpololu_*.a files to avr\lib and copy the $INSTDIR\pololu folder to avr\include. Please report this problem at http://forum.pololu.com/." ${endif} !insertmacro InstallSTK500Xml "$AS62Path\tools\STK500\xml" - ExecWait "$\"$VSShellPath\Common7\IDE\vsixinstaller.exe$\" /skuName:AtmelStudio /skuVersion:6.2 /quiet $\"$INSTDIR\atmel_studio\extension.vsix$\"" + ExecWait "$\"$VS10ShellPath\Common7\IDE\vsixinstaller.exe$\" /skuName:AtmelStudio /skuVersion:6.2 /quiet $\"$INSTDIR\atmel_studio\extension.vsix$\"" end_as62: + StrCmp $AS70Path "" end_as70 + IntCmp $AS70Integrate 0 end_as70 + DetailPrint "Installing library into Atmel Studio 7.0..." + ${if} ${FileExists} "$AS70Path\toolchain\avr8\avr8-gnu-toolchain\avr" + !insertmacro InstallIntoToolChain "$AS70Path\toolchain\avr8\avr8-gnu-toolchain\avr" + ${else} + DetailPrint "Unable to find Atmel Studio 7.0 toolchain. Looked in $AS70Path\toolchain\avr8\avr8-gnu-toolchain\avr" + MessageBox MB_OK|MB_ICONEXCLAMATION "The Pololu AVR C/C++ Library installer was unable to find the avr folder for Atmel Studio 7.0's 8-bit GNU toolchain. You might have to find your AVR toolchain's avr folder (probably near $AS70Path ) and then manually copy the $INSTDIR\libpololu_*.a files to avr\lib and copy the $INSTDIR\pololu folder to avr\include. Please report this problem at http://forum.pololu.com/." + ${endif} + ExecWait "$\"$VS14ShellPath\Common7\IDE\vsixinstaller.exe$\" /skuName:AtmelStudio /skuVersion:7.0 /quiet $\"$INSTDIR\atmel_studio\extension.vsix$\"" + end_as70: + SectionEnd # Checks to see if WinAVR is installed. @@ -234,37 +238,6 @@ Function WinAVRCheck ${GetParent} $0 $WinAVRPath FunctionEnd -# The location of AVR Studio 5.1 is stored in several places: -# HKLM "SOFTWARE\Microsoft\AppEnv\10.0\Apps\AVRStudio_5.1" 'StubExePath' (requires GetParent, seems to get deleted when AVR Studio 5.0 is uninstalled) -# HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{D574D18C-9D52-4B4B-9647-AE6B89FD3F70}" 'InstallLocation' -# HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\avrstudio.exe" (Default) (requires GetParent) -# HKCU "SOFTWARE\Atmel\AVRStudio51\5.1_Config" 'InstallDir' -# -# We would like to look in HKLM (HKEY_LOCAL_MACHINE) instead of HKCU (HKEY_CURRENT_USER) because -# it doesn't really make sense to look at user settings to find where an application installed. -# We would also like to use a registry key that appears to be used consistently between the -# different versions of AVR Studio 5 so it is easy to update our installers. -# We would also like one that is predictable (e.g. doesn't have a GUID in it). -# The only one that satisfies all of those criteria is the AppEnv one, so we will use that. -# BUT David noticed that it disappear from his computer after uninstalling AVR Studio 5.0, so -# we will use the Uninstall key as a fallback. -# Checks to see if AVR Studio 5 is installed. -# Sets $AS51Path to the location or "" if not found. -Function AS51Check - ReadRegStr $0 HKLM "SOFTWARE\Microsoft\AppEnv\10.0\Apps\AVRStudio_5.1" 'StubExePath' - ${GetParent} $0 $AS51Path - StrCmp $AS51Path "" 0 AS51Done # If we found it, then we are done. - - ReadRegStr $AS51Path HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{D574D18C-9D52-4B4B-9647-AE6B89FD3F70}" 'InstallLocation' - StrCmp $AS51Path "" AS51Done # If AVR Studio 5.1 really isn't there, we are done. - - # This case seems to happen if you uninstall AVR Studio 5.0 after installing AVR Studio 5.1. - # Another bad thing that happens is that the Visual Assist X for AVR Studio extension goes away. - MessageBox MB_OK "Your AVR Studio 5.1 installation appears to be corrupted. You can still install the Pololu AVR C/C++ library into AVR Studio 5.1 but the installation of the project templates will probably not work. You should be able to fix this problem by reinstalling or repairing AVR Studio 5.1 and then running this installer again." - - AS51Done: -FunctionEnd - Function AS60Check ReadRegStr $0 HKLM "SOFTWARE\Microsoft\AppEnv\10.0\Apps\AtmelStudio_6.0" 'StubExePath' ${GetParent} $0 $AS60Path @@ -317,25 +290,39 @@ Function AS62Check AS62Done: FunctionEnd -# We need to find the location of the Visual Studio 2010 isolated shell so we can install our extension -# using vsixinstaller.exe. We check several places in the registry and take the first one. -# The registry keys suggested by Microsoft are better: +# The location of Atmel Studio 7.0 is stored in several places: +# HKLM "SOFTWARE\Microsoft\AppEnv\14.0\Apps\AtmelStudio_7.0" 'StubExePath' (requires GetParent) +# HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\atmelstudio.exe" (requires GetParent) +# HKCU "SOFTWARE\Atmel\AtmelStudio\7.0_Config" 'InstallDir' +Function AS70Check + ReadRegStr $0 HKLM "SOFTWARE\Microsoft\AppEnv\14.0\Apps\AtmelStudio_7.0" 'StubExePath' + ${GetParent} $0 $AS70Path +FunctionEnd + +# We need to find the location of the Visual Studio 2010 (10.0) isolated +# shell (used by Atmel Studio 6.x) so we can install our extension using vsixinstaller.exe. +# Some other possibilities we aren't usin are documented here: # http://osherove.com/blog/2010/4/9/finding-the-location-of-vsixinstallerexe-programmatically.html -# This one might be even better because it doesn't contain the language but we are not using it yet: -# HKLM "SOFTWARE\Microsoft\VisualStudio\10.0\" 'InstallDir' # http://msdn.microsoft.com/en-us/library/bb932484.aspx -Function VSShellCheck - ReadRegStr $VSShellPath HKLM "Software\Microsoft\VisualStudio\10.0\Setup\IsoShell\1033" 'ProductDir' - StrCmp $VSShellPath "" 0 VSShellCheckDone - ReadRegStr $VSShellPath HKCU "SOFTWARE\Atmel\AvrStudio\5.0_Config" 'ShellFolder' - StrCmp $VSShellPath "" 0 VSShellCheckDone - ReadRegStr $VSShellPath HKCU "Software\Atmel\AVRStudio51\5.1_Config" 'ShellFolder' - StrCmp $VSShellPath "" 0 VSShellCheckDone - ReadRegStr $VSShellPath HKCU "Software\Atmel\AtmelStudio\6.0_Config" 'ShellFolder' - StrCmp $VSShellPath "" 0 VSShellCheckDone - ReadRegStr $VSShellPath HKCU "Software\Atmel\AtmelStudio\6.1_Config" 'ShellFolder' - # Note: Software\Atmel\AtmelStudio\6.2_Config does not exist - VSShellCheckDone: +Function VS10ShellCheck + ReadRegStr $VS10ShellPath HKLM "Software\Microsoft\VisualStudio\10.0\Setup\IsoShell\1033" 'ProductDir' + StrCmp $VS10ShellPath "" 0 VS10ShellCheckDone + ReadRegStr $VS10ShellPath HKCU "Software\Atmel\AtmelStudio\6.0_Config" 'ShellFolder' + StrCmp $VS10ShellPath "" 0 VS10ShellCheckDone + ReadRegStr $VS10ShellPath HKCU "Software\Atmel\AtmelStudio\6.1_Config" 'ShellFolder' + StrCmp $VS10ShellPath "" 0 VS10ShellCheckDone + ReadRegStr $VS10ShellPath HKCU "Software\Atmel\AtmelStudio\6.2_Config" 'ShellFolder' + VS10ShellCheckDone: +FunctionEnd + +# We need to find the location of the Visual Studio 2015 (14.0) +# isolated shell (used by Atmel Studio 6.x) so we can install our +# extension using vsixinstaller.exe. +Function VS14ShellCheck + ReadRegStr $VS14ShellPath HKLM "Software\Microsoft\AppEnv\14.0" 'ShellFolder' + StrCmp $VS14ShellPath "" 0 VS14ShellCheckDone + ReadRegStr $VS14ShellPath HKCU "Software\Atmel\AtmelStudio\7.0_Config" 'ShellFolder' + VS14ShellCheckDone: FunctionEnd Function checkDirectory