ARM Semi-Technomagery

Text

Getting the code to compile…

A repost from my other blog from before I started this one.

I have the MP3 development board from SparkFun working… when I got it, it didn’t work and I sort of left it for a while due to some other events going on. I pulled it out of storage recently, charged it, started messing with it, and after tweaking the LCD I was greeted with the SFE boot logo which I had not yet seen!

One of the things that had been a major roadblock in ARM development for me was getting ARM support working under linux. It’s important to note in this case that I hate Eclipse. If I’m going to use an IDE, I prefer Sun’s Netbeans. Don’t ask why, I just like it. Everything I saw was for getting the gcc-arm toolchain working (mostly under windows) in Eclipse. So I set out to figure it out.

For the record: I am using Linux 2.6.31-16-generic x86_64 in Ubuntu 9.10 on my laptop. I will soon double check these instructions (and edit the post so the information stays in one place) on my Gentoo desktop running Linux 2.6.31-gentoo-r6 x86_64.

The first thing I did was to get the gnu-arm toolchain from http://www.gnuarm.com. Under files you will find a binaries section. Grab the latest version for your operating system (i.e. since I use x86_64, I downloaded this file. For myself, I chose to unpack it to ${HOME}/gcc-arm (so that gcc is in ${HOME}/gcc-arm/bin).

Now the source code took some editing — I’m not sure if some of the Windows IDEs, being as how NTFS is not case sensitive, didn’t mind the case of some of the include files being wrong. I also had to change the Makefile from

----------------------------------

# Define directories, if needed.

##DIRARM = c:/WinARM/

## DIRARMBIN = $(DIRAVR)/bin/

## DIRAVRUTILS = $(DIRAVR)/utils/bin/

# Define programs and commands.

SHELL = sh

CC = arm-elf-gcc

CPP = arm-elf-g++

OBJCOPY = arm-elf-objcopy

OBJDUMP = arm-elf-objdump

SIZE = arm-elf-size

NM = arm-elf-nm

REMOVE = rm -f

COPY = cp

----------------------------------

to

----------------------------------

# Define directories, if needed.

DIRARM = /home/user/gcc-arm

DIRARMBIN = $(DIRARM)/bin

DIRAVRUTILS = $(DIRARM)/utils/bin/

# Define programs and commands.

SHELL = sh

CC = $(DIRARMBIN)/arm-elf-gcc

CPP = $(DIRARMBIN)/arm-elf-g++

OBJCOPY = $(DIRARMBIN)/arm-elf-objcopy

OBJDUMP = $(DIRARMBIN)/arm-elf-objdump

SIZE = $(DIRARMBIN)/arm-elf-size

NM = $(DIRARMBIN)/arm-elf-nm

REMOVE = rm -f

COPY = cp

----------------------------------



Remember to change the DIRARM to include the actual location of the gcc-arm toolchain.


Now in netbeans, it was fairly easy to set up a gcc-arm profile. Under Tools->Options->C/C++. Add a new profile, the base directory should be the gcc-arm/bin/ directory, and fill in the appropriate binaries.


The hardest part was editing the headers and Makefile. Once that was taken care of, everything compiled fine. Just to quickly test the firmware, I changed the playlist title to “technomage musicbox” and started rocking out to YTCracker’s “I Am A Pirate,” which I should have put on his “I Did It My Way” (both tracks are off the Serious Business EP).

the code change compiled!


Hopefully other people will find this useful.

Posted on Monday, January 4 2010. Tagged with: LPC2148
ARM Semi-Technomagery Tales of my experiences hacking the SparkFun MP3 development board (http://is.gd/5LwHh).

This is useful as a project to learn how to deal with ARM hardware interfacing, SD cards, LCDs, and getting a bunch of parts talking to each other.
Previous Next