darconeous edited this page Feb 14, 2013 · 3 revisions

Introduction

The following notes explain how to setup a Mac running OS X to build libmc1322x. My work focuses on the EconoTAG, your target may vary.

At this time, development on a Mac is pretty raw. No IDE, no OpenEmbedded, no bitbake, just command line tools: the compiler and the bootloader communication tool.

First Steps

  • Install Xcode (gcc) from the Mac App Store

  • Install FTDI's FT2232H VCP driver. When the FTDI device is plugged in, 2 new devices are available (your exact device name may vary based on which USB port you are using):

    /dev/tty.usbserial-000030FDA     # This is jtag device
    /dev/tty.usbserial-000030FDB     # This is MC1322X's UART1
    
  • Install the Device::SerialPort Perl module used by tools/mc1322x-load.pl{.docutils .literal}:

    sudo cpan Device::SerialPort
    

Getting the Toolchain: Homebrew

You can get the most up-to-date and well-tested toolchain via homebrew:

  • Install homebrew if you haven't already.
  • Make sure your homebrew installation is up-to-date: brew update
  • Add a tap to darconeous/embedded: brew tap darconeous/embedded
  • Install libftdi: brew install libftdi
  • Install OpenOCD: brew install open-ocd
  • Install the Code Sourcery arm-2008q3 toolchain: brew install arm-2008q3-gcc

libmc1322x

  • Obtain the library source from the git repository:

    $ git clone git://git.devl.org/git/malvira/libmc1322x.git
    
  • Edit the makefile to use the proper toolchain (and make a backup of the original):

    $ cd libmc1322x
    $ sed -i .bak 's/arm-linux/arm-elf/g' Makefile.include
    
  • Build for your target:

    $ cd tests
    $ make BOARD=redbee-econotag
    
  • There are build errors, but the library (../src/libmc1322x.a{.docutils .literal}) and most binaries get built

Loading a binary into RAM

  • The EconoTAG has a bootloader that works over the serial port. The command line tool to load binaries into RAM is tools/mc1322x-load.pl{.docutils .literal}.

  • Use the command line below and when you see periods, press the target's RESET button:

    $ ../tools/mc1322x-load.pl -f blink-green_redbee-econotag.bin -t /dev/tty.usbserial-000030FDB
    ..............................
    ........CONNECT
    Size: 2520 bytes
    Sending blink-allio_redbee-econotag.bin
    done sending files.
    

Open OCD

  • Get the OpenOCD config file for mc1322x:

    $ curl -G http://mc1322x.devl.org/files/openocd.cfg > openocd.cfg
    
  • Plug your target device into USB port

  • Run OpenOCD:

    $ openocd
    Open On-Chip Debugger 0.4.0 (2010-04-13-21:34)
    Licensed under GNU GPL v2
    For bug reports, read
        http://openocd.berlios.de/doc/doxygen/bugs.html
    srst_only separate srst_gates_jtag srst_open_drain
    jtag_ntrst_delay: 200
    2000 kHz
    Info : max TCK change to: 30000 kHz
    Info : clock speed 2000 kHz
    Info : JTAG tap: mc13224.cpu tap/device found: 0x1f1f001d (mfg: 0x00e, part: 0xf1f0, ver: 0x1)
    Info : Embedded ICE version 7
    Error: EmbeddedICE v7 handling might be broken
    Info : mc13224.cpu: hardware has 2 breakpoint/watchpoint units
    
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.