Chapter 2

Building From Sources

To build the dsPIC Threads Library, you need to have already installed the Microchip MPLAB C30 cross-compiler. You also need a basic Unix-like build environment with programs like Make and Sed. Under Windows I personally install and use Cygwin.

This library also depends on the dsPIC Helper Library that can be found at After building that library, you will have to ensure that its header files are available to the dsPIC Threads Library. The Makefile in the src directory has a variable called DSPIC_HELPER_DIR that you can edit to specify the location of the dsPIC Helper Library directory tree.

To build the dsPIC Threads Library, first unpack the source tree. You can do this with the following command:

  $ tar -xzf dspic-threads-1.0-src.tgz

Next, change directory to the head of the source tree that was just unpacked and run the make command:

  $ cd dspic-threads-1.0
  $ make

This should build the dsPIC Threads Library for the supported dsPIC microcontrollers. This includes the dsPIC30F6015, dsPIC30F6010A, and the dsPIC30F6010, though you can easily modify the Makefile to build for other targets as well.

2.1  Library Types

The build process actually builds two libraries for each microcontroller type; one for the default code size, and one using the -mlarge-code option. The libraries are built in separate directories named after the corresponding microcontroller and which option was enabled. For example, for the dsPIC30F6015, the libraries can be found here: