CW4ARM & EA-LPC2478
Introduction
Hardware
Download and install
Create project
Add your files
Compile
Memory Usage
Symbol Browser
Start Debugging
Support
Download
 

Introduction

This is a small tutorial which shows you how to setup a project for the Embedded Artists LPC2478 OEM Board with CrossWorks for ARM.

What is CrossWorks for ARM?

CrossWorks for ARM is a complete C/C++ and assembly code development system for ARM7, ARM9, XScale, and Cortex-M3 microcontrollers.

For this example I used the following components:

Hardware

For the LPC2478Test project and debugging on the target, the following hardware was used:

This is the LPC2478 QVGA OEM Board from Embedded Artists, which is equipped with a LPC2478 cpu.

Download and install

It is required that you already have installed and activated the CrossWorks for ARM compiler.

The LPC2478 QVGA OEM Board is equipped with a LPC2478 cpu. Therefore you need the CrossWorks for ARM Support Packages for the NXP LPC2000 cpu. You will find it here. Follow the package installation instruction on this page.

After this, you'll need the Support Packages for the Embedded Artists board too.
To install this support packages into CrossWorks for ARM:

  1. Download EA_LPC2478_OEM_SDRAM.hzq
  2. Click the Tools > Install Package menu option (in CrossWorks for ARM).
  3. Select the EA_LPC2478_OEM_SDRAM.hzq file in the file browser.
  4. Click the Install button to install the package.

You have installed all the needed packages and we will check the result. Therefore use "Tools > Show Installed Packages" and the result should looks like:

(Click inside the picture to expand)

Create project

Now we will create a project for the Embedded Artists board. Therefore download this example and extract the zip file in the following folder: c:\temp\LPC2478Test. You will find three folders after expanding the zip file: inc, prj and src.

Inside CrossWorks use "File > New > New Project...", a new dialog will open.

For Location use your path for the project, in this example c:\temp\LPC2478\prj. And for Name we will use the project name LPC2478Test. After this you must select the Project Type. Select Embedded Artists LPC2478 OEM here, and for the Template use Executable. The window should look like:

Press "OK" and the next window will look like:

The window above shows some project settings. We don't want to change anything, press "Next >". The next window will show which files are added by default to your project. It will loook like:

Again press "Next >" and you will come to the configuration window. Here you can select which modes your project can be build for. For example you can deselect all the ARM modes in case you only want to build for THUMB mode. But here do not deselect anything. The window will look like:

After pressing "Finish" the LPC2478Test project was created. The CrossWorks window will look like:

(Click inside the picture to expand)

If you can not find the "Memory Usage" and "Symbol Browser" into the "Project Explorer" you can add it by pressing "Ctrl+Alt+Y" and "Ctrl+Alt+Z" or by the "View" Window.

The "Project Explorer" shows which files are part of your project. The "System Files" was added by the process before, you remember? Each of the these files has a small icon with a linked symbol, the little red arrow:

At the moment these System Files are not physically available in your LPC2478Test folder These files are linked from the CrossWorks system to your project only.

I suggest to make these files part of your project folder now. This makes it easier to store the files in case of using a version control system. You must import these files. Therefore select the file you want to import and make a right click with the mouse to get the option menue for this element:

Now you can import this file and the icon will change:

It is even possible that you'll see no changes after the import. But this is a problem of the refresh action. In this case click on another file and you will see the changes you have made before. Import all System Files now, after the import you will find the files in your project folder: c:\temp\LPC2478Test\prj.

In the next step you must add your files to the project. Take a look in your LPC2478Test folder. Here you will find a source file main.c in the src folder and a header file typedefs.h in the inc folder. Even all the System Files which were imported in the prj folder.

Add your files

Now we will add the source file main.c to the project. Therefore right click on the "Source Files" folder and use "Add Existing File...":

You will find the main.c file in c:\temp\LPC2478Test\src. After adding the file, the Project Explorer should look like:

Here the main.c has had the linked symbol, too. But here there is no need to import the file like you did in case of the System Files. For the header file you must set the correct include directory. Therefore right click on your LPC2478Test Project and select "Properties...":

In the next window select Common for the Configuration and scroll down to the Preprocessor Options. Here you will find the entry for User Include Directories. Insert ..\inc.

(Click inside the picture to expand)

You must use ..\inc (dot dot backslash) because the project file is stored in the prj folder of LPC2478Test. The whole path must be calculated from this position. Press OK to close this dialog. Now we can compile the project.

Compile

In this example we will build for "ARM RAM Debug" mode. Therefore check if this mode ist set correctly. The window should look like:

Now you can compile the project by pressing the "Build Active Project":

Ooops, you will get an error message that the VIC_irq_handler.s could not be found:

(Click inside the picture to expand)

Correct the include of VIC_irq_handler.s, add "...\targets\Philips_LPC210X\". It should look like:

Build your project again, now it should works. The problem was that we imported the System Files. And therefore the path for the include has changed too.

Memory Usage

If you want to know how much memory your project uses, take a look at the Memory Usage:


Here you can see that the SRAM starts at 0x40000000 and the External_SDRAM at 0xa0000000. If you want to know what is occupied this are. Take a look at the Symbol Browser.

Symbol Browser

With the Symbol Browser you will get the information which section is placed in which area. Here the section .text is placed from 0xa00003ec to 0xa0000b6f and occupied a space of 1924 bytes.


Fasten your seatbelt, we will start debugging in the next step.

Start Debugging

Some note on ESD Precaution:

Please note that the LPC2478 OEM Board and QVGA Base Board come without any case/box and all components are exposed for finger touches - and therefore extra attention must be paid to ESD (Electro-Static Discharge) precaution.

Make it a habit to always first touch the metal surface of one of the USB or Ethernet connector for a few seconds with both hands before touching any other parts of the boards. That way, you will have the same potential like the board and therefore you'll minimize the risk for ESD.

Never touch directly on the LPC2478 OEM Board and in general as little as possible on the QVGA Base Board. The keys on the QVGA Base Board have grounded shields to minimize the effect of ESD.

Ok, you are being warned now and we can go on. If you powered your LPC2478 board, remove the power and connect the CrossConnect JTAG adpater. Now you can put the power back to the board.

The JTAG adapter is connected to the board. But now you must connect the target. Therefore click on Target and select "Connect USB CrossConnect for ARM-RTCK":

The status line at the bottom of CrossWorks should look like:

In case of a LPC / NXP target you must use the ARM-RTCK feature instead of ARM only.

CrossWorks is now connected with the target and you can download the code now. This will be done by pressing "Start Debugging":

The code will now be downloaded to the target and the result should look like:

(Click inside the picture to expand)

Don't worry about the strange values for a, b and c. This is OK at this time, because these variables are not initialized yet. You can step through the code by pressing F10.

After four steps the Locals should look like:

If you need more information, take a look in the CrossStudio Help.

Now my story is over, and you can play with your new toy...

Support

If you need support, take a look here:

Download

EA LPC2478 OEM SDRAM support packages V1.0 (37 KB)