034 Using Freescale CodeWarrior
034 Using Freescale CodeWarrior
Abstract
This document describes the usage of the Freescale/Metrowerks CodeWarrior®
Legacy Suites (CW) for HC(S)08/HC(S)12/S12X/DSP568E . For newer versions of
CodeWarrior see application note Using Freescale CodeWarrior (Eclipse based
version).
The default settings delivered with the TESSY installation works with the
CodeWarrior standard simulator. If you want to run your tests on target hardware,
please follow the steps described in this document (i.e. create a CW project und use
these settings for the test).
Please note the setting for the remote connection to be used to avoid startup dialogs
within CodeWarrior when executing the test (in case of DSP5xx only).
Table of contents
Abstract ...................................................................................................................... 1
1 Introduction.......................................................................................................... 3
2 Emulator/debugger setup for HC(S)08/HC(S)12/S12X ....................................... 3
2.1 Sample TESSY project................................................................................. 3
2.2 Sample CodeWarrior project ........................................................................ 5
2.3 Startup code ................................................................................................. 6
2.4 Using the linker file (PRM) ............................................................................ 7
2.5 Adaptation of the makefile template ............................................................. 9
2.6 Target connection settings ......................................................................... 10
2.6.1 CW project path .................................................................................. 10
2.6.2 CW debugger project file ..................................................................... 10
2.6.3 Target interface ................................................................................... 11
2.6.4 Adapting the slave call ........................................................................ 12
3 Simulator execution for HC(S)08/HC(S)12/S12X .............................................. 13
3.1 Setting the target interface ......................................................................... 13
3.2 Setting the CPU derivative ......................................................................... 13
3.3 Troubleshooting.......................................................................................... 15
4 DSP5xx ............................................................................................................. 15
4.1 Setting the remote connection .................................................................... 16
4.2 Restrictions of the DSP568E controller ...................................................... 18
1 Introduction
The Freescale/Metrowerks CodeWarrior (CW) simulator debugger does not require a
special setup in order to execute tests with TESSY (except one setting for DSP5xx
like described below). If you are using the standard TESSY installation settings, the
standard CW simulator will be used for test execution.
TESSY controls the test execution using a generated script file that will be passed on
the command line when starting the CW debugger (hiwave.exe). The debugger
executes this script during the test session. The default script is appropriate for use
with the simulator.
In order to run tests on target hardware, you need to prepare a CW project and make
some changes to the default TESSY setup. For this purpose, there are TESSY
sample projects available as zip files, which may be used as starting point for
adaptations to the CW target. Please follow the steps described in chapter 2 in order
to setup a running TESSY project with the CW debugger.
Please add all necessary settings, save and exit TEE. The sample TESSY project
uses a configuration file and you should do any changes within the File section of
TEE. The picture below shows the attributes that are added or changed compared to
the default configuration:
These attributes are related to the sample CW project included in this sample setup.
Refer to the following sections for details about the required settings.
Choose the appropriate MCU and target connection (marked in red) and build the
sample CW project in order to generate the PRM and object files used later within the
TESSY sample project.
If everything builds correctly, please start the debugger from within CodeWarrior by
pressing the Debug button (F5). This will start the Hiwave debugger and you should
be able to step through the code. There is one more setting required for automated
tests by TESSY: Select Configuration from the File menu of Hiwave. This will show
the Configuration dialog:
Please make sure that the Stop at Function toggle within the Load tab of the dialog
is not selected like shown above. Click on the OK button and exit Hiwave.
The red marked program code within the start08.c is necessary for the HC08
derivatives to disable the watchdog timer (COP). Please refer to the respective
microcontroller specific header file or CW documentation for further information about
resetting the watchdog (e.g. the location of the CONFIG1 register is different for the
HCS08 devices).
The device selected here has such a short COP timeout, that it is required to disable
the COP as soon as possible. Doing this within the main() program is too late for this
device! For other devices, you may use the Init Code attribute within TEE to specify
a code fragment to disable the watchdog.
Please note, that you need to remove the NAMES … END entry within the CW
generated PRM file as shown below (because TESSY generates this entry itself):
Within the TESSY sample project, this line is already commented out.
Another important setting is the stack size. You should increase the default size (you
may use e.g. 0x200) to make sure there is enough stack space available:
Other C libraries could be used by changing the line above the reference to the
startup code.
The desired memory model may be configured within the compiler options at the
beginning of the makefile template:
The default memory model for the HC08 devices is the small model.
use the same command line arguments when starting hiwave.exe, refer to section
2.6.4):
The respective Slave Call attribute for this example would be like follows (all within
one line, copy the whole line and paste it into TEE):
Please note: The default value of the Slave Call attribute contains the hiwave.exe
with the start.cmd file as only argument. The default value will work with the
standard CodeWarrior simulator only!
You may choose all supported targets of the Freescale Hiwave debugger. A
complete list of targets may be found within the Freescale installation subdirectory:
C:\Program Files\Freescale\CW for HCS12X V4.6\prog
All files with the extension .tgt represent a possible target. You need to specify the
name of the file without extension within the Target Interface attribute.
The CW debugger will start execution and break at the test object. Select Set
Derivative … from the Simulator menu (within the CW debugger) to choose the
derivative:
Within the Set Derivative dialog, you may select your CPU derivative (e.g.
MC9S12DG128B like shown below:
After pressing OK, this setting will then be active for all future test and debug
sessions (in fact, the derivative setting will be stored within a project.ini file
located within the TESSY_TESTAREA directory, normally c:\tessy. This location
is the current working directory where the CW debugger hiwave.exe will be
started).
3.3 Troubleshooting
If the test fails to execute properly, please inspect the CPU derivative like described
above to ensure that the correct CPU is selected.
4 DSP5xx
There is only one special setting required in order to execute tests within
CodeWarrior IDE debugger for DSP5xx. If this setting is missing, there will be a
dialog on startup of CodeWarrior asking for the desired remote connection.
Within the IDE Preferences dialog, select the Remote Connections entry within the
IDE Preferences Panel, select the appropriate entry from the list of remote
connections and click on the Change button.
The respective dialog for the remote connection will appear. Please make sure, that
the Show in processes list flag is set like shown below: