diff options
Diffstat (limited to 'docs/source/unix-toolchain.rst')
-rw-r--r-- | docs/source/unix-toolchain.rst | 73 |
1 files changed, 34 insertions, 39 deletions
diff --git a/docs/source/unix-toolchain.rst b/docs/source/unix-toolchain.rst index b595f70..e6039a2 100644 --- a/docs/source/unix-toolchain.rst +++ b/docs/source/unix-toolchain.rst @@ -32,20 +32,16 @@ GCC compiler tools <http://www.codesourcery.com/sgpp/features.html>`_ please post in the forums, so we can fold your tips into this document! -* :ref:`Linux setup <toolchain-linux-setup>` -* :ref:`OS X setup <toolchain-osx-setup>` -* :ref:`Test compilation <toolchain-test>` -* :ref:`Upload a program <toolchain-upload>` -* :ref:`Communicate over USB-serial interface <toolchain-serialusb>` -* :ref:`Starting your own projects <toolchain-projects>` -* :ref:`Debug with OpenOCD <toolchain-openocd>` -* :ref:`Do it all with Code::Blocks <toolchain-codeblocks>` -* :ref:`Go forth exuberantly! <toolchain-exuberantly>` +.. contents:: Contents + :local: .. _toolchain-linux-setup: -Linux Setup ------------ +Setup +----- + +Linux +^^^^^ These instructions are oriented towards Linux users using a contemporary Debian-based distribution. @@ -55,7 +51,7 @@ contemporary Debian-based distribution. First I'll give the commands to run, then explain:: $ sudo aptitude install build-essential git-core wget screen dfu-util \ - openocd python python-serial + openocd python python-serial You'll want to install a bunch of developer "basics" like :command:`make`, :command:`tar`, etc. A good catch-all for these @@ -90,23 +86,23 @@ package; this could also be installed with `easy_install **2. Fetch libmaple and Compiler Toolchain** :: - $ cd ~ - $ git clone git://github.com/leaflabs/libmaple.git libmaple - $ cd libmaple + $ cd ~ + $ git clone git://github.com/leaflabs/libmaple.git libmaple + $ cd libmaple $ wget http://static.leaflabs.com/pub/codesourcery/gcc-arm-none-eabi-latest-linux32.tar.gz $ tar xvf arm-*-linux32.tar.gz - $ export PATH=$PATH:~/libmaple/arm/bin # or wherever these tools ended up + $ export PATH=$PATH:~/libmaple/arm/bin # or wherever these tools ended up This step is fairly straightforward: do a git clone of the `libmaple repository <http://github.com/leaflabs/libmaple>`_ to some directory, then download and extract the ARM compiler toolchain. -The :file:`arm/bin/` directory will need to be added to -:envvar:`PATH`; you can check that this worked by entering -``arm-none-`` and hitting tab to auto-complete (bash should show a -bunch of results). Regardless of where you put the toolchain, make -sure to preserve its internal directory layout, as the binaries make -relative path calls and references. +The :file:`arm/bin/` directory will need to be added to ``PATH``; you +can check that this worked by entering ``arm-none-`` and hitting tab +to auto-complete (bash should show a bunch of results). Regardless of +where you put the toolchain, make sure to preserve its internal +directory layout, as the binaries make relative path calls and +references. .. _toolchain-udev: @@ -114,9 +110,9 @@ relative path calls and references. From the libmaple directory, :: - $ groups # make sure it includes plugdev; if not add, yourself to it - $ sudo cp support/scripts/45-maple.rules /etc/udev/rules.d/45-maple.rules - $ sudo /etc/init.d/udev restart + $ groups # make sure it includes plugdev; if not add, yourself to it + $ sudo cp support/scripts/45-maple.rules /etc/udev/rules.d/45-maple.rules + $ sudo /etc/init.d/udev restart As a security precaution on linux, unknown USB devices can only be accessed by the superuser. This udev script identifies the Maple based @@ -132,8 +128,8 @@ Great! Test your setup by :ref:`compiling a sample program .. _toolchain-osx-setup: -OS X Setup ----------- +OS X +^^^^ These instructions have been tested successfully on OS X 10.6.4. As stated previously, this document assumes a general level of Unix @@ -180,12 +176,12 @@ You will need the following tools to get started: :file:`/Applications/OpenMoko Flasher.app/Contents/Mac OS/dfu-util` To get access to it from the command line, just make a symbolic link - to the binary from some place on your :envvar:`PATH`:: + to the binary from some place on your ``PATH``:: $ ln -s /Applications/OpenMoko\ Flasher.app/Contents/Mac\ OS/dfu-util \ /somewhere/on/your/PATH/dfu-util - .. note:: + .. note:: Just copying the binary somewhere doesn't work, as it relies on dynamically linked libraries found elsewhere in the .app bundle. It's possible to pull just the relevant pieces out of the @@ -245,7 +241,7 @@ live with :: $ export PATH=$PATH:~/libmaple/arm/bin After that's done, you'll probably want to update your shell startup -script so :file:`~/libmaple/arm/bin` stays in your :envvar:`PATH`. +script so :file:`~/libmaple/arm/bin` stays in your ``PATH``. **So far, so good?** @@ -354,8 +350,8 @@ Starting your own projects -------------------------- So everything worked, and you want to start your own project? Great! -It's easy. Just set the environment variable :envvar:`LIB_MAPLE_HOME` -in your shell startup script to point to the libmaple repository you +It's easy. Just set the environment variable ``LIB_MAPLE_HOME`` in +your shell startup script to point to the libmaple repository you cloned (this tutorial assumes you put it in :file:`~/libmaple`). For example, if you use bash as your shell, just put this line in your :file:`~/.bashrc` or :file:`~/.bash_profile`:: @@ -421,12 +417,11 @@ but it might be helpful for people who are allergic to `vim <http://www.gnu.org/software/emacs/>`_. The simple configuration described here just calls down to the :file:`Makefile`, so follow the above directions to get the command line tools configured (you'll -definitely need the arm-none-eabi-* tools on your :envvar:`PATH`), -then `install Code::Blocks -<http://www.codeblocks.org/downloads/26>`_. You can do this on Linux -with:: +definitely need the arm-none-eabi-* tools on your ``PATH``), then +`install Code::Blocks <http://www.codeblocks.org/downloads/26>`_. You +can do this on Linux with:: - $ sudo aptitude install codeblocks + $ sudo aptitude install codeblocks The first time it runs you'll maybe want to disable all the glitzy "Getting Started" crap (when will they learn?). We've added a .cbp @@ -438,8 +433,8 @@ to get a feel for how it all works. To create your own "libmaple" project, start with an "Empty Project" with the "Folder to create project in" set to your -:envvar:`LIB_MAPLE_HOME`. Make sure that the "Resulting filename" is -in the top level directory as well. +``LIB_MAPLE_HOME``. Make sure that the "Resulting filename" is in the +top level directory as well. .. image:: /_static/img/codeblocks_newproject.png :align: center |