PJRC.COM Offline Archive, February 07, 2004
Visit this page on the live site

skip navigational linksPJRC
Shopping Cart Checkout Shipping Cost Download Website
Home MP3 Player 8051 Tools All Projects PJRC Store Site Map
You are here: 8051 Tools Software Windows AS31/SDCC Search PJRC

PJRC Store
8051 Dev Board, $79
LCD 20x2 Display, $11
Serial Cable, $5
12 Volt Power, $8
More Components...
8051 Tools
Main Page
Software
PAULMON Monitor
Development Board
Code Library
89C2051 Programmer
Other Resources

AS31, SDCC and GNU Make For Windows Systems

Step 1: Old Version of Windows 95

Windows 98, Me, NT, 2000, and Windows 95 OSR 2 and later versions come with the required libraries. Skip this step if you are using any of these versions of Windows.

Very old versions of Windows 95, such as the one Microsoft actually shipped in 1995, lack the required C runtime libraries to run this program. If you have this old version, in all likelihood some other software you've installed has already updated your libraries. If not, you will need to install the Windows Library Update service pack (link to Microsoft's download page... scroll down to the "Service Packs" section).

These programs will not run on 16 bit platforms (Windows 3.11, MSDOS 6.x, etc).

Step 2: Unpack The ZIP File

Use your favorite ZIP extraction program (probably WinZip) to uncompress the ZIP file. The ZIP file contains several nested subdirectories, which must remain in the proper relative order for SDCC to function properly.

AS31 and Make do not require any support files, but they are included in SDCC's "BIN" subdirectory, so that they will be able to run with the PATH command in step 4.

Step 3: Move To C:\SDCC

It is recommended to move the SDCC directory created by the ZIP extraction to C:\SDCC. This step is needed because SDCC will search for its C library include files in \SDCC\SHARE\SDCC\INCLUDE and library object code in \SDCC\SHARE\SDCC\LIB. It is possible to pass command line options to SDCC to tell it where to find its library files, but installing it in C:\SDCC is much simpler.

This image shows the SDCC directory moved to the recommended location.

Windows Explorer: SDCC copied to C:\
Figure 1: SDCC Installed In C:\SDCC With All Subdirectories Intact. SDCC expects to find "INCLUDE" and "LIB" in these locations.

Step 4: Set up MS-DOS Prompt Shortcut with correct PATH

AS31, SDCC and Make are command line text-only applications, which are usually run from a "MS-DOS Prompt" window. To run these, you should create a copy of the MS-DOS Prompt shortcut and configure its properties for SDCC.
  1. Launch Windows Explorer, Start -> Programs -> Windows Explorer
  2. Navigate to C:\Windows\Start Menu\Programs
  3. Right click, hold and drag the "MS-DOS Prompt" shortcut to the desktop
  4. Select "Copy Here" when the popup menu appears as you release
  5. Right click on the new shortcut, and select Properties
  6. Select the Program tag
  7. Set "Batch file:" to "C:\SDCC\SDCCPATH.BAT"
  8. Set "Working:" to "C:\SDCC" (or whatever directory your project code will be in).
  9. Click Apply and OK to save your changes.
This image shows the MS-DOS Prompt properties, configured to run the SDCCPATH.BAT file.

MSDOS Shortcut Properties: Working = C:\SDCC, Batch File = C:\SDCC\SDCCPATH.BAT
Figure 2: MS-DOS Prompt Shortcut Properties To Run SDCCPATH.BAT

Windows XP: Use the start menu, click "All Programs", navigate to Accessories and then click and hold with the right mouse button on "Command Prompt" and drag it to your desktop, and select "Copy Here" in the popup menu. Microsoft removed the ability to run a batch file from the properties dialog... you can run the batch file manually, or manually type a command to add SDCC to your path. TODO: is there a way to do this automatically in XP ???

Step 5: Your C-Based Project Should Be On C: Drive

SDCC will search for its libraries in \SDCC\SHARE\SDCC\LIB. There is no drive letter in this pathname, so SDCC will look for its library files on the same drive you're using.

If you get errors like these:

test.c:1:20: stdio.h: No such file or directory
or
?ASlink-Warning-Undefined Global '__sdcc_external_startup' referenced by module 'test'

then SDCC is probably not able to find its library or include files. These error message claim that SDCC can not find items which are clearly supposed to be provided by SDCC's standard library.

Check the directory placements (step 3) and make sure the current directory in your MS-DOS Prompt shows the same drive as where SDCC is installed.

The putchar() function required for printf is NOT provided in SDCC's libraries (this may change someday). You must write a putchar function. See the LED Blink Example for a simple putchar function.


Installing AS31, SDCC and GNU Make Windows Binary Package; Paul Stoffregen
http://www.pjrc.com/tech/8051/tools/win32_install.html
Last updated: November 28, 2003
Suggestions, comments, criticisms, things you want?? <paul@pjrc.com>