skip navigational linksPJRC
Shopping Cart Download Website
Home Products Teensy Blog Forum
You are here: 8051 Tools Software Windows AS31/SDCC

PJRC Store
8051 Board, $79
LCD 128x64 Pixel, $29
LCD 16x2 Char, $14
Serial Cable, $5
9 Volt Power, $6
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.

To add the PATH in XP:

  1. Right Click 'My Computer'
  2. Select 'Properties'
  3. Click on the 'Advanced' Tab
  4. Click on the 'Environment Variables' button
  5. Under 'System Variables' Scroll down until you see Path.
  6. Select Path, Click 'Edit' to add to the Path (for sdcc ";c:\sdcc\bin") 'Ok' and we are done.

Special thanks to Angus Kerr for these XP path instructions.

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: February 24, 2005
Suggestions, comments, criticisms, things you want?? <paul@pjrc.com>