CodeWarrior for ColdFire, eTPU Graphical Configuration Tool, & eTPU Driver Installation and Integration Guide Revision History Version 1.0 Page 2 of 11 Description Date Created. - M.Perez CW, GCT, & eTPU Driver Inst. & Int. Guide 2005/Jan/19 Ver. 1.0, 01/2005 INTRODUCTION The purpose of this document is to guide the user through 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 CodeWarrior Development Studio for ColdFire from the following link: http://www.metrowerks.com/MW/Develop/Embedded/ColdFire/Default.htm Note: These installation instructions were developed using CodeWarrior Development Studio for ColdFire Version 5.0. 2. Update CodeWarrior with Patch 5.1.1 In order to use the latest ColdFire MCF5235 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(R) Development 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 the 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 CodeWarrior project. Page 3 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 functions 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 shortcut 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 4 of 11 CW, GCT, & eTPU Driver Inst. & Int. Guide Ver. 1.0, 01/2005 SETUP GRAPHICAL CONFIGURATION TOOL 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 5 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 following four steps: 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 6 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 7 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 template - 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 generated by the GCT to the CodeWarrior project under a new created folder called GCT. Page 8 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-CONSOLE 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 Always Search User Paths option is also selected as shown below. Page 9 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 that 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 integrating 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 10 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 Project > Run, press the Run button in the project window tool bar, or press F5. 10. Verify Pulses Verify the expected PWM eTPU generated pulses with the LEDs on the M523xEVB, with an oscilloscope or a logic analyzer. Page 11 of 11 CW, GCT, & eTPU Driver Inst. & Int. Guide Ver. 1.0, 01/2005