Lesson 1 - Getting Started
Setting up your hardware, getting started with Crossworks for ARM, and connecting to your board.
While you don't need to spend an absolute fortune to get started developing software for ARM microcontrollers like the LPC2148, you will need at least the following three items:
- A development board
- A JTAG debugger
- A software development suite
The Development Board
Your development board contains the microprocessor itself, along with various peripherals that can be used by your software (buttons, LEDs, USB and serial ports, etc.). While there are dozens of different LPC2148 development boards available, one of the more reasonably priced and popular ones is the Olimex LPC-P2148. We've chosen to use this board in some of these tutorials since it's affordable, has a wide-variety of on-board peripherals, and there are numerous open source projects on the web targetted at this particular board. Any development board with a standard JTAG connector should work, though (including our own LPC2148 Reference Design, which we'll also use in this series) ... just keep in mind that you will likely need to adjust the software to match your specific hardware layout when using LEDs, buttons, etc., if you are using a different board than us in a particular tutorial.
The JTAG Debugger
A JTAG debugger is a hardware device that sits between your PC and the development board, and allows you to transfer your compiled software to the microcontroller, as well as to 'debug' the software as it executes inside the microprocessor itself. You can use a JTAG debugger to start or stop anywhere in your code and to check the value assigned to different variables, helping you more easily find (and fix) problems in a user-friendly and efficient way.
While there are numerous JTAG devices that can be used with ARM microcontrollers -- we have at least six or seven different models here in the office -- we generally recommend the Olimex ARM-USB-OCD (seen in the first image below) since it represents an excellent value for the money and works with a variety of tools and IDEs, including Crossworks for ARM and OpenOCD. It also has the advantages of having a built in serial port and it can power many boards directly with it's 2.0mm DC cable, meaning two less peripherals cluttering your desk and workspace.
Software Development Suite
The software development suite (or toolchain) 'compiles' your C code into something that the microprocessor can understand. Ideally, the compiler you use should also have an IDE (Integrated Development Environment) that makes compiling, developing, deploying and testing your code as easy as possible.
There are a number of commercial open-source toolchains and IDEs available for ARM, including those made by IAR Systems and Keil. If you're just getting started, though, free is obviously good, so the open-source GCC is the natural choice for a toolchain/compiler. The main problem with GCC, however, is that it only exists as a suite of command-line tools, and it has no graphical interface to help you compile, deploy or test your code. While many professionals prefer to work from the command-line, the learning curve is fairly steep, and we recommend you start with a GCC-compatible IDE like Eclipse (open-source), or Rowley's Associate's GCC-based Crossworks for ARM (commercial).
While Eclipse has the (significant) advantage of being free, it's main drawback for people just getting started is that it isn't really a 'dedicated' ARM/embedded development platform, meaning that it needs to be configured for each 'environment' that you want to use it for. Given that this isn't always a trival task, the easiest way to get started with Eclipse is by downloading a pre-compiled and pre-configured version of Eclipse made with ARM development in mind. Yagarto (for 'Yet Another GNU ARM Toolchain') is one of the most common packages, and an excellent starting point. Certain development boards from Olimex also come with a pre-configured Eclipse-based GCC development environment called GCCFD (GCC For Dummies). Unfortunately, this isn't available for download on their website, and you will need to purchase a development board to gain access to it.
Having stated that free is good, ease of use (provided it's 'affordable') is even better. Our opinion is that Rowley's Crossworks for ARM, though commercial, is probably the easiest (or at least the 'least frustrating') means to get started in ARM development. It features a modern, dedicated development environment (somewhat resembling Visual Studio for those coming from a Windows development background) where you can easily compile, deploy and debug your applications with an absolute minimum of fuss and head-scratching. In general, you can be up and running in about 15 minutes with Crossworks for ARM and a compatible JTAG device (Crossworks 2.0 supports about a dozen JTAG debuggers, including the Olimex ARM-USB-OCD and it's less expensive cousin the ARM-OCD-TINY). A personal (non-commercial) license does costs $150, which isn't nearly as nice as 'free', but its a pleasure to use, and the time and frustration saved compared to other IDEs is probably money well spent. If you're simply curious, a free fully-functional 30-day demo is available from Rowley, which should allow you to determine if it's worth investing the $150, or if (after having gotten your feet wet), you prefer to go full open-source and stick with Eclipse.
Given that we want to make this learning process as easy as possible, we've decided to use the 30-day demo of Crossworks in this series of tutorials. To help you get started, we've put together a basic video showing how to install Crossworks for ARM 2.0, request your 30-day evaluation key, connect your JTAG debugger, and run your first program on the hardware itself (see the video below). In any case, this should be everything you need to get you ready for the next tutorial on making your microcontroller interact with the outside world via GPIO (General-Purpose Input/Output).