Peter-Jan RandewijkMain Page | About | Help | FAQ | Special pages | Log in

Printable version | Disclaimers | Privacy policy

Microchip MPLAB C30 v3.00

From Peter-Jan Randewijk

Contents

Summary

The MPLAB® C30 compiler is a full-featured ANSI compliant C compiler for the Microchip 16-bit devices: PIC24, dsPIC30F and dsPIC33F. MPLAB C30 is fully compatible with Microchip’s MPLAB Integrated Development Environment (IDE), allowing source level debugging with the MPLAB ICE In-Circuit Emulator, MPLAB ICD 2 In-Circuit Debugger and MPLAB SIM Simulator.[1]

MPLAB C30 Source Code

Source code for the Microchip's MPLAB ASM30 v3.00 (also called the PIC30 Binutils) and MPLAB C30 C Compiler v3.00 (also called the PIC30 GCC) are available from Microchip here or locally (sun.ac.za) from here.

Compilation of MPLAB C30 (or PIC30 Toolchain) on Linux (or more specific openSUSE 10.2)

The instructions for the compilation of the PIC30 Toolchain, v3.00 is heavily based on the documentation for the compilation of the PIC30 Toolchain v2.01 [2] by John Steele Scott.[3]


PIC30 Binutils

Download the tarball mplabalc30v3_00.tgz and untar:

tar -xzf mplabalc30v3_00.tgz

Change to the newly created "acme/" directory and change the M$ Windows/DOS end-of-lines to POSIX end-of-lines

cd acme/
find . -type f -exec dos2unix '{}' ';'

Apply John Steele Scott's patch available here or locally here. This patch is necessary because Microchip delete all the testsuite subdirectories from their source archive, so we have to take care not to run the tests.[4]

patch -p0 < makefile_in.diff

Configure the Makefile to place the pic30-coff-binutils in /usr/local

./configure --prefix=/usr/local --target=pic30-coff

Then,

make

If successful run,

make install

For "elf" files:

./configure --prefix=/usr/local --target=pic30-elf
make
make install


PIC30 GCC

Download the tarball mplabc30v3_00.tgz and untar:

tar -xzf mplabc30v3_00.tgz

Change to the newly created "gcc-4.0.2/gcc-4.0.2/" directory and change the M$ Windows/DOS end-of-lines to POSIX end-of-lines

cd gcc-4.0.2/gcc-4.0.2/
find . -type f -exec dos2unix '{}' ';'

Apply a modified version of John Steele Scott's patch available locally here. This patch (as before) is necessary because Microchip delete all the testsuite subdirectories from their source archive, so we have to take care not to run the tests.[5]

patch -p0 < makefile_in.diff

Configuring gcc in the "src" directory is not supported, and would lead to the following error, see [6]

configure: error: Building in the source directory is not supported in this release.

Create an "obj" directory or just go back one "level", and run the configuration from there, and then run make,

cd ..
./gcc-4.0.2/configure --prefix=/usr/local --target=pic30-coff --enable-languages=c
make

In spite of the patch the make process will stop with the following error:

configure: creating ./config.status
config.status: creating Makefile
config.status: creating testsuite/Makefile
config.status: error: cannot find input file: testsuite/Makefile.in
make: *** [configure-libiberty] Error 1

Just type "make" again, i.e.

make

It will stop once more with the same error during the building process,

configure: creating ./config.status
config.status: creating Makefile
config.status: creating testsuite/Makefile
config.status: error: cannot find input file: testsuite/Makefile.in
make: *** [configure-build-libiberty] Error 1

but just type "make" once more, i.e

make

It should now finish successfully.

If you type,

make clean
make

it will bypass the above two "Errors".


After typing,

make install

the pic-coff-gcc files will be located in your /usr/local/bin/ directory.

There is however still a bug with the naming of the output files, so these have to be renamed by hand in order for:

mv pic30-coff-pic30-coff-cpp pic30-coff-cpp
mv pic30-coff-pic30-coff-gcc pic30-coff-gcc
mv pic30-coff-pic30-coff-gccbug pic30-coff-gccbug
mv pic30-coff-pic30-coff-gcov pic30-coff-gcov

To make "elf" files, all the files and directories have to deleted, excepts the source directory "gcc-4.0.2".

make distclean
rm ./config.cache

does not seem to work.

Then it is basically the same as the above:

./gcc-4.0.2/configure --prefix=/usr/local --target=pic30-elf --enable-languages=c
make
make #once more
make #once more again
make install
mv pic30-elf-pic30-elf-cpp pic30-elf-cpp
mv pic30-elf-pic30-elf-gcc pic30-elf-gcc
mv pic30-elf-pic30-elf-gccbug pic30-elf-gccbug
mv pic30-elf-pic30-elf-gcov pic30-elf-gcov


To see if Piklab can find the necessary:

for your newly created PIC30 Tooichain components,

  1. open Piklab
  2. select Configure Toolchains
  3. select PIC30 Toolchain
  4. select Output Object Type: Coff or Elf

Next to each component, e.g. Compiler it should display "pic30-coff-gcc" found.

If you "click" on Details, it would state:

Command for executable detection:
pic30-coff-gcc --version
Version string:
pic30-coff-gcc (GCC) 4.0.3 (dsPIC30, Microchip MCHP_VERSION) Build date: May 30 2007
Copyright (C) 2005 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Retrieved from "http://staff.ee.sun.ac.za/pjrandewijk/wiki/index.php/Microchip_MPLAB_C30_v3.00"

This page has been accessed 8 748 times. This page was last modified 13:43, 30 May 2007.


Find
Browse
Main Page
Community portal
Current events
Recent changes
Random page
Help
Donations
Edit
Edit this page
Editing help
This page
Discuss this page
Post a comment
Printable version
Context
Page history
What links here
Related changes
My pages
Log in / create account
Special pages
New pages
File list
Statistics
Bug reports
More...