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.
At this time, none of the code that calls functions in ROM builds. This is most likely a configuration error or I'm using the wrong code base. I'm still working this out.
Install Xcode (gcc) from the OS X install disc
Install or make sure MacPorts is up-to-date (as of 04/15/2010). Prior versions of MacPorts fetch an old version of openocd that doesn't work.
Install the cross compiler port (arm-elf-gcc 4.3.2 with interworking and newlib):
$ sudo port install arm-elf-gcc +interwork
Install these ports if you haven't already:
$ sudo port install curl git openocd
Install FTDI FT2232H VCP driver. When the FTDI device is plugged in, 2 new devices are available (your exact device name may vary):
/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:
sudo cpan Device::SerialPort
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) and most binaries get built
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.
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.
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