PJRC Home MP3 Player 8051 Tools All Projects PJRC Store My Order Site Map

MP3 Player Pages


This is an old page that is no longer maintained.

These new, much easier instructions have replaced this old page (but we're keeping the old page on-line for reference and to support anyone who set up their build up this way). The method described here requires downloading several programs, including the large and complex Cygwin package... which caused a lot of frustration for many windows users who had little familiarity with command line syntax and unix shells. The new method is a single compact ZIP file that does not require Cygwin. We highly recommend you use the new setup if you haven't already installed Cygwin or if you are not familiar with unix.


Setting Up A Windows Based Build Environment With CYGWIN

These instructions were written by Chris Brinton.
His original page may be found here.

Updated 8/16/01

I created this build script on a Win2K machine, but I have made it work on a win98 machine also, so it should work on most wintel platforms.

I have a broadband connection. If you dont, you may want to take advantage of the people in the group that have been willing to send cygwin CDs via mail.

Cygwin is a very complete package. For those of you that are familiar with linux/unix you should be able to work as if you were at a typical linux box. This version of the script includes directions for wincvs as well as the version of cvs that comes with cygwin.

There are some issues with compiling SDCC v2.3.0 and I included workarounds, as well as instructions for using the precompiled windows binaries.

Please let me know if there are any mistakes or other issues. I tried to be as accurate as possible, but I definitely could have made some mistakes.


1. Install Cygwin
2. Install AS31
3. Install SDCC
4. Configure CVS and checkout source
5. Edit the Makefile (if necessary)
6. Make the firmware

1. Install Cygwin

  1. Go to www.cygwin.com, click on "install now"
  2. Select "run program from current location"
  3. Click Yes when asked if you want to run Setup.exe
  4. Click Next when setup starts
  5. Select "install from internet", click Next
  6. Select download directory, click next (I put mine in /tmp/cygwin, but it should be arbitrary)
  7. Select install dir (I recommend the default, C:/cygwin)
    select unix default file type
    select install for All
    click next
  8. Enter connection info (this is specific to your connection)
    click next
  9. Select download mirror (choose your favorite)
    click next
  10. On the package selection screen, select Make, PERL, and CVS then click next.
  11. Download commences now, on my 768k line this took about
    20 minutes.
  12. Choose to create a desktop shortcut and start menu item or not click next
Cygwin provides many programs and utilities. Of them, you will need make, perl, cp, and rm.

Check that you have these four programs installed and you can run them from your command prompt. If any of these are missing, you will not have a working system. Check them NOW, before you proceed to AS31 and SDCC.

2. Download AS31

Here's the link: http://www.pjrc.com/tech/8051/as31_beta3_win32.zip

Extract the exe to somewhere in the cygwin path. I put it in C:\cygwin\bin

3. Download SDCC

This is the complicated bit. For me the v2.3.0 of sdcc compiled, but failed to install correctly (as far as I can tell). You need to finish the install by hand. I put the steps to do this at the end. Alternatively, you can download a previously compiled (binary) version for windows. The SDCC binary version is the easiest, but if you want to use the very latest copies of SDCC, they are sometimes only available in source code form.

Install SDCC Binary Distribution

Download a win32 binary copy of SDCC for windows. These are often labeled with the term "mingw32".

The best version to use, as of August 27, 2002, is:

You can also find newer copies of SDCC at the official SDCC website and this SDCC Nightly Snaphot page.

  1. Extract the files to C:\sdcc
  2. Add C:\sdcc\cygbin to your path: export PATH=$PATH:/cygdrive/c/sdcc/cygbin
TODO: Does this path from step 2 really work? Or should it be something like c:\sdcc\bin ?? I need feedback from windows users, so please comment if you know.

Compile & install SDCC

It is also possible to use cygwin to compile sdcc from its source code. This is an advanced task beyond the scope of this "getting started" document.

4. Configure cvs and checkout the source.

CVS is required to obtain the very latest version of the source code, which is in active development. CVS is not part of the actual build process... it is a tool that communicates with the CVS server at PJRC to obtain the code in development and coordinate effort among developers.

You do not need CVS if you only want to compile the firmware source archives that are available on the website. In that case, just download and unpack the firmware code, and skip this step. But remember, to download the very latest code that is in development (not release on the web site yet), you must use CVS.

Note: cvs uses for 2401 to communicate. If you are behind a firewall, be aware of this.

You can use either wincvs or the cvs that comes with cygwin to download the source. Its up to you whether you prefer point and click or command line. The following commands get you started with the command line version:

        cvs -d :pserver:anonymous@pjrc.com:/usr/local/cvs login

        [just press enter at the password prompt]

        cvs -z5 -d :pserver:anonymous@pjrc.com:/usr/local/cvs checkout mp3

    for regular updates, do:

        cvs update

[Alternate CVS]
    install wincvs v1.2 - www.wincvs.org
    a. click download, click x86 version 1.2
        typical install, default location.
    b. start wincvs
    c. under admin->preferences set:
           cvs root: :pserver:anonymous@pjrc.com:/usr/local/cvs
           authentication: passwd file on cvs server
           cvs version 1.1

    d.select admin->login,
            enter appropriate home dir
            enter nothing for the password.
            you should now be logged in.

    e.for first time checkout:
            select Create->checkout module.
            for module name, use mp3
            enter a directory where you want the module to go
            under checkout options, select Force using CVSROOT (-d)
            hit ok

This should work for a little while and populate the directory with the cvs files.

To update to the most recent set of files, select the module directory in the cvs browser and hit Modify->Update selection, then hit ok.

5. Edit the Makefile

If you installed the precompiled windows SDCC v2.2.2 you will need to edit the Makefile for the firmware. If you compiled and installed SDCC v.2.3.0, then you can skip this step.

    Add the following to the SDCCFLAGS line:
        -I //c/sdcc/include -L //c/sdcc/lib/large

This is assuming you put the sdcc build in C:/sdcc as specified in step 3.

6. Make the firmware

In a bash shell in the mp3 module directory run make.

I was able to successfully make mp3player.hex and have it work on my player.

MP3 Player, Setting Up A Windows Based Build Environment With CYGWIN, Chris Brinton
Last updated: November 28, 2003