ARM Technical Support Knowledge Articles

ENVIRONMENT VARIABLES AND USES WITH KEIL TOOLS

Applies to: General Topics

Answer


Information in this article applies to:


QUESTION

What are environment variables and why do I need to be concerned with them? How do I tell DOS/Windows what I want my "Environment Variables" to be?

ANSWER

An "environment variable" is used to set-up certain features and parameters within which DOS and Windows applications can operate. If you go to your DOS prompt and type the word "set" (no quotes) and press enter you should get some text similar to that below:

Microsoft(R) Windows 95
 (C)Copyright Microsoft Corp 1981-1996.

C:WINDOWS>set
PROMPT=$p$g
winbootdir=C:WINDOWS
COMSPEC=C:WINDOWSCOMMAND.COM
PATH=C:PROGRA~1NORTON~1;C:WINDOWS;
  C:WINDOWSCOMMAND;C:TEMP=D:TEMP
TMP=D:TEMP
windir=C:WINDOWS
BLASTER=A220 I5 D1
C:WINDOWS>

These settings tell DOS and your software where certain things are located in the system. Looking at the variable "COMSPEC" we see that it is set to equal (pointed to) "C:WINDOWSCOMMAND.COM". Whenever you return from a process or launch a process in which the COMMAND interpreter must be reloaded, this is the place the system looks first.

Note the two variables "TEMP" and "TMP". During operation, many programs create temporary files for various reasons. These variables tell the programs where the default location of these temporary files is to be located. You may assign these variables to point at ANY folder, however there are a few caveats:

  1. The folder must exist. Programs cannot write to a non-existent folder, and will not create this folder if it does not exist.
  2. Do NOT use the root directory (C:) for storing temporary files. DOS usually places a limit on the number of files that can be stored in the root folder of a drive (it varies based on drive architecture), typically 128 for a floppy or up to 256 (DOS 3.3) or so for a hard drive. Many programs produce copious quantities of temp. files and you can easily exceed this limit. The usual result is a cratered machine.
  3. The folder/drive must have enough room on it to hold the temporary files created by whatever applications you may have open. While the temporary folder may be on any hard drive on your machine, it should not be located on a network drive (not applicable to diskless workstations). Network connections are generally not fast enough for this type of application. Move your data files to the network drive if you need more room on your local drive.

"Environment Variables" are generally assigned in two particular system files: AUTOEXEC.BAT and CONFIG.SYS.

The CONFIG.SYS file is similar to the DIP switches found on older printers. This file contains specific instructions that are only loaded during boot-up. While Windows 95 may have no CONFIG.SYS file listed, or may have one that is empty, many of the files functions are built-in to the system and can be over-ridden in your CONFIG.SYS. The Keil tools make no modifications to your CONFIG.SYS file and so we will not discuss it further. An example of a Windows 95 CONFIG.SYS file is shown below: (Note: many commands are remarked-out, these can be un-remarked to allow booting the system when Windows 95 malfunctions.)

rem DEVICE=C:WINDOWSHIMEM.SYS
rem DEVICE=C:WINDOWSEMM386.EXE NOEMS
rem DOS=HIGH,UMB
FILES=120
DEVICEHIGH=C:WINDOWSSETVER.EXE
rem DEVICEHIGH=c:CDROMIBMTPCD.SYS /R

The AUTOEXEC.BAT file is a special type of command batch file. A batch file's purpose, and limitation, is to collect routinely utilized commands (to launch a program typically) into a script which can be invoked with a single command. Here is where the variables specific to the Keil tools are included in the system environment. Below is a copy of an AUTOEXEC.BAT with some commands commented-out. Keil tools are primarily interested in only three line items: those with the word "SET".

@ECHO OFF
rem C:WINDOWS
et start
rem C:WINDOWSCOMMANDMSCDEX.EXE /D:TPCD001 /M:15
SET PATH=C:PROGRA~1NORTON~1;C:WINDOWS;
  C:WINDOWSCOMMAND;c:
SET TEMP=d:TEMP
SET TMP=d:	emp
  1. PATH: The path variable lists the folders DOS searches to find the file that is executable, i.e. not a word-processing document, but a file ending in one of the following three extensions: BAT, COM, or EXE. The installation procedure you performed may have added the C:C51BIN path to the end of the statement. µVision versions prior to 1.17x generally included this statement, however newer versions can usually determine the path correctly without this (information is stored in an INI file).
  2. TEMP and/or TMP: These files may be responsible for your problem. They point to the location where the system expects to store its temporary files. TMP was used primarily by older programs, the same as TEMP is used now. Note that both variables point to the same location; this is normal, but the location MUST exist. You could probably get by with only the TEMP variable, however in some instances there have been problems when the assembler is operated without the TMP variable being set.

Article last edited on: 2005-08-08 09:38:30

Rate this article

[Bad]
|
|
[Good]
Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential