CodeWarrior for ColdFire,
eTPU Graphical Configuration Tool,
&
eTPU Driver
Installation and Integration Guide
Page 2 of 11 CW, GCT, & eTPU Driver Inst. & Int. Guide Ver. 1.0, 01/2005
Revision History
Version Description Date
1.0 Created. – M.Perez 2005/Jan/19
Page 3 of 11 CW, GCT, & eTPU Driver Inst. & Int. Guide Ver. 1.0, 01/2005
INTRODUCTION
The purpose of this doc ument is to guide the user thro u gh the steps required for installing the Metrowerks development
tools, downloading the latest Freescale eTPU Drivers and integrating these files using the eTPU Graphical Configuration
Tool. At the end of this process, the user will be able to run eTPU drivers on the MCF5235 (ColdFire) Target.
DOWNLOAD TOOLS AND ETPU DRIVERS
1. Download CodeWarrior
The CodeWarrior (CW) Development Studio for ColdFire Version 5.0 is an integrated development tool that is
used for compiling, debugging and running application “C” code and enhanced Time Processor Unit (eTPU)
code. Download and install the Cod eWarrior Develop ment Studio for ColdFire from the following link:
http://www.metrowerks.com/MW/Develop/Embedded/ColdFire/Default.htm
Note: These installation instruct i ons were d evel o ped usi n g Co deWarrior Developm ent St udio for
ColdFire Version 5.0.
2. Update CodeWarrior with Patch 5.1.1
In order to use the latest ColdFire MCF5 235 stationery the CodeWarrior Development Studio Version 5.0
needs to be updated to Version 5.1.1. First, update to Version 5.1. Second, update 5.1 with the 5.1.1 Patch.
Download and install Version 5.1 Update and Version 5.1.1 Update from the following link:
http://www.metrowerks.com/MW/download/updates.asp?date_op=on+or+after&year=95&month=01&day=1&
did=find&vers=CWCF&submit=Select+%3E%3E
Note: These 5.1 and 5.1.1 updates require that CodeWarrior® Deve lopment Studio for ColdFire
Architectures Version 5.0 already be installed on your PC in order to update all necessary files.
3. Download the GCT
The eTPU Graphical Configuration Tool (GCT) will create two C-language files (*.c and *.h) that will serve as
an init template to the eTPU module. These two generated files will also initialize the eTPU global and channel
settings, will include API application initialization routines, and run the eTPU. Download and install the eTPU
Graphical Configuration Tool from the Freescale eTPU webpage:
http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=eTPU
Note: These installation instructions were developed using the GCT Version 1.1.2
4. Create an eTPU Folder
Create a new folder on your desktop and name it “eTPU”.
5. Download the eTPU code and interface files
Download the eTPU code and interface files from the Freescale eTPU webpage mentioned in step 3. The
ANXXXXSW_GENERALSET folder contains the binary image of the eTPU code, source code and interface
files. Each driver consists of an eTPU microcode function and a "C" language Application Program Interface
(API). The API also provides a straightforward user interface to the eTPU functions. Extract the
ANXXXXSW_GENERALSET.zip code to the created eTPU folder on your desktop.
6. Download t he API C Code
Download the API Code from the Freescale eTPU webpage mentioned in step 3. The
ANXXXSW_FUNCTION (Where Function is the abbreviation of the driver) folder contains the API C code
for each associated standard mask driver. Please extract the ANXXXSW_FUNCTION.zip code to the created
eTPU folder on your desktop. Do this for all the functions that want to integrate into the CodeWarr ior project.
Page 4 of 11 CW, GCT, & eTPU Driver Inst. & Int. Guide Ver. 1.0, 01/2005
7. Download the Utility Files
Download the eTPU utilities from the Freescale eTPU webpage mentioned in step 3. The
ANXXXXSW_UTILS folder contains the eTPU utilities. These files will contain useful macros and fun c tions
necessary for initializing the eTPU and loading the code into memory. Extract the ANXXXXSW_UTILS.zip
files to the created eTPU folder on your desktop.
SETUP CODEWARRIOR DEVELOPMENT STUDIO
1. Start CodeWarrior
Start the CodeWarrior IDE with the shortcu t created in the Metrowerks program group.
2. Create a CW Project
Create a new CodeWarrior project using project stationary with the following three steps:
A.) Choose the menu File > New or press CTL+Shift+N.
B.) Choose ColdFire Stationary, name the project “CW & GCT integ for eTPU” and set the Location
for your CodeWarrior project.
C.) Choose CF_M5235EVB, and then choose C.
Page 5 of 11 CW, GCT, & eTPU Driver Inst. & Int. Guide Ver. 1.0, 01/2005
SETUP GRAPHICAL CONFIGU RATI ON T OOL
1. Start the GCT
Start the eTPU Graphical Configuration Tool with the shortcut created in the Freescale program group.
2. Set Path
Set the directory path for the function sets with the following two steps:
A.) Choose the menu eTPU > Options
B.) Search Directories for the eTPU folder on your desktop and select the correct path.
3. Close and Re-Start
Close and re-start the GCT tool (New function set path will be used next time the application is run.)
Page 6 of 11 CW, GCT, & eTPU Driver Inst. & Int. Guide Ver. 1.0, 01/2005
4. Set up the GCT
Set up the eTPU Graphical Configuration Tool with the followin g f ou r ste ps:
A.) Setup the Processor – Choose Target CPU: MCF523x, System Clock: 150MHz
Note: CW initializes the hardware at reset to run at 150MHz in the hwinit.c file.
B.) Select Function Set – Select “etpu_set1.h” as the eTPU Function Set to be used. The standard mask
functions API that will be available will have a check mark under the API Column.
Page 7 of 11 CW, GCT, & eTPU Driver Inst. & Int. Guide Ver. 1.0, 01/2005
C.) Select Engine A Settings (TIMERS and PRESCALERS) – Choose Internal: eTPU clock divided by
2 for TCR1 Clock Source and Internal: eTPU clock divided by 8 for TCR2 Clock Source. The
maximum TCR1 frequency is 37.5 MHz and the Maximum TCR2 frequency is 9.375MHz for internal
clock sources.
Page 8 of 11 CW, GCT, & eTPU Driver Inst. & Int. Guide Ver. 1.0, 01/2005
D.) Set up Engine A Channels – Select the standard mask functions, channels, and parameter initializations
for running on engine A.
5. Save Init templa te – File>Save (“untitled_etpu_gct.c” & “untitled_etpu_gct.h”) to the eTPU folder on your
desktop.
INTEGRATE CW AND GCT
1. Add GCT files to CW
In the CodeWarrior Project (CW & GCT Integ for eTPU.mcp) add the two files (“untitled_etpu_gct.c” &
untitled_etpu_gct.h”) that were gene rated by the GCT to the CodeWarrior project under a new created folder
called GCT.
Page 9 of 11 CW, GCT, & eTPU Driver Inst. & Int. Guide Ver. 1.0, 01/2005
2. Add eTPU Code Path to CW
This allows the CW compiler to find all the files that it will need during compile time.
A.) Choose the menu Edit > RAM-CON SOLE Settings, press the Ram Application Settings button, or
press Alt+F7 the Target Settings.
B.) Choose Target > Access Paths and use the Add button to browse to the eTPU folder on your desktop.
Please verify that the Al w a ys Search User Paths option is also selected as shown below.
Page 10 of 11 CW, GCT, & eTPU Driver Inst. & Int. Guide Ver. 1.0, 01/2005
3. Add 2 functions to the main.c
Add the following two functions to the main.c th at CW created for you:
my_system_etpu_init (); /* this function was created by the GCT tool and is responsible for
initializing eTPU settings and channel settings */
my_system_etpu_start (); /* this function was created by the GCT and is responsible for starting the
eTPU hardware */
4. Add 3 files to the main.c
Add the following three #includes to the main.c that CW created for you:
#include "etpu_util.h" /* Utility routines for working eTPU */
#include "mcf523x_vars.h" /* Variables specific to mcf5235 */
#include "untitled_etpu_gct.h" /* eTPU configuration created by GCT */
5. Add API Files to your CW project
For this integration we have decided to run a simple PWM function. Add any etpu_driver.c (where: driver is
the name of standard mask function) for any function that you are integratin g on eTPU
engine A. Choose Project > Add Files.
6. Add the Util File to your CW project
Add etpu_util.c to your CodeWarrior Project by choosing Project > Add Files.
Page 11 of 11 CW, GCT, & eTPU Driver Inst. & Int. Guide Ver. 1.0, 01/2005
7. Compile the CW project
Compile the project using the menu Project > Make, press the Make button in the project window tool bar, or
press F7.
8. Start Debugger
Choose the menu Project > Debug, press the Debug button in the project window tool bar, or press F5. The
project will link and load the application automatically into External RAM on the target, and the linker.
9. Run
Run the CodeWarrior project. Choose the menu Proje c t > Run, press the Run button in the project window
tool bar, or pre ss F5.
10. Verify Pulses
Verify the expected PWM eTPU generated pulses with the LEDs on the M523xEVB, with an os cilloscope or a
logic analyzer.