Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Since this answer became a little bit "unreadable", I created a page with this info.</p> <ul> <li><a href="http://fun-tech.se/stm32/gcc/index.php" rel="noreferrer">http://fun-tech.se/stm32/gcc/index.php</a></li> </ul> <hr> <hr> <p>This is a free interpretation based on these two guides, but I had to change versions and apply some patches to get it to work.</p> <ul> <li><a href="http://eluaproject.dreamhosters.com/en/Building_GCC_for_Cortex" rel="noreferrer">http://eluaproject.dreamhosters.com/en/Building_GCC_for_Cortex</a></li> <li><a href="http://www.esden.net/blog/2009/02/26/how-to-build-arm-gnu-gcc-toolchain-for-mac-os-x/" rel="noreferrer">http://www.esden.net/blog/2009/02/26/how-to-build-arm-gnu-gcc-toolchain-for-mac-os-x/</a></li> </ul> <h2>First some basic stuff</h2> <pre><code>sudo apt-get install flex bison libgmp3-dev libmpfr-dev autoconf texinfo build-essential </code></pre> <p>Then I created a place to store the toolchain (change cj.users to whatever is good for you).</p> <pre><code>export TOOLPATH=/usr/local/cross-cortex-m3 sudo mkdir /usr/local/cross-cortex-m3 sudo chown cj.users /usr/local/cross-cortex-m3 </code></pre> <h2>Binutils</h2> <pre><code>wget http://ftp.gnu.org/gnu/binutils/binutils-2.19.tar.bz2 tar -xvjf binutils-2.19.tar.bz2 cd binutils-2.19 mkdir build cd build ../configure --target=arm-none-eabi --prefix=$TOOLPATH --enable-interwork --enable-multilib --with-gnu-as --with-gnu-ld --disable-nls </code></pre> <p>Apply patch to tc-arm.c according this info <a href="http://sourceware.org/bugzilla/show_bug.cgi?id=7026" rel="noreferrer">http://sourceware.org/bugzilla/show_bug.cgi?id=7026</a> / <a href="http://sourceware.org/bugzilla/attachment.cgi?id=3058&amp;action=view" rel="noreferrer">http://sourceware.org/bugzilla/attachment.cgi?id=3058&amp;action=view</a></p> <pre><code>vi ../gas/config/tc-arm.c make make install export PATH=${TOOLPATH}/bin:$PATH cd ../.. </code></pre> <h2>gcc</h2> <pre><code>wget ftp://ftp.sunet.se/pub/gnu/gcc/releases/gcc-4.3.4/gcc-4.3.4.tar.bz2 tar -xvjf gcc-4.3.4.tar.bz2 cd gcc-4.3.4 mkdir build cd build ../configure --target=arm-none-eabi --prefix=$TOOLPATH --enable-interwork --enable-multilib --enable-languages="c,c++" --with-newlib --without-headers --disable-shared --with-gnu-as --with-gnu-ld make all-gcc make install-gcc cd ../.. </code></pre> <h2>Newlib</h2> <pre><code>wget ftp://sources.redhat.com/pub/newlib/newlib-1.17.0.tar.gz wget http://www.esden.net/content/embedded/newlib-1.14.0-missing-makeinfo.patch tar -xvzf newlib-1.17.0.tar.gz cd newlib-1.17.0 </code></pre> <p>Then I would like to apply the patch with something like this (but it did not work)</p> <pre><code>patch -p1 -i ../newlib-1.14.0-missing-makeinfo.patch </code></pre> <p>So I opened it manually and edited line 6651 according to the patch.</p> <pre><code>vi configure mkdir build cd build ../configure --target=arm-none-eabi --prefix=$TOOLPATH --enable-interwork --disable-newlib-supplied-syscalls --with-gnu-ld --with-gnu-as --disable-shared make CFLAGS_FOR_TARGET="-ffunction-sections -fdata-sections -DPREFER_SIZE_OVER_SPEED -D__OPTIMIZE_SIZE__ -Os -fomit-frame-pointer -mcpu=cortex-m3 -mthumb -D__thumb2__ -D__BUFSIZ__=256" CCASFLAGS="-mcpu=cortex-m3 -mthumb -D__thumb2__" make install cd ../.. </code></pre> <h2>More gcc</h2> <pre><code>cd gcc-4.3.4/build make CFLAGS="-mcpu=cortex-m3 -mthumb" CXXFLAGS="-mcpu=cortex-m3 -mthumb" LIBCXXFLAGS="-mcpu=cortex-m3 -mthumb" all make install </code></pre> <h2>Sum up</h2> <p>Now I just added some paths to my ~/.bashrc</p> <pre><code>#STM32 gcc... export TOOLPATH=/usr/local/cross-cortex-m3 export PATH=${TOOLPATH}/bin:$PATH </code></pre> <p>And I should be ready for the next step...</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload