{"id":731,"date":"2010-02-05T20:06:58","date_gmt":"2010-02-06T01:06:58","guid":{"rendered":"http:\/\/sahd.lamafam.org\/?p=731"},"modified":"2010-02-05T20:06:58","modified_gmt":"2010-02-06T01:06:58","slug":"arm-cross-compiler","status":"publish","type":"post","link":"https:\/\/sahd.lamafam.org\/?p=731","title":{"rendered":"ARM Cross-Compiler"},"content":{"rendered":"<p>With the new server, I had to rebuild my cross compiler for arm projects.   Luckily, such a thing is documented reasonably well over at   <a href=\"http:\/\/www.gnuarm.com\">gnuarm.com<\/a> so I was able to get things moving along   without too much fuss.  Although it took a little doing to find the right   combination of versions to compile properly.  I&#8217;m not sure why the most   up-to-date stuff doesn&#8217;t work as expected, but there it is.<\/p>\n<p><!--more--><\/p>\n<p>The process really is straight forward: build the assembler and object   manipulation tools (binutils), build a bootstrapped gcc so that newlib can in   turn be built, finally finish the gcc build.<\/p>\n<p>My weapones of choice:<\/p>\n<ul>\n<li>     binutils-2.19 <\/li>\n<li>     gcc-4.3.2 <\/li>\n<li>     newlib-2.17 <\/li>\n<\/ul>\n<p>For the sake of honesty, I also tried newlib-2.16 and newlib-2.18.  The above   combination was the one that finally delivered the goods.  Onto the build   process.  If installing the tools into a home directory or something world   writable, then the make command <code>make all install<\/code> will suffice.  I installed   everything into <code>\/usr\/local<\/code> so I had to switch to root to run <code>make install<\/code>.<\/p>\n<p>Binutils is easy:<\/p>\n<pre><code>configure --target=arm-elf --program-prefix=arm-elf- --enable-interwork --enable-multilib\n          --with-float=soft --disable-nls\n<\/code><\/pre>\n<p>Then just run <code>make<\/code> as appropriate.  If locating binutils somewhere special, add   a <code>--prefix=\/path\/to\/bintutil<\/code> option to the above configure command.  If using   this option now, be sure to add this option to all of the following configure   commands.<\/p>\n<p>Next, gcc:<\/p>\n<pre><code>configure --target=arm-elf --program-prefix=arm-elf- --enable-language=c --enable-interwork\n          --enable-multilib --disable-nls --disable-shared --disable-libssp --disable-libjava\n          --disable-libada --disable-zlib --disable-libgfortran --with-newlib\n          --with-headers=\/path\/to\/newlib-1.17.0\/newlib\/libc\/include\n<\/code><\/pre>\n<p>I suppose it doesn&#8217;t hurt to bring along some of those extra language features,   but I don&#8217;t need them and I figured it would cut down on compile and link time.   Also, if compiling for arm7 then make sure to edit the <code>t-arm-elf<\/code> file in   <code>gcc\/config\/arm<\/code>.  Basically, uncomment everything related to arm7.  Missing   this is a bummer because when a project needs interwork, none of the standard   libraries will support it.  The project may well build and link, but there will   be tons of cryptic warnings about interwork not being supported made all the   more mystifying when examining the command line and finding stuff like   <code>--enable-interwork<\/code> there.  Those commented lines in <code>t-arm-elf<\/code> are why.<\/p>\n<p>For this build step, run<\/p>\n<pre><code>make all-gcc\n<\/code><\/pre>\n<p>and<\/p>\n<pre><code>make install-gcc\n<\/code><\/pre>\n<p>for a bootstrapped version of gcc so that newlib can be built.<\/p>\n<p>Onto newlib:<\/p>\n<pre><code>configure --target=arm-elf --enable-languages=c --enable-interwork --enale-multilib\n          --disable-nls\n<\/code><\/pre>\n<p>Run <code>make<\/code> to build it.  Finally, go back to gcc and run a normal <code>make<\/code> process to   finish the build.<\/p>\n<p>I think most of the options are self explanatory.  The <code>disable-nls<\/code> option has   to do with language support and locales- not really necessary for embedded   work.  The <code>disable-shared<\/code> has to do with the cross-compiler executables and how   they are linked- statically when disabled, dynamically when enabled.  The size   of the executable is smaller for dynamically linked compilers. (Again, I&#8217;m not   talking about target executables.)  I&#8217;m not sure what the answer is here for   preference.<\/p>\n<p>I&#8217;ve seen other instructions, but these worked for me.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>With the new server, I had to rebuild my cross compiler for arm projects. Luckily, such a thing is documented reasonably well over at gnuarm.com so I was able to get things moving along without too much fuss. Although it took a little doing to find the right combination of versions to compile properly. I&#8217;m [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[42,41],"tags":[43,44],"class_list":["post-731","post","type-post","status-publish","format-standard","hentry","category-arm","category-embedded","tag-arm-elf-gcc","tag-toolchain"],"_links":{"self":[{"href":"https:\/\/sahd.lamafam.org\/index.php?rest_route=\/wp\/v2\/posts\/731","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sahd.lamafam.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sahd.lamafam.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sahd.lamafam.org\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/sahd.lamafam.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=731"}],"version-history":[{"count":0,"href":"https:\/\/sahd.lamafam.org\/index.php?rest_route=\/wp\/v2\/posts\/731\/revisions"}],"wp:attachment":[{"href":"https:\/\/sahd.lamafam.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=731"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sahd.lamafam.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=731"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sahd.lamafam.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=731"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}