<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>WebLog Van Klinkenberg Software</title>
	<atom:link href="http://vanklinkenbergsoftware.nl/blog/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://vanklinkenbergsoftware.nl/blog</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Fri, 14 Aug 2009 20:00:26 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Compiling the C30 gcc compiler on Mac OS X (Leopard)</title>
		<link>http://vanklinkenbergsoftware.nl/blog/?p=3</link>
		<comments>http://vanklinkenbergsoftware.nl/blog/?p=3#comments</comments>
		<pubDate>Sun, 14 Dec 2008 14:40:21 +0000</pubDate>
		<dc:creator>bas</dc:creator>
				<category><![CDATA[Embedded software]]></category>
		<category><![CDATA[compiler]]></category>
		<category><![CDATA[dspic]]></category>
		<category><![CDATA[embedded]]></category>
		<category><![CDATA[microchip]]></category>
		<category><![CDATA[osx]]></category>

		<guid isPermaLink="false">http://vanklinkenbergsoftware.nl/blog/?p=3</guid>
		<description><![CDATA[Build script for compiling the C30 gcc compiler on OSX for Microchip dsPIC devices.]]></description>
			<content:encoded><![CDATA[<p><strong>UPDATE </strong>July 23, 2009: I&#8217;ve added a build transcript to the tarball so that you can compare your build output to mine, and also added the full path to sed in the script. Get it <strong><a href="/download/pic30_3.10_build_osx.tar.gz">here</a>.</strong></p>
<p>I switched to Mac a couple of years ago, but still find myself dependent on MS Windows for electronics and embedded software development. Fortunately more tools are getting available for Linux and hence Mac as well, which is good (AVR tools are a great example).</p>
<p>This week I&#8217;ve been fiddling with a dsPIC33 device from Microchip. It works fine in MPLAB (apart for the occasional crash or USB hang for the programmer) but I get tired of having to work with MS Windows. So I started searching for a C30 compiler for Mac. Unfortunately, I haven&#8217;t found (a free) one yet, but I discovered that the MPLAB C30 compiler is actually based on the gcc compiler, so it should be possible to make it work on OS X.</p>
<p>Microchip has published the gcc and binutils source code on their website (which they have to do due to the GPL) so that&#8217;s an easy start. After some googling I also found the debian packages made by John Steele Scott.</p>
<p>Compiling gcc and using the patches from the debian packages made me come close to a working compiler, but not completely. These were the problems I still had to address before getting a working compiler:</p>
<ul>
<li>binutils: I got configure errors due to the fact that conftest.dSYM directories were left in the way. Apparently this is due to a new default option with Xcode when compiling with debug option on. To fix it I would have to regenerate the configure files with a newer autoconf/automake.  Instead I solved it by compiling without the debug option (removed -g from the CFLAGS).</li>
<li>gcc: at startup gcc would crash in some internationalization init code. I solved this one by compiling with &#8211;disable-nls, which disables the internationalization in gcc. I think I can do without compiler warnings in dutch&#8230;</li>
<li>gcc: crash at startup in some default library path juggling code. I found out that gcc would start up without crashing when I moved it out of the install directory. Fixed it by patching out the offending code.</li>
<li>gcc: at install it would put double target strings in executable names (like pic30-elf-pic30-elf-gcc), fixed with an extra sed command after installing.</li>
</ul>
<p>The build script and patches are based on version 3.10 of the compiler and binutils.</p>
<p><strong>Download the build scripts and patches tar ball <a href="/download/pic30_3.10_build_osx.tar.gz">here</a>.</strong></p>
<p>Make sure you read the README file, it contains more info than written down here.</p>
<p>To build, you&#8217;ll need to do the following:</p>
<ol>
<li>Unpack the tar ball in a suitable location.</li>
<li>Get an installation of MPLAB C30 on a Windows machine. Find the MPLAB C30 directory in the MPLAB installation directory and zip it. Make sure the resulting zip file is named &#8220;MPLAB C30.zip&#8221; and copy it to the same directory as where the build script is located.</li>
<li>Download mplabalc30_v3_10.tar.gz (binutils) and mplabc30v3_10.tar.gz (gcc) from the MPLAB website. Look for the C30 compiler and then archived versions. Put the two tar.gz files in the same directory as where the build script is located.</li>
<li>Run the build script. It will unpack, patch, compile and install the files into the directory &#8220;install&#8221; (residing in the same directory as the build script).</li>
<li>Review the installation in the install directory. Now you can do three things: a. add the install directory to your path and call it a day, b. manually copy everything over to another place or c. change the PREFIX variable at the top of the build script and run it again (maybe you&#8217;ll need to sudo depending on the permissions in the PREFIX directory)</li>
</ol>
<p>Now the next challenge will be to incorporate it into Xcode&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://vanklinkenbergsoftware.nl/blog/?feed=rss2&amp;p=3</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
	</channel>
</rss>
