<< Chapter < Page | Chapter >> Page > |
To develop applications to run on the ez430 chip, we use the IAR Embedded Workbench IDE (integrated development environment). Not only does this application provide a powerful code editor, but it also allows a simple one-click deployment of the source code onto the MSP chip using USB as well as hardware debugging capabilities that allow you to trace through actual stack calls. This module is intended to give you an introduction to the IAR Workbench application so that you may create and develop your own ez430 applications.
The very first thing you must do before you can start downloading any code onto the MSP, is to create a project in Workbench that will contain all of the relevant files for your application. When you open Workbench you should see the following window (This window is equivalent to selecting File->New->Workspace and then Project->Create New Project . This window may also be reached through Help->Startup Screen): Next, the following window will appear: Now a Windows Save dialog should appear. Give your project a name and save it in its own seperate folder . A project is not only a C file that contains your code but also several other files (a project file with the ".eww" extention, a project settings folder, a debug folder which contains compiled code outputted by Workbench etc). Keeping the files for your current project in their own folder will help you stay organized. If you save and close your project, opening it again is as simple as opening this folder, and doubleclicking on the Workbench project file, which has a ".eww" extention.
Now, we must configure the project options. Make sure the project is selected in the "Files" pane to the left of the screen (the project is the top of the workspace's file tree). Then select Project->Options to get the following screen and make the indicated selections: Now select the "Debugger" option and make the following selections: Finally select the "FET Debugger" option and make the following selections: Your project is created, saved, and now you may write your code. Only one project may be open at a time.
If your project consists of more than one file, you will need to add it to the current project. To add a file to your project, choose Project->Add Files .
This is the part you've been waiting for: actually testing your program! Use the Project->Debug menu item to load the currently active project and set your program running. You can also set any breakpoints beforehand; by default, the very first line of executed code is set as a breakpoint. Now that you have started the debug process, the layout of the Workbench program changes slightly. A Debug menu and the "Disassembly", the assembly/machine code instructions at their specific memory addresses on the ez430, appear. To continue the execution of the program, select Debug->Go . If you would like to set breakpoints (in order to view the "path" of program execution or the values of specific variables or registers at a certain point during the program execution) click to the left of a line of code such that a red 'X' appears.
You can pause the debugger when the target is running if you would like to look at the value of certain variables. Select Debug->Break and open a watch window to examine the value of certain variables. It is suggested that you copy the variables you are interested in to temporary global variables. Because local variables go out of scope, it is uncertain if their correct value is maintained when the debugger is paused.
Debugging can be stopped using Debug->Stop . At this point, the watch window will not display your variable values. At this point, you may make any modifications to your program as necessary and restart the debugger from the beginning.
All of the necessary commands have shortcut icons as the following diagram shows: Legend:
You're all set to start using the CrossStudio compiler to write embedded microcontroller code. Save often and remember that disconnecting and reconnecting or restarting the program will solve almost all interface problems that you encounter. Don't worry if breakpoints seem a little confusing now. We will go into more depth shortly and a good bit of practice is necessary to use them effectively.
Notification Switch
Would you like to follow the 'Introduction to the texas instruments ez430' conversation and receive update notifications?