Le1 1

Download as pdf or txt
Download as pdf or txt
You are on page 1of 12

KEIL IDE ABSTRACT

This is an introduction to the KEIL development tool


for LPC2378. This document is brief tutorial of how

DEVELOPMENT to use KEIL and has some simple example programs

Anupama KR
Embedded System Design

TOOL FOR
LPC2378
Introduction
Keil IDE Development Tool for LPC2378
Keil IDE is an application that allows seamless integration of several different programs into
one development environment. This text editor allows the user to launch different programs including
assemblers, compilers, debuggers, programmers, and more. If configured correctly, the environment
can also read back errors from these programs and display them for the user. Having a development
environment that is made up of several separate programs allows the user to replace any part of the
environment.
If error detection is set correctly, the user’s errors will be highlighted and the compilers error
message will be displayed. The user never has to leave the editing environment to run the compiler,
and the editor automatically opens any files that contain an error.
When you use the Keil µVision, the project development cycle is roughly the same as it is for any
other software development project.
1. Create a project, select the target chip from the device database, and configure the tool
settings.
2. Create source files in C or assembly.
3. Build your application with the project manager.
4. Correct errors in source files.
5. Test the linked application.
The following block diagram illustrates the complete µVision/ARM software development cycle.

µVision 3 IDE with Editor & Make

C Compiler Assembler

C Library Library Manager User Library

Linker/Locator

µVision 3 Debugger

CPU & Peripheral KEIL ULink JTAG


Simulation Adapter
µVision IDE
The µVision IDE combines project management, a rich-featured editor with interactive error
correction, option setup, make facility, and on-line help. Use µVision to create your source files and
organize them into a project that defines your target application. µVision automatically compiles,
assembles, and links your embedded application and provides a single focal point for your
development efforts.
How to use Kiel IDE?

1. Go the /Keil/uv3 folder and click on Keil IDE opens automatically.


2. Open a new Project by selecting New Project from the Project Menu

Figure 1: New Project Window


3. Give your project a name for example test and press Save. (We suggest that you use a separate
folder for each project. You can simply use the icon Create New Folder in this dialog to get a
new empty folder. Then select this folder and enter the name for the new project.)
Kiel IDE will then display the following window as shown in Figure 2
Figure 2: Window to select CPU

4. When you create a new project µVision asks you to select a CPU for your project. The Select
Device dialog box shows the µVision device database. Select NXP LPC2378 and press OK. This
selection sets necessary tool options for the device and simplifies in this way the tool
configuration.
Keil will then ask you

5. Generally when you are using Assembly Language Programming, you will select the option No.
If you are writing the program in C/C++ you have select option Yes.
6. You will now get a Keil Window shown in Figure 3
Figure 3

7. Now you have to set options for tools. Click on on the toolbar. The window shown in
Figure 4 will appear

Figure 4; Tool options for Target


8. Go to the ‘Debug’ tab of the tools option window. Select ‘Use Simulator’ option.

Figure 5: Simulator option for Debug


9. Now press ‘OK’ so that all your options are saved.
10. To create a new ALP. Go to ‘File’ Tab and click on ‘New’. A new text file will be created as
shown in Figure 6

Figure 6: New File Editor window


11. Go to ‘File’ tab and use the ‘Save As’ option and save the file as ‘name.s’ You can use any
name for the file the extension will be ‘.s’. Now all the editor options including different
colours for labels, variables, etc.. will be available.
12. Figure 7 shows an example program that executes x = (a+b)-c

Figure 7: An example program


13. Now to assemble/compile the file it has to be first added to target ‘source group’ that appears
on the left window

Figure 8: Target Window


14. To add a file to the source group right click on Source Group the options shown in Figure 9
will appear

Figure 9: Addition of File to Source Group


15. Go to options ‘Add Files to Group ‘Source Group1’. A pop-up window will appear select your
assembly file ‘Name.asm’ and click on the ‘Add’ button. To close the pop-up window click on
the ‘Close’ Button. Now if you examine the left side of your Kiel Window you will find that
your file has been added to ‘Source Group1’ as shown in Figure 10

Figure 10: File added to Source Group


16. Now to assemble your file click on . Your file will be assembled and if there is any error
it will be indicated in the output window at the bottom of your screen. Refer to Figure 11. The
error along with line number in which the error has occurred (in this case ‘7’) will be indicated.

Figure 11: Error Indicated in output Window.

17. The debugger can then be started by clicking on . The debugger supports both single
step and break points. There are a number of debugging windows.⇒ Code – Memory – CPU
Registers – Symbols. This is shown in Figure12

Figure 12: Debug Window


Buttons on the Debug window:

→ Takes the control back to the editor window.

→ Resets the system resources [CPU, Internal sub-units of the micro-controller


variables, and the development board]

→ Is used for single-stepping step over

→ Is used to step over procedures such as delays etc.

→ Is used for complete execution of the program

→ Is used for halting the execution of the program.

There are other buttons available as well, as you move the cursor over the buttons, the
purpose of each button will be displayed.
The debugger is user-friendly GUI and is easy to handle. To set a breakpoint in the program,
the cursor just needs to be moved to the instruction at which the breakpoint is to be set and click on
to set the breakpoint.

Figure 13: Setting Break Points

Indicates where the instruction to which the Program Counter is pointing to.
Indicates the instruction at which there is a breakpoint.
To clear the breakpoint all you have to do is move the cursor to the instruction at which the breakpoint
is set and click on .

The Register Window


The Register window shows the contents of all the registers of 8051 CPU. It shows the content
of the 8051 registers at run time. The contents of the registers can be changed by going to the register
and then clicking on its value.

Figure 14: Register Window


Note:
• Labels are not followed by “:”
• Assembler directives such as AREA, END, ENTRY etc. should not be written in the first column
• Directive AREA – is used to define a memory area
• Format is AREA NAME, TYPE (CODE/DATA), Characteristic (READONLY/READWRITE) - usual
directive ORG is not used here
• START – defines start of execution
• STOP – end of main execution area
• END – end of assembly
• Source data usually specified in ROM or you have to write source data into RAM area every
time you run the program
• Destination data usually defined in RAM – as you need Read/ Write Capacity
• DCD – Define Constant double word – equivalent to DD Directive
• ROM starts at 0X00000000 (00 00 00 00H)
• RAM starts at 0X40000000 (40 00 00 00H)

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy