16
Dec 1, 2011 Version 1.38 1 ECRobotInstaller: Automated download and install for ECRobot ECRobot is the Embedded Coder Robot, a Simulink-based modeling and code-generation enviroment for the LEGO Mindstorms NXT. Generating code using ECRobot requires several third-party products: 1. Cygwin – A Unix-like environment on Windows. (Required for GNU ARM compiler) 2. GNU ARM Compiler – Compiles C code for the ARM processor in the LEGO NXT 3. LEGO Mindstorms NXT Driver – Driver for communicating with the LEGO NXT over a USB cable (used by NeXTTool). 4. NeXTTool – Command-line utility for transferring files from the PC to the LEGO NXT 5. NXT Enhanced standard firmware – A replacement firmware for the LEGO NXT that allows it to execute ARM binaries in addition to standard NXT programs. 6. ECRobot – The "Embedded Coder Robot" files from the MATLAB Central FileExchange 7. nxtOSEK – A real-time operating system for the LEGO Mindstorms NXT ECRobotInstaller automates the download and install of ECRobot and all the associated products. It works with ECRobot ver 3.18 Platform Requirements: 32-bit or 64-bit Windows XP, Vista or Windows 7 32-bit MATLAB Release R2007a or later Note: you can install 32-bit MATLAB on a 64-bit system. If you have questions or comments, please email [email protected]

ECRobotInstaller: Automated download and install for ECRobot

Embed Size (px)

Citation preview

Page 1: ECRobotInstaller: Automated download and install for ECRobot

Dec 1, 2011 Version 1.38

1

ECRobotInstaller: Automated download and install for ECRobot ECRobot is the Embedded Coder Robot, a Simulink-based modeling and code-generation enviroment for the LEGO Mindstorms NXT. Generating code using ECRobot requires several third-party products:

1. Cygwin – A Unix-like environment on Windows. (Required for GNU ARM compiler) 2. GNU ARM Compiler – Compiles C code for the ARM processor in the LEGO NXT 3. LEGO Mindstorms NXT Driver – Driver for communicating with the LEGO NXT over a USB cable

(used by NeXTTool). 4. NeXTTool – Command-line utility for transferring files from the PC to the LEGO NXT 5. NXT Enhanced standard firmware – A replacement firmware for the LEGO NXT that allows it to

execute ARM binaries in addition to standard NXT programs. 6. ECRobot – The "Embedded Coder Robot" files from the MATLAB Central FileExchange 7. nxtOSEK – A real-time operating system for the LEGO Mindstorms NXT

ECRobotInstaller automates the download and install of ECRobot and all the associated products. It works with ECRobot ver 3.18 Platform Requirements:

32-bit or 64-bit Windows XP, Vista or Windows 7 32-bit MATLAB Release R2007a or later Note: you can install 32-bit MATLAB on a 64-bit system.

If you have questions or comments, please email [email protected]

Page 2: ECRobotInstaller: Automated download and install for ECRobot

Dec 1, 2011 Version 1.38

2

Contents Download and Installation Steps.............................................................................................................. 3

Step 1: Automated Download .............................................................................................................. 3

Step 2: Automated Install .................................................................................................................... 3

Step 3: Restart your Windows computer ............................................................................................. 4

Step 4: Download the enhanced firmware to the LEGO NXT ................................................................ 4

Step 5: Verify that everything works .................................................................................................... 5

Common questions ................................................................................................................................. 6

Where are the download and installation directories? ......................................................................... 6

Download_ecrobot_tools is not working ............................................................................................. 7

Cygwin is not downloading/installing properly ..................................................................................... 8

GNU ARM Compiler / LEGO Mindstorms NXT Driver is not installing properly ...................................... 9

I get a “Problem with automatic configuration of ECRobot” ............................................................... 10

I get a code generation error while building TestMotorOSEK ............................................................. 11

I get a compilation error while building TestMotorOSEK .................................................................... 12

How can I check that everything got installed properly? .................................................................... 13

How can I create an installation CD? .................................................................................................. 14

How do I uninstall the components for ECRobot? .............................................................................. 15

Page 3: ECRobotInstaller: Automated download and install for ECRobot

Dec 1, 2011 Version 1.38

3

Download and Installation Steps

Step 1: Automated Download 1. In MATLAB, go to the directory containing the ECRobotInstaller files 2. Type: download_ecrobot_tools

This step may take 10-15 minutes, depending on the speed of your Internet connection. It is safe to run download_ecrobot_tools multiple times (it checks to see if a file has already been downloaded). If there is a problem accessing any of the URLs, please send me an email.

Note: The Cygwin download pops up dialog boxes with various configuration options. All the options have been pre-configured, so click "Next" or "Finish" in all the dialogs.

Step 2: Automated Install Once all the required files have been downloaded, then:

1. In MATLAB, go to the directory containing the ECRobotInstaller files 2. Type: install_ecrobot_tools

This installs all the products. Several of the products display license screens and allow you to configure various options. All the options have been pre-configured, so once you review and agree to the license, click "Next" or "Finish" in all the installation dialogs.

In case there is a problem, it is safe to run install_ecrobot_tools multiple times (at worst, it causes some unecessary copying or unzipping of files). For diagnostic purposes, the install information is logged to C:\TEMP\ECRobot_tools_install_log.txt

Note:

If ATMEL SAMBA (a tool for communicating with the LEGO NXT) was previously installed on your system, it needs to be uninstalled before running install_ecrobot_tools

If the LEGO Mindstorms NXT Driver is already installed, the final screen will say "No software will be installed or removed" (see below); click Cancel so safely exit the installation program.

Page 4: ECRobotInstaller: Automated download and install for ECRobot

Dec 1, 2011 Version 1.38

4

Step 3: Restart your Windows computer

Step 4: Download the enhanced firmware to the LEGO NXT The final step is download the enhanced firmware to the LEGO NXT.

1. In MATLAB, go to the directory containing the ECRobotInstaller files 2. Type: update_nxt_firmware

This will bring up a GUI (see below) that will walk you through the firmware update process.

Page 5: ECRobotInstaller: Automated download and install for ECRobot

Dec 1, 2011 Version 1.38

5

Step 5: Verify that everything works 1. Go to the "samples" directory for ECRobot, as follows:

In MATLAB, go the directory containing the ECRobotInstaller files Type: ecrobot_samples

2. Open TestMotorOSEK.mdl by double-clicking on the file in the Current Directory browser 3. Click on the button that says " nxtconfig(gcs) " 4. Click on the button that says " nxtbuild('Testmotor_app', 'build') "

This should generate the C code and also invoke the GNU ARM compiler. The end result should be an ".rxe" file (TestMotor_app.rxe). This is the binary image that be directly downloaded to the LEGO NXT.

The first time you do this, it will take a while to complete (10-20 seconds). The figure on the next page shows what a successful run looks like.

5. Click on the button that says " nxtbuild('Testmotor_app', 'rxeflash') " This should additionally download the RXE file to the LEGO NXT (assuming it is

connected to the PC via the USB cable).

A screen capture showing a successful build of an ECRobot model (TestMotorOSEK.mdl)

Page 6: ECRobotInstaller: Automated download and install for ECRobot

Dec 1, 2011 Version 1.38

6

Common questions

Where are the download and installation directories? All the programs mentioned above (download_ecrobot_tools, install_ecrobot_tools, etc. ) consult ecrobot_install_config.m. Typing the name of the file by itself will print out the list of installation directories:

>> ecrobot_install_config ------------- Archive directory for installation files: C:\Local\ECRobotDownloads\ ------------- Installation directories Cygwin : c:\cygwin\ GNU ARM Compiler : c:\LegoMindstorms\GNU_ARM_Compiler\ LEGO USB Driver : c:\LegoMindstorms\LEGO_USB_Driver\ NXT Firmware : c:\LegoMindstorms\NXT_Tools\ NXT Tools : c:\LegoMindstorms\NXT_Tools\ ECRobot : c:\LegoMindstorms\ECRobot\ NXT OSEK : c:\LegoMindstorms\ECRobot\\ecrobotNXT\environment\ -------------

The file contains three key sections:

Where to save the downloaded files: config.ArchiveDir = '%DEFAULT%\ECRobotDownloads\';

Where to install the programs:

config.Cygwin_InstallationDirectory = 'c:\cygwin\'; config.GnuTools_InstallationDirectory = 'c:\LegoMindstorms\GNU_ARM_Compiler\'; config.LEGOUSBDriver_InstallationDirectory = 'c:\LegoMindstorms\LEGO_USB_Driver\'; ...

Where the download the various programs from:

config.Cygwin_URL = 'http://www.gtlib.gatech.edu/pub/cygwin'; ...

By default, the archive directory (where the downloaded files are saved) is in the same directory that contains ecrobot_install_config.m. You can change it to any other directory that you want. E.g.

config.ArchiveDir = 'C:\MyDownloads\LEGOMindstorms\ECRobotDownloads';

The installation directories can be changed as well. There should be no need to change the URLs; if you find that one of the URLs is not working, please send me an email ([email protected]), and I will send an updated version.

Page 7: ECRobotInstaller: Automated download and install for ECRobot

Dec 1, 2011 Version 1.38

7

Download_ecrobot_tools is not working One possibility is that your computer needs to access the Internet through a proxy server. If so, you need to configure how MATLAB accesses the web. From MATLAB, choose File -> Preferences…, and select Web from the list on the left. You should see the following screen, which you can use to configure MATLAB:

In addition, you will also need to configure Cygwin to use proxy server.

1. In ecrobot_install_config.m, locate the line that says config.Cygwin_quiet_download = true;

and change it to config.Cygwin_quiet_download = false;

2. Run download_ecrobot_tools 3. When the Cygwin dialog windows come up, you can click "Next >" on all the windows, except

for one that asks about your internet connection (see below). When you get to this dialog box, specify your proxy server information:

Page 8: ECRobotInstaller: Automated download and install for ECRobot

Dec 1, 2011 Version 1.38

8

Cygwin is not downloading/installing properly If you are having problems downloading or installing Cygwin, try the following:

If download_ecrobot_tools or install_ecrobot_tools seem to get stuck during the Cygwin phase, check whether there is a Cygwin dialog box that is open. Sometimes Cygwin puts up a warning or informational message that placed in the background (i.e., under the MATLAB window) and the Cygwin pauses until you respond. Find the dialog box and close it by clicking "OK".

Delete any existing Cygwin installations o Shut down any programs that might be using Cygwin o Delete the Cygwin installation directory (e.g., if Cygwin is currently installed in

C:\Program Files\Cygwin, delete that Cygwin directory).

Ensure that the Cywin URL is valid. Search for the following line in ecrobot_install_config.m: config.Cygwin_URL = 'http://mirror.mcs.anl.gov/cygwin/';

Check that the URL is valid and accessible from your system. If it is not, check the list of Cygwin mirrors (http://www.cygwin.com/mirrors.html), pick a suitable mirror site , and update the config.Cygwin_URL entry.

Page 9: ECRobotInstaller: Automated download and install for ECRobot

Dec 1, 2011 Version 1.38

9

GNU ARM Compiler / LEGO Mindstorms NXT Driver is not installing properly When you run install_ecrobot_tools, you may see an error message during the installation of the GNU ARM Compiler (see below). Alternatively, you may get an error during the installation of the LEGO Mindstorms NXT Driver that it cannot create C:\Windows\System32\fantom.dll.

These errors occur when you are in a Windows account that does have administrative access. The GNU ARM error is not serious – you can safely click "Ignore". The LEGO NXT Driver error is more serious, as fantom.dll is required for communicating with the LEGO over USB. One workaround is to log into an account with administrative access and install only the LEGO NXT Driver.

Page 10: ECRobotInstaller: Automated download and install for ECRobot

Dec 1, 2011 Version 1.38

10

I get a “Problem with automatic configuration of ECRobot” If you run “install_ecrobot_toools” and get an error like this:

================ 20-Nov-2011 12:19:29 Configuring ECRobot ECRobot version 3.17 or later detected ### Start verifying Embedded Coder Robot NXT installations... ### Verifying cygwin make 3.81: OK ### Verifying GNUARM 4.0.2: OK ### Verifying NeXTTool.exe: OK Problem with automatic configuration of ECRobot

Or like this:

Embedded Coder Robot NXT 4 requires nxtOSEK 2.14 or later version

it is possible you have an out-of-date copy of ECRobot or nxtOSEK on your system. To fix this, you need to redownload and reinstall these programs. Do the following:

1. Go to your ECRobotInstaller directory and copy the following commands to the MATLAB command line:

config = ecrobot_install_config; delete(fullfile(config.ArchiveDir, config.ECRobot_ZIPFile)) delete(fullfile(config.ArchiveDir, config.NXTOSEK_ZIPFile)) rmdir(config.ECRobot_InstallationDirectory, 's')

If the rmdir command doesn’t work, go to the config.ECRobot_InstallationDirectory directory (using Windows Explorer), and manually delete that directory and all files under it. You may need to exit MATLAB to do this successfully.

2. Re-run download_ecrobot_tools and install_ecrobot_tools

Page 11: ECRobotInstaller: Automated download and install for ECRobot

Dec 1, 2011 Version 1.38

11

I get a code generation error while building TestMotorOSEK If you are running 64-bit MATLAB, you will get the following error when you build TestMotorOSEK.mdl:

??? Error in S-function 'TestMotorOSEK/ExpFcnCalls Scheduler': S-Function 'sfun_expfcncallsscheduler' does not exist.

ECRobot ver 3.18 is not supported on 64-bit platforms. A workaround is to install 32-bit MATLAB on your 64-bit system, and use the ECRobot toolchain from the 32-bit MATLAB.

Page 12: ECRobotInstaller: Automated download and install for ECRobot

Dec 1, 2011 Version 1.38

12

I get a compilation error while building TestMotorOSEK If your MATLAB path includes a space, e.g., " C:\Program Files (x86)\MATLAB\R2010b", then you may get the following compilation error when building TestMotorOSEK.mdl:

Compiling /cygdrive/c/LegoMindstorms/ECRobot/ecrobotNXT/environment/nxtOSEK/toppers_osek/kernel/alarm.c to alarm.o /bin/sh: -c: line 0: syntax error near unexpected token `(' /bin/sh: -c: line 0: `/cygdrive/c/LegoMindstorms/GNU_ARM_Compiler/bin/arm-elf-gcc -c [...] make: *** [build/kernel/alarm.o] Error 2

ECRobot ver 3.18 requires that MATLAB be installed in a path that does not include any spaces. You can check the MATLAB path by typing matlatroot at the MATLAB command prompt:

>> matlabroot ans = C:\Program Files (x86)\MATLAB\R2010b

One workaround is to MATLAB in a path without any spaces. Another workaround is to edit one of the ECRobot files to avoid the error, as follows:

1. Locate the following file in your ECRobot installation directory and open it in the editor: ecrobotNXT\environment\private\iGenerateMakefile.m

2. Find the following line (it should be on or near line 34): fprintf(fid, ['MATLAB_ROOT = ' iConvAbsPath2CygPath(regexprep(matlabroot, '\', '/')) '\n']);

3. Change the line to the following: fprintf(fid, ['MATLAB_ROOT = ''' iConvAbsPath2CygPath(regexprep(matlabroot, '\', '/')) '''\n']);

4. Save and close the file 5. Open TestMotorOSEK again and follow the instructions under "Step 5: Verify that everything

works"

Page 13: ECRobotInstaller: Automated download and install for ECRobot

Dec 1, 2011 Version 1.38

13

How can I check that everything got installed properly? If you have run install_ecrobot_tools, and would like to check the status of the installations, do the following:

1. In MATLAB, go to the directory containing the ECRobotInstaller files 2. Type: check_ecrobot_tools

This will print out the status of the various installs, and will also log the information to C:\Temp\ECRobot_tools_check_log.txt. If you cannot resolve your problem, send me ([email protected]) the log file with a description of your problem.

Page 14: ECRobotInstaller: Automated download and install for ECRobot

Dec 1, 2011 Version 1.38

14

How can I create an installation CD? By default, the archive directory is in the same directory that contains ecrobot_install_config.m, download_ecrobot_tools.m, and the other m-files. Once the downloads are done, simply copy that entire directory tree to a CD or a network share.

If someone else wants to install the ECRobot tools, they just need to:

1. Go to the ECRobotInstaller directory on the CD or the network share (in MATLAB), and 2. Type install_ecrobot_tools

The tools will be installed on the user's computer with the directories specified in ecrobot_install_config.m

Page 15: ECRobotInstaller: Automated download and install for ECRobot

Dec 1, 2011 Version 1.38

15

How do I uninstall the components for ECRobot?

Uninstalling Cygwin in Windows XP Official Cygwin FAQ entry on uinstalling Cygwin 1. Delete the Cygwin directory (config.Cygwin_InstallationDirectory in ecrobot_install_config.m). 2. Ensure there are no references to the Cygwin directory on the system path

Select Windows Start menu -> Settings -> Control Panel Select System, and go to the Advanced tab Follow the steps below

a. Click on Environment variables

b. Select Path under "System Variables", and click on Edit

c. In the Variable value field, delete the Cygwin directory from the path (Hint: copy the entire path to Notepad, search for "cygwin", delete it, and paste the modified path back into the Variable value field).

Uninstalling GNU ARM Tools Choose: Start menu -> Settings -> Control Panel Select Add or Remove Programs Select "GNUARM 4.0.2" and click on the "Remove" button

Page 16: ECRobotInstaller: Automated download and install for ECRobot

Dec 1, 2011 Version 1.38

16

Uninstalling LEGO Mindstorms NXT Driver Choose: Start menu -> Settings -> Control Panel Select Add or Remove Programs Select "LEGO Mindstorms NXT Driver" and click on the "Remove" button

Uninstalling NeXTTool and NXT Enhanced Firmware To uninstall NeXTTool or the NXT Enhanced Firmware files, simply delete the corresponding installation directory. For the installation directories, see Where are the download and installation directories? (in the Common Questions section of this document).

Uninstalling ECRobot and nxtOSEK 1. To uninstall ECRobot, delete the installation directory (config.ECRobot_InstallationDirectory in

ecrobot_install_config.m). This deletes nxtOSEK as well, since it is a subdirectory in the ECRobot installation directory.

2. In MATLAB, select File -> Set path … This opens up the following dialog box.

3. Select the ECRobot directory, click "Remove", and then "Save".