CodeWarrior Familiarization & Project Setup:
A Guide to Beginning Embedded C Programming using CodeWarrior for MCUs Eclipse
by J. Sumey
revised for CWE 10.6
This web page was created to assist the student in becoming familiar with the
CodeWarrior integrated development environment (IDE) and to perform the initial
steps to setting up and working with a "project" using Wytec's
Firebird32 product line.
The Firebird32s are based on the ColdFire 32bit MCU and provide an impressively
powerful computing platform in as small as a 28-pin DIP form factor.
proper installation of Freescale's
CodeWarrior Development Studio is assumed.
Specifically, this guide is based on the CodeWarrior Development Studio for
Microcontrollers (CW for MCUs), v10.6. At the time of writing, CW for
MCUs is available in two versions: the legacy "Classic IDE" and the newer
"Eclipse IDE" (CWE), the version used in this guide.
Note to CET360 students: If performing these steps on
one of the PCs in the EBE361 lab, it is recommended you create a folder on your
USB drive or other drive, named after your team, for the purpose of project
development. You may also create a single such folder on the lab computer C:
drive if you wish, although this folder will not be preserved on the lab PCs
after the semester is over!
II. What is CodeWarrior?
CodeWarrior is a powerful, first-class software development environment that
supports development in various languages (assembly, C, C++, EC++)
multiple target processors (Kinetis, PowerPC, ColdFire, HCS12, HCS08, DSP,
etc). The neat thing about CodeWarrior is that once you learn
it for any one target, you essentially know how to use it for any other
target! Some of the features inherent to CodeWarrior include:
- Integrated Development Environment (IDE) - essentially provides a single
gateway to all components
- easy-to-use Graphical User Interface (GUI)
- Project Manager (window) - a "bookkeeping" system for gathering all
program files & options into a single project file
- source code editor - colorized, syntax-directed, multi-paned editor for
editing project files - very cool!
- browser - provides quick access to various source code elements such as
variables, routines, classes, etc.
- highly optimizing C/C++ compiler, powerful macro assembler
- smartlinker - only links objects and code actually used in target project
- librarian - allows programmer to build custom libraries
- debugger - supports simulation & debugging of an application or
Although CodeWarrior is a commercial product, Freescale does distribute a "SE"
edition available on their website for free for educational uses with the only
restriction being that the ColdFire C compiler will only generate a maximum of
64KB of object code per project, more than enough for typical course projects!
III. Launching CodeWarrior (Windows)
By default, CodeWarrior is installed in Start > All Programs
> Freescale CodeWarrior and may be launched from there. Look for the
entry CodeWarrior. In the Embedded Systems lab, you may also
launch it via the desktop shortcut "ET Apps".
Within this folder, you should find an entry named "CodeWarrior
for MCUs". This should take you into the CodeWarrior Integrated
Development Environment. Note that the Eclipse version is quite large and
may take a while to load.
If you get the "Select a workspace" dialog shown below, make sure you choose
an appropriate filesystem/network location.
Once fully loaded, CWE will present the Welcome page:
IV. Creating a Project
- On the Welcome page, click New Project Wizard. This should display
the "Create an MCU Bareboard Project" dialog prompting you for a project
name. Enter "test1" as the project name and verify the location for storing
the project then click Next.
- In the next "Devices" dialog, choose MCF51JM128 which is the actual MCU on
the Firebird32 module. Click Next.
In the "Connections" dialog, choose any/all connections to be used for this
project. As we will be using Wytec's USBDM (must be previously installed),
only that selection needs
chosen. Click Next.
- In the next "ColdFire Build Options"
dialog, we will accept default selections so click Next.
- In the
next "Rapid Application Development" dialog, select "None" then click
- You should next see the workbench window including the
"CodeWarrior Projects" panel as shown below. If this panel is not displayed,
turn it on via Window > Show View > CodeWarrior Projects.
In this panel, expand the Sources folder and double-click "main.c" to open
this source file in the center editor panel. You may want to maximize the
CodeWarrior window to fullscreen as it contains a lot of info.
The default "do nothing" program automatically placed in your project by the
New Project Wizard, as shown above, really does nothing other than
reset the Computer Operating Properly (COP) module to prevent a system
reset. As the Firebird32 module includes a yellow LED connected to Port E
bit 6, let's try some code to blink this LED. Select all the lines in main.c
and replace them with this version as shown.
V. Building (compiling/assembling/linking) a Project
- Errors, warnings, and status of the build process will be shown in the
"Console" tab in the lower pane of the workspace window; make sure this tab
- Build your project either by selecting Build on the Project menu or
by clicking the hammer icon
on the toolbar.
Correct any errors as necessary.
VI. Debugging & Running a Project
A successful project make (previous step) will yield object code
in the form of a "elf" file which may be downloaded to and executed on
the ColdFire MCU.
- Properly connect the Firebird32 module to the USBDM module using the 6-pin
BDM ribbon cable. Make sure you align the Firebird's BDM header pin 1 to pin
1 of the ribbon cable as shown in the following photo. Next connect the USBDM module to your PC via the USB
cable. Note that with J2 properly set, the USBDM will supply power to the Firebird32 via the BDM
cable, so no other connections are necessary! J2 should be installed to
the left (closest to the USB connector) to supply +5V to the Firebird32.
Always make double certain you are connecting these components correctly
so as not destroy them!
- Activate CodeWarrior's debug mode either by selecting Debug (F11)
on the Run menu or by clicking the debug icon
on the toolbar. This
will switch the workspace perspective from C/C++ to Debug as indicated by
the icons at the extreme right of the toolbar:
- You should notice the original source code displayed in the main.c panel
along with the equivalent ColdFire assembly code in the Disassembly panel.
Note that the first line of code / instruction is highlighted green.
- In the Debug panel, select "Show Debug Menu" from the "View Menu"
pull-down arrow. Notice the debug toolbar displayed in the Debug panel:
Hover the mouse over each of these icons and identify the following functions:
Reset, Restart, Resume, Suspend, Terminate, Disconnect, Step Into, Step Over,
and Step Return. These functions control the debugging process!
- Single-step through the initialization lines by clicking Step Over
(F6) four times. The green highlight bar should now be just inside the for
- While observing the yellow LED on the Firebird32 module, press F6 once
more and verify that the LED lights. Yay for small achievements!
- Press F6 again to call / execute / and return from the delay function;
you may notice a short delay here.
- Press F6 again and verify that the LED turns off. Is this cool or what?
- Press F6 a number of additional times to see the effect of the infinite
loop. A variation here is to use Step Into (F5) and Step Return
(F7) to track execution of the delay() function as well. Notice when inside
the delay() function, CodeWarrior displays the value of local variable 'i'
in the Variables panel.
- To cause the MCU to run your program full speed, click Resume
(F8). Observe the result on the LED. To suspend the program, click
There are many more fantastic features of CodeWarrior's debugger which you should
become familiar with. Some of the more useful include:
To return to working with the source code, click the "C/C++" perspective
icon at the upper-right of the workspace window.
- both local and global variable display
- single stepping - one program step at a time, at both the HLL and
- breakpoints - for stopping execution at any desired location
- register display - both the processor registers as well as I/O
VII. Additional Information
At this point, you should be well on your way to using CodeWarrior for
development and debugging of your project. For further information, an extensive
set of on-line documents is also installed with CodeWarrior. The main entry is
via the "Documentation" entry in the Freescale CodeWarrior folder of the Windows
The following PDFs are of particular
- Microcontrollers Getting Started Guide
- Microcontrollers Quick Start
- Eclipse Quick Reference Card
- various User Guides, Application Notes and Cheat Sheets
- links to on-line "how to videos"
Also, see my CodeWarrior Tweaks pages for setting
changes to make life simpler.
Finally, the Help Contents entry on the Help menu of the IDE is
a gateway to the complete CodeWarrior documentation and is highly recommended.