Hammer Getting Started

From eLinux.org
Revision as of 18:04, 2 June 2008 by Robotguy (talk | contribs) (Setting up Buildroot and Building a Toolchain)
Jump to: navigation, search

Getting Started with the Hammer_Board


Starting out with a new microcontroller can be daunting and very overwhelming. I've experienced this feeling as I start out with embedded systems using ARM7 (NXP LPC2148) and ARM9 (Hammer, Samsung S3C2410A) microcontrollers. So here is a tutorial on how to get started with Hammer.

Hammer runs full Linux with kernel 2.6.22 or later. To start out with Hammer, All development tools are available for Linux only at this time, so it is expected that you already have experience with Linux. If you don't have experience with Linux, you will need to start learning it if you want to do serious work with embedded systems like Hammer. Get one of the LiveCDs that many Linux Distributions are offering now, such as Knoppix, Kubuntu, Ubuntu, etc

I strongly suggest getting the complete Hammer Kit.I know it is more expensive than just getting a Hammer by itself, but believe me, you will be thankful for getting the whole kit. There will not be any other parts you will need to purchase. The kit is complete, and even includes a wall power supply. You also get the Flyswatter JTAG unit, which can also be used with other ARM7/ARM9 processors wth the appropriate cable. With other processors, I have always had to piece things together to get everything I need, but this is not true with the Hammer Kit - everything you need is included and guaranteed to be compatible with the Hammer in all ways.

You will also find more information and tutorials on the official Hammer Wiki, which is a work in progress.

Hammer comes preprogrammed with Linux and kernel 2.6.22 or later, so you will be able to do some stuff right out of the box.

So, let's get started!

1) Unpack your Hammer Kit and inventory the contents to besure you have everything.

You should have the following:

   * Hammer: Samsung S3C2410A ARM9 CPU board in a 40-pin DIP package.
   * Hammer Carrier: prototyping board designed for use with the Hammer CPU board.
   * Flyswatter: USB based JTAG programmer for the Hammer CPU board.
   * 5V@1A Power Supply: 5V power supply for the Hammer Carrier board.
   * USB Cable A to B: USB cable for the Flyswatter.
   * RS232 Serial Cable – serial cable to connect the Hammer Carrier to a PC/terminal
   * JTAG ribbon cable (14 pin - 2 x 7, length = 8 inches)
   * Hammer Kit CD.

2) Connect the AC adapter to a power outlet and plug the barrel connector on the other end into the Hammer Carrier. The power light on the board should light up. If the power light doesn't light up, unplug everything very quickly!

3) Connect the included RS-232 serial cable from a serial port on your PC to the DB9 connector on the Hammer Carrier Board. The default speed is 115200 Bps, 8 bits, no parity, so make sure your PC serial port is setup properly.

4) Press CR (RETURN) on your keyboard and you should get a "Hammer login:" prompt.

If you do not see the "Hammer login: prompt, there is something wrong and some basic troubleshooting will be required.

5)There are no password protected accounts so just enter "root" and press CR to login. You should now be logged in to Hammer.

6) Enter "ls -l" (no quotes) and press CR (RETURN or ENTER) on your keyboard. You should see a directory listing.

Once you have a connection with Hammer, you can use basic Linux commands. You won't be able to do a lot with Hammer at this point because you have not configured it for what you want to do. This will be covered in later pages.

I hope this helps you get started with Hammer, and I will update this as required to clarify any points that are not clear.

Setting up Buildroot and Building a Toolchain

Now things get interesting. The software development environment we use for Hammer is called Buildroot. Here is how to go about setting Buildroot up.

1) Download the latest Buildroot archive (Buildroot-01082008.tar.gz currently) from the software section. This is the ONLY version of Buildroot officially supported by TinCanTools.

2) Find a place on your hard drive with plently of storage available. Buildroot has hard coded paths, so you can't move it around after you have built a toolchain with it. It has to stay where you put it, unless you rebuild everything.

3) Unarchive the Buildroot archive using the command tar -zxvf Buildroot-01082008.tar.gz. This archive has subdirectories so you will end up with a buildroot directory.

4) Do

cd <your new buildroot dir>
cp Hammer-config .config
make oldconfig

5) Do make menuconfig

You'll see the following:


6) Select Toolchain Options and you get the following screen:


7) There are a couple of options you need to set on this screen.

Select the following options:

C++ cross-compiler support
Build/install c++ compiler and libstdc++
Build/install a shared libgcc

This will give you a full C/C++ toolchain with shared libraries and libstdc++.

8) Exit and save your configuration

9) Do make

to start building your toolchain. This can take awhile, depending on how fast your PC is and how much memory is in it (faster and more RAM is better).

After this is all done, if you didn't get any errors, you will have a good toolchain.

10) You must add the path to your toolchain to the front of your path. Add <Path to buildroot>/buildroot/build_arm/staging_dir/bin to the front of your PATH. This ensures the toolchain will be found when building software for Hammer.

I use a command in my ~/.bashrc something like PATH=<Path to buildroot>/buildroot/build_arm/staging_dir/bin:$PATH

This covers the basics of getting started with Hammer. Future tutorials will go into greater detail and be more advanced.