This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

building Microchip's pic30 dsPIC version of binutils and GCC


Microchip distribute a modified GCC which targets their dsPIC series of
microcontrollers. It took me a while to figure out how to build it
properly on GNU/Linux, so I'm documenting the patches required for
posterity.

These patches apply against Microchip's version 1.30, available from
<http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1406&dDocName=en010065&part=SW006012>. For both the binutils and the gcc, I recommend running the whole lot through dos2unix before patching.

Apply this patch for binutils:

Microchip delete all the testsuite subdirectories from their source archive,
so we have to take care not to run the tests.
--- acme/libiberty/Makefile.in.orig	2005-02-22 11:35:08.324184816 +1030
+++ acme/libiberty/Makefile.in	2005-02-22 11:34:58.923613920 +1030
@@ -103,7 +103,7 @@
 	"tooldir=$(tooldir)"
 
 # Subdirectories to recurse into. We need to override this during cleaning
-SUBDIRS = testsuite
+SUBDIRS = 
 
 # FIXME: add @BUILD_INFO@ once we're sure it works for everyone.
 all: stamp-picdir $(TARGETLIB) needed-list required-list all-subdir

Apply the following five patches for gcc:

By John Steele Scott, 22/2/2005

Without this patch, the build fails with the error:
/home/john/debpic30/gcc/pic30-gcc-1.30/build_dir/src/gcc-3.3/gcc-3.3/gcc/cppinit.c: In function `path_include':
/home/john/debpic30/gcc/pic30-gcc-1.30/build_dir/src/gcc-3.3/gcc-3.3/gcc/cppinit.c:191: error: assignment of read-only location
--- gcc-3.3/gcc-3.3/gcc/cppinit.c~	2005-02-22 15:40:42.021322392 +1030
+++ gcc-3.3/gcc-3.3/gcc/cppinit.c	2005-02-22 15:43:29.178910576 +1030
@@ -55,7 +55,7 @@
    each path in the directory will be appended to the full pathname of the
    current driver executable */
 #ifdef DEFAULT_INCLUDE_PATH
-const char *executable_path_name;
+char *executable_path_name;
 extern char **save_argv;
 #endif
 
By John Steele Scott, 22/2/2005

Microchip delete all the testsuite subdirectories from their source archive,
so we have to take care not to run the tests.
--- gcc-3.3/gcc-3.3/libiberty/Makefile.in~	2005-02-22 13:24:48.340870232 +1030
+++ gcc-3.3/gcc-3.3/libiberty/Makefile.in	2005-02-22 13:27:52.249911808 +1030
@@ -103,7 +103,7 @@
 	"tooldir=$(tooldir)"
 
 # Subdirectories to recurse into. We need to override this during cleaning
-SUBDIRS = testsuite
+SUBDIRS =
 
 # FIXME: add @BUILD_INFO@ once we're sure it works for everyone.
 all: stamp-picdir $(TARGETLIB) needed-list required-list all-subdir

By John Steele Scott, 22/2/2005.

Without this patch, pic30-elf-gcc complains with:
pic30-elf-gcc: installation problem, cannot exec `pic30-elf-cc1': No such file or directory

--- gcc-3.3/gcc-3.3/gcc/config/pic30/pic30.h~	2005-02-22 16:30:58.686719544 +1030
+++ gcc-3.3/gcc-3.3/gcc/config/pic30/pic30.h	2005-02-22 16:53:56.587246824 +1030
@@ -210,14 +210,6 @@
 #undef	STARTFILE_SPEC
 #define	STARTFILE_SPEC	""
 
-/* making STANDARD_EXEC_PREFIX and STANDARD_BINDIR_PREFIX point to the same
-   directory will cause make_relative_paths to make no change - ie look in the 
-   gcc executable's directory.  */
-#undef STANDARD_EXEC_PREFIX
-#undef STANDARD_BINDIR_PREFIX
-#define STANDARD_EXEC_PREFIX "/bin"
-#define STANDARD_BINDIR_PREFIX "/bin"
-
 /* By default, the GCC_EXEC_PREFIX_ENV prefix is "GCC_EXEC_PREFIX", however
    in a cross compiler, another environment variable might want to be used
    to avoid conflicts with the host any host GCC_EXEC_PREFIX */
--- gcc-3.3/gcc-3.3/gcc/config/pic30/t-pic30~	2005-02-22 13:30:40.266369424 +1030
+++ gcc-3.3/gcc-3.3/gcc/config/pic30/t-pic30	2005-02-22 15:36:48.125879904 +1030
@@ -1,8 +1,7 @@
-LIBGCC1 = libgcc1.null
-CROSS_LIBGCC1 = libgcc1.null
-
-# forget the libgcc1...
-LIBGCC1_TEST =
-
-LIBGCC2 = libgcc1.null
+# Replacement t-pic30, by John Steele Scott
+# 22/2/2004
+# The original t-pic30 file from Microchip C30 1.30 has no effect, this one
+# lets the build succeed by disabling the libgcc target.
 
+LIBGCC = 
+INSTALL_LIBGCC = 

By John Steele Scott, 22/2/2005.

This changes the original to embed the version number corresponding to the
Microchip release, and to indicate that it is not an official version.

If this is to be redistributed by someone with the appropriate
infrastructure, the bug_report_url should of course be filled in.
--- gcc-3.3/gcc-3.3/gcc/version.c~	2005-02-22 15:56:56.652155984 +1030
+++ gcc-3.3/gcc-3.3/gcc/version.c	2005-02-22 16:12:22.286438184 +1030
@@ -9,7 +9,7 @@
    please modify this string to indicate that, e.g. by putting your
    organization's name in parentheses at the end of the string.  */
 
-const char version_string[] = "3.3 (dsPIC30, Microchip " version(MCHP_VERSION)
+const char version_string[] = "3.3 (dsPIC30, Microchip 1.30, modified for GNU/Linux" 
                               ") Build date: " __DATE__;
 
 /* This is the location of the online document giving instructions for
@@ -19,4 +19,4 @@
    forward us bugs reported to you, if you determine that they are
    not bugs in your modifications.)  */
 
-const char bug_report_url[] = "<URL:http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1423>";
+const char bug_report_url[] = "";

I also have debian/rules files modelled along the lines of the mingw-*
packages in Debian, if someone wants these they can email me.

cheers,

John


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]