ST AN2165 APPLICATION NOTE

AN2165

Application note

ST10F27X Firmware Development

Getting Started with Keil µVision ST10 Toolchain

Introduction

This document provides an introduction to the Keil µVision toolchain (version 2) for the ST10F27x product family. It summarizes the different steps needed to configure the Keil development toolset, to build and to debug an application.

Although this application note cannot show all the topics relevant to the Keil tool, it demonstrates the first steps necessary to get started with the compiler/debugger.

Two very simple software examples are supplied with this application note. The first is a small application displaying a message on the toolset serial window. This example is used to show the required steps to create a project, build and debug it. The second example illustrates how to use interrupts and the Logic Analyser feature.

The application source files are provided within an archived file. This file can be unpacked into any directory.

June 2006

Rev 1

1/18

www.st.com

AN2165

Contents

1 Keil ST10 toolchain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

1.1 Starting Keil µVision Integrated Development Environment (IDE) . . . . . . . . . 3 1.2 Creating a new project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 1.3 Adding files to the project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

1.3.1 Adding existing files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 1.3.2 Adding new files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

1.4 Setting build options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 1.5 Building the application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 1.6 Debugging the application with Keil µVision debugger . . . . . . . . . . . . . . . . . 11

2 Application example: interrupt handling . . . . . . . . . . . . . . . . . . . . . . . . . . 14

2.1 Debug operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 2.2 Logic analyser use . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

3 Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

2/18

AN2165

Keil ST10 toolchain

1 Keil ST10 toolchain

In order to start a project with keil toolchain, we need to perform the following steps:

Edit / Project management: in this part, projects are created and maintained, project source files are edited etc.

Build: here, a makefile (created by the Edit part) is used to invoke the needed toolchain components, resulting in an executable file.

Debug: in this part, the executable file is used to debug the project.

Neither the toolset installation nor the license management are described in this application note. This section assumes that Keil is already installed on the development host.

For more details on Keil installation and licenses’ management, refer to Keil documentation.

This section describes the steps required for creating, building and debugging an ST10F27x application using the Keil toolchain.

1.1Starting Keil µVision Integrated Development Environment (IDE)

To select Keil toolchain:

Select Start -> Programs ->Keil µVision.

Keil µVision starts and the following window appears:

Files Window

Project Window

Output Window

The Files window is used to edit source files. The project window contains several tabs for viewing informations about projects and other files. The output window contains several tabs to display results of EDE operations as compiles and builds.

For further information about the windows contents, refer to the Keil documentation.

3/18

Keil ST10 toolchain

AN2165

1.2Creating a new project

Select New project from the Project menu. This opens a Window dialog that asks you for the new project file name (see the figure below)

Use the Browse button to select a working directory.

Enter ’Simple_Example’ as the project space name in the Filename field.

Click Save to confirm your entry.

The Select Device for Target ’Target1’ window appears automatically allowing you to select a CPU for your project. This window shows the µVision device database. Select the ST10F27x MCU you plan to use. In this example, the ST10F276 microcontroller is used.

Click OK to confirm your entry. The following appears automatically:

Click Yes to confirm.

This window asks you to add the startup code to the project.

4/18

AN2165

Keil ST10 toolchain

An ST10 program requires a CPU start up initialization code that is run just after a device reset. This start up code is used to set up the configuration of your hardware design and is written in assembly.

This file can be modified to match your hardware configuration.

The following figure appears:

You can rename Target1 in the Project Window ’Simple_Example’ to improve readibility.

A project can have more than one Target. Creating another Target for a project means creating a project with the same source files. This is useful if you need a Target for testing and another Target for a release version of your application. If you also want to debug your application using two different configurations, you can use two Targets and each Target allows individual tool settings within the same project files.

To add a new target, right-click on the project and select Manage components. From the window that appears, select Project components tab and click on the New button.

5/18

ST AN2165 APPLICATION NOTE

Keil ST10 toolchain

AN2165

1.3Adding files to the project

There are two ways to add source files to the project. Either the source file already exists in the working directory, in which case proceed as described in the Section 1.3.1, or new source files containing your own code are added as described in the Section 1.3.2.

1.3.1Adding existing files

Copy in your working directory the ’main.c’ file located in the folder ’Example1’ provided with this application note.

Right-click on Source Group 1 and select Add Files to Source Group 1

The following window appears:

– Select ’main.c’ and click Add to confirm.

1.3.2Adding new files

You may create a new source file with the menu option File - New. This opens an empty editor window where you can enter your source code.

6/18

Loading...
+ 12 hidden pages