Knowledge Base

No.

Description / Link

S001

Error running Cygwin, "Cannot find Cygwin DLL"

 

 

S002

How to Uninstall Cygwin

 

 

S003

Linux 'xtools' Script Fails on Install.

 

 

S004

Do's and Don'ts in Windows (Cygwin) Source Files and Folders and How to Remove Carriage Returns in Files

 

 

S005

How does GNU X-Tools perform remote debugging?

 

 

S006

Can I use GNU X-Tools for target environment xxxx?

 

 

S007

What has to be changed in GNU X-Tools so that I can generate applications that will execute under Embedded Linux?

 

 

S008

How to 'mount' DOS paths and network paths using GNU X-Tools Bash Shell

 

 

S009

What are the roles of the different Linker Scripts?

 

 

S010

How to create assembler listings

 

 

S011

How to fix a mix-mode (C / assembly) debugger problem exhibited in Visual GDB

 

 

S012

How to create debug symbols for assembler files that are preprocessed by GCC

 

 

 

S013

 

Global Path Problems for Visual X-Tools on Chinese Version of Windows

 

 

 

S001

Description: Error running Cygwin, "Cannot find Cygwin DLL" error message.

Here a few things to check:

If using Windows 98 SE...

To add GNU X-Tools Path to Windows 98, edit the file "<drive>:\autoexec.bat" (normally this file is located on "C" drive). Simply add the compiler's binary directory (i.e., <drive>:\Cygwin\bin) and VIDE directory (if using VIDE) to the "PATH"  command, and add the Make mode variable setting and reboot the computer.   The GNU make, version 3, has a mode that allows the GNU make to be compatible with Microsoft Windows.  The make mode variable controls the compatibility mode; therefore, it must be set on the Windows host operating system before building software using GNU X-Tools.

Example:

SET MAKE_MODE=Unix

SET PATH = c:\cygwin\bin;c:\"Program Files"\Vide; -- add other paths after these

Note that the double quotes around Program Files are needed because the space between the words is not recognized in Windows 98 without the double quotes.

If using Windows NT/2000...

On NT/2000, right click on the My Computer icon on the desktop to get to the System Properties Tab; click on Environment tab and then click on Path to change the "PATH"  in the environment.  Enter the Path settings.

Example of Path Settings:

Enter "c:\Program Files\Vide; c:\cygwin\bin;

In addition to path settings the user needs to insert an environment variable on the same System Properties Tab; click on Environment tab and enter the following variable and value:

Example:

Variable: MAKE_MODE           

                      Value: Unix

All path settings in VIDE  and the GNU X-Tools™ command line make environment will use forward "/" slashes as opposed to back "\" slashes.

Important Notes

Do not delete any of the other path settings – use ";" to separate path settings.  In "Windows NT"  you do not need to reboot the computer; however, if you are in "VIDE" , you must exit and startup again.

Once installed and setup (and rebooted if necessary), the user may go to the desktop and double click on the GNU X-Tools icon created during the installation to get "Bash Shell"  operating.   You must login as Administrator if you are installing for a multi-user environment.

 

S002

Description: How to Uninstall Cygwin

1. Before starting, remove any project files you wish to save from the Cygwin root or sub-directories.

2. Open the computer's Control Panel and click on Add/Remove programs.  If Cygwin or GNU X-Tools exists in the list of programs, click on remove. If Cygwin / GNU X-Tools does not exist, simply skip over to the next step.

3. Remove the Cygwin directory using Windows Explorer.

4. Verify / clean the registry of all Cygnus Solutions entries:

  a. Run 'regedit' from the 'Start | Run' command
  b. Look for the following Registry Keys:
       HKEY_CURRENT_USER\Software\Cygnus Solutions
   HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions
   If they exist, manually delete them by right clicking the mouse on the key and selecting DELETE.
 

5.   To Verify and / or Clean the Environment Variables

     a. Start your Control Panel from the 'Start' menu.
     b. Click on 'System' and select the 'Advanced' Tab.
     c. Click on 'Environment Variables'.
     d. On 'System Variables' window, Click on 'Path' and then on the 'Edit' button.
     e. Make sure all instances of 'Cygwin\bin'  and 'Cygwin\usr\bin' along with the drive letter are
         removed.

Done!

 

S003

Description: Linux 'xtools' Script Fails on Install - v2.0

Description

In some linux versions the 'xtools install' command described Section 2.2.1, step 5 of the GNU X-Tools User Guide fails to install the files into '/usr' directory and properly execute the command shell.

Resolution

The xtools procedure utilizes the shell variable OSTYPE to determine whether the current environment is Cygwin or Linux. We have discovered that different Linux distributions and version set this variable differently, some using 'linux' and some using 'linux-gnu'. The xtools control script, '/usr/bin/xtools' command script file, checks the value of OSTYPE to determine which install procedure to use.

Procedure to Fix Problem on Non 'linux-gnu'  Platforms

1. Follow the normal installation procedure as described in Sec 2.2.1 up through step 4 on page 12.

2. From a shell, change directory to '/usr/bin' and enter the command 'echo $OSTYPE'. record the value of OSTYPE reported. 

3. Edit the file 'xtools' in '/usr/bin'. Go to the line that contains 'if[$OSTYPE=linux-gnu]; then'  and edit it.  If the reported OSTYPE is not 'linux-gnu', then the word 'linux-gnu' should be changed to whatever was reported as the OSTYPE check above.  Save and exit the edit session.

4. You should now be able to continue the installation process following the next step, step 5.
 

 

S004

Description: Do's and Don'ts in Windows (Cygwin) Files and Folders and How to Remove Carriage Returns in Source Files

Do's

1. Use LF (a.k.a. line feed) editor settings only for source files developed to compile on Windows (Cygwin).  VIDE has an options setting for end-of-line (see Options | Editor).
2. Use all lower case letters for filenames and folder names in Windows (Cygwin). This is by convention in the Unix/Linux world.

Don'ts

1. Do not use DOS style text files as source code files in Windows (Cygwin).  Cygwin 1.0 uses Unix/Linux style (LF only) line return format. If your source files are already in the DOS style, follow the instructions below to fix the source files or open the source files in VIDE (with LF only option set for the editor) and make a simple file change (add a line) and then save the file. If you use the command line resolution below, make a backup of your source files before you begin -- just in case you make an error.
2. Do not put spaces in filenames and folder names -- you will experience problems!

Remove Carriage Returns in Source Files

To remove CR (carriage returns) in a DOS style text file, follow the procedures below:

1. Open a BASH/GNU X-Tools Shell and navigate the command line (using Unix/Linux style commands) to the directory of the file you wish to clean the CRs out.

2. Enter the following commands verbatim:

    $tr  -d   "\r"  <filename  >tmpfile
    $rm  -f   filename
    $mv  tmpfile  filename
    Note: the '<' and '>' are nececssary as part of the syntax.  The 'filename' is the file you want to remove the contents, except for the carriage returns, and place the contents in a 'tmpfile'; then the next two procedures simply remove the original file and rename the 'tmpfile' to the orignal filename.

    These three commands are necessary to remove the carriage returns from a DOS style source file, so that a user may use Cygwin to compile the source file into object code.

 

S005

Description: How does GNU X-Tools perform remote debugging?

GNU X-Tools performs remote debugging through either a specially-configured board or emulator, using either TCP/IP sockets or a serial communications port. GNU X-Tools communicates using the GNU GDB Stub Protocol. Abatron makes a very fast BDM/JTAG debugger (called BDI2000) that supports GDB Stub Protocol for several targets.  Some manufacturers make target boards with a built-in debug monitor interface; however, these interfaces are usually very slow.

 

S006

Description: Can I use X-Tools for target environment xxxx?

The Microcross toolschains are designed to produce statically linked coff and elf executables in a target independent manner so that the tools have broad applicability across many targets and operating environments.  The supplied run-time libraries are statically linked and incorporate a posix-like syscall interface to a processor dependent system trap. This arrangement is compatible with the cpu simulators included with GNU X-Tools. For most other target environments including Linux, tailoring of the libraries (and sometimes linker is required).
 

If you are expecting a turnkey environment for target OS-xxx, you will need to perform these modifications. Keep in mind that the strength of GNU X-Tools is that they provide a validated, ready-to-run, flexible code-development environment that is independent of OS-xxx. For a given development project this is two-thirds of the battle.  In the future we plan to offer add-on libraries, EDK's, and related products that provide turnkey options for target-specific operating environments, but for now you will have to provide these customizations yourself.  For i386 Linux users, your best bet is to use the Linux native development system.  

 

S007

Description: What has to be changed in GNU X-Tools so that I can generate applications that will execute under Embedded Linux?

The Microcross toolschains are designed to produce statically linked coff and elf executables in a target independent manner so that the tools have broad applicability across many targets and operating environments.  The supplied run-time libraries are statically linked and incorporate a POSIX-like syscall interface to a processor dependent system trap. This arrangement is compatible with the cpu simulators included with GNU X-Tools. For most other target environments including Linux, tailoring of the libraries (and sometimes linker is required).
 

To generate applications to run under Linux, the header files, runtime libraries, startup file, and linker script files must be changed out and substituted with Embedded Linux header files, runtime libraries, startup file, and linker script specific for the embedded target processor (i.e., MIPS, ARM, PowerPC, etc.). Here are the file locations:

    Cygwin Host
    Header Files:        $//<drive>/Cygwin/usr/arm-elf/include/*.*
    Runtime Libraries: $//<drive>/Cygwin/usr/arm-elf/lib/libc.a
    Startup File:          $//<drive>/Cygwin/usr/arm-elf/lib/crt0.o
    Linker Script:         $//<drive>/Cygwin/usr/arm-elf/ldscripts/*

    Linux Host
    Header Files:        $/usr/arm-elf/include/*.*
    Runtime Libraries: $/usr/arm-elf/lib/libc.a
    Startup File:          $/usr/arm-elf/lib/crt0.o
    Linker Script:         $/usr/arm-elf/ldscripts/*

If you are expecting a turnkey environment for an Embedded Linux target OS, you will need to perform these modifications. Keep in mind that the strength of GNU X-Tools is that they provide a validated, ready-to-run, flexible code-development environment that is independent of OS-xxx. For a given development project this is two-thirds of the battle.  In the future we plan to offer add-on libraries for EDK's, and related products that provide turnkey options for target-specific operating environments, but for now you will have to provide these customizations yourself.  For i386 Linux users, your best bet is to use the Linux native development system.  

 

S008

Description: How to 'mount' DOS paths and network paths using the GNU X-Tools Bash Shell

Cygwin v1.20 or older

$ mount -b -f  <dos path> <unix path>
Switches '-b' for binary and '-f' to force -- absence of '-b' mounts as a text mode

e.g.  Mount  a local directory 'c:\data' to 'Cygwin/data'
$ mount -b -f  c:\\data   /data

e.g. Mount a network directory  '\\fs1\sharename'
$ mount -b -f  \\\\fs1\\sharename   /data

Cygwin v1.3.22 or newer

$ mount -b -f  <dos path> <unix path>
Switches '-b' for binary mode and '-f' to force -- absence of '-b' mounts as a text mode

e.g.  Mount  a local directory 'c:\data' to 'Cygwin/data'
$ mount -b -f  c:/data  /data
or
$ mount -b -f /cygdrive/c/data /data


e.g. Mount a network directory  '\\fs1\sharename'
$ mount -b -f  \\\\fs1\\sharename   /data

S009

Description: What are the roles of the various Linker Scripts?

These are the standard linker scripts:

  • .x -- default loader script
    .xr -- non-relocating script (used when -r option is invoked)
    .xu -- non-relocating with constructors (C++ and -r)
    .xn -- mixed text / data sections (-n)
    .xbn -- mixed text / data sections (-N)
    .xs -- shared library generation (--shared)
  • It is necessary for the memory configuration to be altered to support each of the listed options. The template for your project specific linker script should be based on your selection of the link options (-r, -n, -N, --shared). Also, see 'Microcross Utilities' manual (Chp. 2 and 3) in the pdf documentation on this website and also on the GNU X-Tools distribution CD.

S010

Description: How to create assembler listings using Visual and GNU X-Tools

Option 1: Use GCC CFlags in a GNU X-Tools makefile, add the following:

   -Wa,ahls=$*.lst

Option 2: In Visual X-Tools, add the following to 'Other Option' on the 'Compile' tab for each assembler, C, or C++ tool options dialog: 

   -Wa,ahls=$(OUTDIR)/$(*F).lst
 

Also, see the Visual X-Tools User Guide for more information.

S011

Description: How to fix a mix-mode (C / assembler) debugger problem exhibited in Visual GDB

Symptoms: The asm instruction is not in the right order with the source, and Visual GDB indicator jumps all over the place.
 

Solution: Turning off optimization and recompiling with an appropriate debug symbol option solves both problems. Optimization should not be used until all debugging has been completed.

S012

Description: How to create debug symbols for assembler files that are preprocessed by GCC

Symptoms: The Visual GDB or GDB when connected to a JTAG/BDM emulator will not show any of the source code symbols during debug.  For example:

$ xscale-elf-gcc -c -gdwarf -o crt0.o crt0.S

results in no errors but no debug info, however:

$ xscale-elf-gcc -c -o crt0.o  crt0.S -Wa,-gdwarf

results in debug symbols.

 

Solution: When using GCC to control the assembly source files that need preprocessing, use the following example as a guide:

$ xscale-elf-gcc -c -o crt0.o crt0.S -Wa,-gdwarf

Otherwise you can use the following if invoking 'as' assembler directly:

$ xscale-elf-as -c -gdwarf -o crt0.o crt0.S

Note: This example shows the 'xscale-elf' as the toolchain.  Any of the other target aliases may be used depending on the toolchain you have installed (e.g., arm-elf, mips-elf, ppc-elf, etc.).
 

 

© 2009 Microcross, Inc.  All rights reserved.