The following Altera_Tool_Switch.bat also includes an option for version 7.1. Note that this is an example, and paths for versions 6.1 and 7.0 are different from the default installation path. 7.1 and 5.0 follow the same conventions for Nios II, but version 5.0 requires additionally setting the QUARTUS_ROOTDIR, and QESS_ROOTDIR environment variables. One difference for versions 5.1 through 6.1 are that we added, then subsequently removed, an environment variable called SOPC_BUILDER_PATH_XX with the version number (XX) appended, such as SOPC_BUILDER_PATH_60. You can add an option for version 5.0 by defining SOPC_BUILDER_PATH, SOPC_KIT_NIOS2, QUARTUS_ROOTDIR, and QESS_ROOTDIR appropriately to match your installation. The last 2 should be set to the same directory, the Quartus installation directory. I think it was version 6.1 when we modified Quartus to automatically update these last 2 environment variables simply by launching the correct version of Quartus (which is what the script does now). Although I have not tried this script (modified for 5.0) with version 5.0 myself, I know of at least one customer who did so without difficulty.
Altera_Tool_Switch.bat (reference example, modify to match your selected install paths):
-----------------------------------------------------------------------------------------------------
@echo off
REM ========================================================================================
REM Name: Altera_Tool_Switch.bat
REM Tool: Version switching batch script
REM Date: February 21, 2007
REM Default install path settings (change to match your installation paths for each version).
REM Execute from a DOS command shell.
REM Some users have benefited from additionally moving
C:\Quartus\bin and Quartus\win to the front of the PATH env var.
set Nios_6_0=
C:\altera\kits\nios2_60 set Quartus_6_0=
C:\altera\quartus60 set IP_6_0=
C:\altera\megacore\ddr_ddr2_sdram-v3.4.1\lib\sopc_builder+C:\altera\megacore\pci_compiler-v4.1.1\lib\sopc_builder
set Nios_6_1=
C:\altera\61b201\nios2eds set Quartus_6_1=
C:\altera\61b201\quartus set IP_6_1=
C:\altera\61b201\ip\ddr_ddr2_sdram\lib\sopc_builder+C:\altera\61b201\ip\pci_compiler\lib\sopc_builder+
C:\altera\61b201\ip\nios2_ip+C:\altera\61b201\ip\sopc_builder_ip
set Nios_7_0=
C:\altera\70b30\nios2eds set Quartus_7_0=
C:\altera\70b30\quartus set IP_7_0=
C:\altera\70b30\ip\ddr_ddr2_sdram\lib\sopc_builder+C:\altera\70b30\ip\pci_compiler\lib\sopc_builder+
C:\altera\70b30\ip\nios2_ip+C:\altera\70b30\ip\sopc_builder_ip
set Nios_7_1=
C:\altera\71\nios2eds set Quartus_7_1=
C:\altera\71\quartus set IP_7_1=
C:\altera\71\ip\ddr_ddr2_sdram\lib\sopc_builder+C:\altera\71\ip\pci_compiler\lib\sopc_builder+
C:\altera\71\ip\nios2_ip+C:\altera\71\ip\sopc_builder_ip
REM ========================================================================================
REM Use the first parameter as the specified version if available.
REM This will skip menu echo below if there exists a first parameter.
set ALT_VER=%1
REM ========================================================================================
:ALT_VER_OPTIONS
if not defined ALT_VER (
echo Altera Environment Switcher
echo ***************************
echo Type the following to update your environment variables
echo Note: Before making a selection, close any open Altera tools.
echo After running this script, exit the shell from which it is launched.
echo Only new environments will inherit the new system environment settings.
echo --
echo 1. Version 6.0
echo 2. Version 6.1 build 201
echo 3. Version 7.0 build 30
echo 4. Version 7.1 released
echo 5. Do not make any changes
echo --
echo Note: Some of these versions may not exist yet, or the paths will be incorrect.
echo If you install to non-standard locations modify the paths at the
echo top of this file.
echo Specify number to select [1, 2, 3, 4, or 5]
set /p ALT_VER=%1
)
if not defined ALT_VER (
echo Valid Altera Tools Version not specified.
goto ALT_VER_OPTIONS
)
REM ========================================================================================
REM Set Nios II 6.0
REM
if %ALT_VER% == 1 (
echo Setting environment for version 6.0
setenv -m SOPC_BUILDER_PATH_60 %Nios_6_0%
setenv -m SOPC_BUILDER_PATH %SOPC_BUILDER_PATH_60%+%IP_6_0%
setenv -m SOPC_KIT_NIOS2 %Nios_6_0%
echo New Environment settings:
echo SOPC_BUILDER_PATH =
setenv -m SOPC_BUILDER_PATH
echo SOPC_KIT_NIOS2 =
setenv -m SOPC_KIT_NIOS2
echo Now Launching 6.0 Quartus to complete environment variable configuration.
echo Please exit Quartus and then exit this command shell to complete environment
echo switch. Restart Quartus II, Nios II, or any related shells before developing
echo with the changed version.
%Quartus_6_0%\bin\quartus.exe
goto END
)
REM ========================================================================================
REM Set Nios II 6.1
REM
if %ALT_VER% == 2 (
echo Setting environment for version 6.1
setenv -m SOPC_BUILDER_PATH %Nios_6_1%+%IP_6_1%
setenv -m SOPC_KIT_NIOS2 %Nios_6_1%
echo New Environment settings:
echo SOPC_BUILDER_PATH =
setenv -m SOPC_BUILDER_PATH
echo SOPC_KIT_NIOS2 =
setenv -m SOPC_KIT_NIOS2
echo Now Launching 6.1 Quartus to complete environment variable configuration.
echo Please exit Quartus and then exit this command shell to complete environment
echo switch. Restart Quartus II, Nios II, or any related shells before developing
echo with the changed version.
%Quartus_6_1%\bin\quartus.exe
goto END
)
REM ========================================================================================
REM Set Nios II 7.0
REM
if %ALT_VER% == 3 (
echo Setting environment for version 7.0
setenv -m SOPC_BUILDER_PATH %Nios_7_0%+%IP_7_0%
setenv -m SOPC_KIT_NIOS2 %Nios_7_0%
echo New Environment settings:
echo SOPC_BUILDER_PATH =
setenv -m SOPC_BUILDER_PATH
echo SOPC_KIT_NIOS2 =
setenv -m SOPC_KIT_NIOS2
echo Now Launching 7.0 Quartus to complete environment variable configuration.
echo Please exit Quartus and then exit this command shell to complete environment
echo switch. Restart Quartus II, Nios II, or any related shells before developing
echo with the changed version.
%Quartus_7_0%\bin\quartus.exe
goto END
)
REM ========================================================================================
REM Set Nios II 7.1
REM
if %ALT_VER% == 4 (
echo Setting environment for version 7.1
setenv -m SOPC_BUILDER_PATH %Nios_7_1%+%IP_7_1%
setenv -m SOPC_KIT_NIOS2 %Nios_7_1%
echo New Environment settings:
echo SOPC_BUILDER_PATH =
setenv -m SOPC_BUILDER_PATH
echo SOPC_KIT_NIOS2 =
setenv -m SOPC_KIT_NIOS2
echo Now Launching 7.1 Quartus to complete environment variable configuration.
echo Please exit Quartus and then exit this command shell to complete environment
echo switch. Restart Quartus II, Nios II, or any related shells before developing
echo with the changed version.
%Quartus_7_1%\bin\quartus.exe
goto END
)
REM ========================================================================================
REM Do not make any changes
REM
if %ALT_VER% == 5 (
echo Exiting script with no changes.
goto END
)
REM ========================================================================================
REM ALT_VER is not recognized
set ALT_VER=
echo Valid Altera Tools Version not specified.
goto ALT_VER_OPTIONS
REM ========================================================================================
:END