Firmware build process

From RepRap
Revision as of 10:46, 4 May 2012 by DavidCary (talk | contribs) (suggest renaming)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This page documents the firmware build process for Darwin hardware using PIC 16F648 in Generation 1 Electronics. For newer firmware, see List of Firmware.

Perhaps this page should be renamed "Darwin firmware build process" or "Darwin/firmware build process" ?

RepRap Firmware Build Process

Setup the Development Environment

Ubuntu/Linux: run the command below to install the required packages (we have made our own versions of sdcc and gputils for later firmware releases).

# sudo apt-get install subversion libc6-dev flex g++ bison gputils

Windows: please see Cygwin Build instead of using the following instructions.

Mac OSX: no idea. it is probably possible. if you attempt it, please let us know!

Compiling the Firmware

  • Check out the latest code from Subversion.
  • The firmware code is located in reprap/firmware
  • Issue a "make" at the top level
  • If this is the first build, a local instance of sdcc will be built first. This is to ensure compatibility with sdcc.
  • After the build is complete, the output files will be stored in the build subdirectory in a further subdirectory named by the processor the firmware is for. By default this is 16f628.
  • The following will be built in separate subdirectories of the processor build directory.
    • stepmotor A generic stepper motor controller on address 2. For RepRap this is the X axis.
    • stepmotorb A generic stepper motor controller, identical to stepmotor but using address 3. For RepRap, this is the Y axis.
    • stepmotorc A generic stepper motor controller, identical to stepmotor but using address 4. For RepRap, this is the Z axis.
    • stepmotor-small A generic stepper motor controller that has a smaller memory footprint. Not all features are supported and this is not currently planned for use in RepRap.
    • motor A generic DC motor controller using address 5. Not currently planned for use in RepRap.
    • extruder A reprap extruder controller that integrates DC motor functionality with PWM temperature control. It uses address 8.

  • If the sdcc compile fails with this error:
make[3]: Entering directory `/home/iowa/reprap/trunk/reprap/firmware/sdcc-build/sdcc/sim/ucsim'
g++ -g -O2 -gstabs+ -g3 -pipe -I. -Wall -I. -I./sim.src -Icmd.src -Igui.src  -c -o pobj.o
cmd.src/newcmdcl.h:127: error: extra qualification 'cl_console::' on member 'clone_for_exec'
make[3]: *** [pobj.o ] Error 1
make[3]: Leaving directory `/home/iowa/reprap/trunk/reprap/firmware/sdcc-build/sdcc/sim/ucsim'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/home/iowa/reprap/trunk/reprap/firmware/sdcc-build/sdcc/sim/ucsim'
make[1]: *** [sdcc-misc] Error 2
make[1]: Leaving directory `/home/iowa/reprap/trunk/reprap/firmware/sdcc-build/sdcc'
make: *** [/home/iowa/reprap/trunk/reprap/firmware/sdcc/share/sdcc/include/pic] Error 2

Edit the file sdcc-build/sdcc/sim/ucsim/cmd.src/newcmdcl.h and change line 127 from:

virtual class cl_console *cl_console::clone_for_exec(char *fin);


virtual class cl_console *clone_for_exec(char *fin);

(we've reported this bug to the sdcc developers, and hopefully it will be resolved soon.)

Building for a different processor

To build for a different processor than the default 16f628, use the PROCESSOR environment variable, eg

PROCESSOR=16f627 make

Building only specific devices

To build only specific devices, use the DEVICES environment variable, eg

DEVICES=stepmotor-small make

Similarly, to build a particular device for a different processor:

DEVICES=stepmotor-small PROCESSOR=16f627 make

Note: Most code uses some processor specific hardware and may not work correctly on any given device

-- Main.SimonMcAuliffe - 07 Jan 2006