Skip to content

TimStrunck/gcc-sam3u-build

 
 

Repository files navigation

A gcc build setup for the SAM3U-EK board
Pat Hickey
Feb 2012

CONTENTS

 * Atmel at91lib Softpak 1.6
   * files in boards/ deleted except for boards/at91sam3u-ek
   * components/ deleted
 * openocd.cfg script for sam3u-ek board and Segger/Atmel SAM-ICE jtag debugger
 * simple: a program to test your build & debugging environment

LICENSE

 * The Atmel at91lib software license has a liberal redistributable license
   provided at at91lib/at91lib.dir
 * Datasheets in docs/ are copyright Atmel
 * All software written by Pat Hickey is placed in the public domain.

REQUIRMENTS

* arm-none-eabi gcc toolchain from CodeSourcery/Mentor
  https://sourcery.mentor.com/sgpp/lite/arm/portal/release2032

  With the arm-none-eabi toolchain in your path, you should be able
  to build simple.elf by just running 'make' in the simple/ directory.

* openocd 0.6 Development HEAD : http://sourceforge.net/projects/openocd/
  The openocd 0.5.0 release does not work properly with the SAM3U. You'll
  need to checkout and build openocd from sources. This requires automake
  libtool, autoconf, and libinfo to be installed on your system.
  When using a repository checkout, autoconf needs to be bootstrapped:
  $ ./bootstrap
  If you're using a Segger/Atmel SAM-ICE jtag debugger, build with:
  $ ./configure --enable-jlink
  $ make
  $ sudo make install

  Other jtag debugger hardware requires specific options to ./configure - see
  the openocd readme for more options.

  You'll probably need to install libusb-dev (apt-get/ubuntu)
  or libusb-devel (yum/fedora) first.
  * openocd.cfg file included in repository root 

  To see openocd connects to the chip:
  * Run openocd from a terminal at repository root (openocd.cfg present)
  * In another terminal,
    $ telnet localhost 4444
  * In telnet session, the following commands will flash the chip with the
    program built in the simple/ directory:
    > halt
    > flash write_image simple/simple.elf
    > reset run
    > exit
  * There seem to be issues with using "reset halt" to reset the SAM3 target.
    To reset the whole chip, write directly to the AIRCR system register
    with "mww 0xE000ED0C 0x05FA0007"
    For more info, see Section B.2.6 of the ARMv7-M Architecture Reference
    Manual.

  To use openocd to load simple.elf:
  * As before, run openocd from a terminal at the repository root
  * In another terminal in simple/, run $ arm-none-eabi-gdb simple.elf
  * In gdb: (gdb) target remote :3333
            (gdb) monitor halt
            (gdb) load
            (gdb) break main
            (gdb) continue
            ...
            Breakpoint 1, main () at simple.c:...
            (gdb) continue
  * If gdb refuses to connect, follow the instructions above to connect to
    openocd via telnet, use just the "halt" command, then exit telnet. After
    that gdb should connect fine.

RESOURCES

Build flags based on Atmel Application Note "Getting started with SAM3U Microcontrollers" (http://www.atmel.com/Images/doc11020.pdf)

SAM3U family datasheet, SAM3U-EK user guide included in docs/

About

Build scripts for sam3u w/ at91lib 1.6 using arm-none-eabi-gcc

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 72.8%
  • C++ 25.7%
  • Assembly 1.3%
  • Makefile 0.2%