Hammer Getting Started
There are a few things you will have to understand to build software for Hammer. There are several parameters that interact and control space allocated to various things, such as the kernel and rootfs in flash, how much of the flash the kernel is aware of, and how the loader (APEX) handles things. If these parameters are not set correctly, you will get odd errors at boot time. Some of these messages are not particularly helpful!
Here is where these parameters will be shown, where they are found, and what they do. More information will be added here as I understand these interactions.
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, Fedora, 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 Board in all ways.
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.
Let's get started!
1) Unpack your Hammer Kit and inventory the contents to be sure 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.
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.
cd <your new buildroot dir> cp Hammer-config .config make oldconfig
You'll see the following:
6) Select "Toolchain Options", press ENTER, and you get the following screen:
7) There are some options you need to make sure are 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
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
Building a Custom Kernel
The first thing you will probably want to do after you have your toolchain built is to build a custom kernel that will have just the drivers enabled you need for your application. Contrary to popular belief, it is not that difficult to build a custom kernel. There are a few settings in various places that do come into play and affect whether things work properly though.
<To Be Continued>
OpenOCD is the software we use to program the bootloader (APEX), the kernel, and the initrd into a Hammer.
<To Be Continued>
Creating a Custom INITRD
<To Be Continued>