PIC firmware build

From RepRap
Revision as of 06:12, 18 July 2015 by Glenn (talk | contribs) (+cat)
Jump to: navigation, search

Building the PIC firmware on a Linux system

Prerequisites

You will need to have a few packages installed:

 
$ sudo apt-get install build-essential cvs subversion bison flex

You also need to have gputils and SDCC installed. The standard version of gputils contains a bug, so you need to download a later one. Uninstall gputils and/or sdcc if the standard versions are already installed on your machine. Then...

GPUTILS

Create a directory for tools needed for RepRap firmware build and put gputils in it:

$ mkdir $HOME/reprap-tools
$ cd $HOME/reprap-tools
$ cvs \
  -d:pserver:[email protected]:/cvsroot/gputils \
  login
$ cvs -z3 \
  -d:pserver:[email protected]:/cvsroot/gputils \
  co -P gputils
$ cd gputils
$ ./configure --prefix=$HOME/reprap-tools
$ make
$ make install

SDCC

Not all versions of SDCC work. In particular some later revisions have bugs that are not present in earlier versions. Revision 4943 is known to work with RepRap. Once again, put this in the directory you created:

$ cd $HOME/reprap-tools
$ svn co -r 4943 https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc
$ cd sdcc
$ ./configure --prefix=$HOME/reprap-tools --disable-mcs51-port \
  --disable-gbz80-port --disable-z80-port --disable-avr-port \
  --disable-ds390-port --disable-ds400-port --disable-xa51-port \
  --disable-hc08-port --disable-ucsim
$ make
$ make install

RepRap PIC Firmware

If you are doing RepRap development you will almost certainly be using Eclipse for the Java host code anyway. Use subversion in Eclipse to check out

 https://reprap.svn.sourceforge.net/svnroot/reprap/trunk/reprap/firmware

and move to the directory where Eclipse put that:

$ cd ~/workspace/firmware

Add the directory you created previously to your path:

$ PATH=$HOME/reprap-tools/bin:$PATH
$ export PATH

Now make the RepRap PIC firmware:

$ ./configure
$ make

Files Built

That should create five .hex files for the PIC16F648 (or PIC16F648A - either will work):

  ~/workspace/firmware/stepmotor/stepmotorx.hex
~/workspace/firmware/stepmotor/stepmotory.hex
~/workspace/firmware/stepmotor/stepmotorz.hex
  ~/workspace/firmware/extruder_0/extruder0.hex
~/workspace/firmware/extruder_1/extruder1.hex

The first three are for the axis stepper controllers.

The file extruder0.hex is for the standard thermoplast extruder.

The file extruder1.hex is for the experimental paste extruder.

Rebuilds and options

To do a rebuild, in the ~/workspace/firmware directory type

$ make clean
$ make

The standard distribution has the X, Y, and Z axis code set to do half-stepping on the stepper motors. To change this to full stepping edit the file:

  ~/workspace/firmware/stepmotor/stepmotor.h

comment out the line that says:

  #define HALFSTEP

and do a rebuild.

-- Main.AdrianBowyer - 03 Mar 2008