« Wires Are Your Enemy | Main | Ordinary Blinking Lights »

IAR IDE Flow

The ez430-f2013 comes with an IDE by IAR. It's a usable tool, but learning to use it isn't exactly straightforward - more a matter of trial and error. And, sadly, there doesn't seem to be a tutorial to introduce the basic concepts. So, here's a quick note on how to write some firmware for the f2013.


  1. Start the IDE, "IAR Embedded Workbench". Cancel the initial dialog "Embedded Workbench Startup" (if there were a "Create New Workspace" option here, I'd use it - but there isn't)

  2. Create a new workspace: File/New/Workspace

  3. Create and save a new project: Project/Create New Project...

    • Select tool chain MSP430 (the only option I see)

    • Select project template C/main

    • Save the project to some empty directory. I like a short but meaningful project name.



  4. Configure the new project: right-click on the project in the workspace window and select Options...

    • General Options/Target/Device: MSP430F2013

    • C/C++ Compiler/List/Output List File: check the checkbox (this is not essential, but I like having a list file)

    • Debugger/Setup/Driver: FET Debugger

    • FET Debugger/Setup/Connection: TI USB FET



  5. Write some code: main.c was created automatically, and is a compilable stub that does nothing. Fill in the stub with something interesting. If you like blinking LEDs, try this:

    #include "msp430x20x1.h"
    void main(void)
    {
      WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer
      P1DIR |= 0x01;

      for (;;)
      {
        volatile unsigned int i;

        P1OUT ^= 0x01;

        i = 10000;
        do i--;
        while (i != 0);
      }
    }


  6. Compile the code. Right-click on the project in the workspace window and select "Make". (The first time, you'll be prompted to save the new workspace. Funny timing, that. I've been using the same name for the workspace that I did for the project. I wonder if this is a good idea.)

  7. Download and debug the new application. In the Project menu, select Debug (or just type ^D). What happens? First the IDE writes the application into the f2013's flash. Then it starts debugging, stopping at the first code line. Select Debug/Go, or hit F5 to run the application. Notice that there's no "programming the device" step here - just debug the application, and as a side effect the device will be programmed. This seems a bit weird to me.

That's it! In the future I'll be exploring ways to run the tools from the command line, but at the moment using the GUI seems ok.

TrackBack

TrackBack URL for this entry:
http://www.antfarm.org/cgi-bin/blog/mt-tb.cgi/29

About

This page contains a single entry from the blog posted on June 24, 2007 6:40 PM.

The previous post in this blog was Wires Are Your Enemy.

The next post in this blog is Ordinary Blinking Lights.

Many more can be found on the main index page or by looking through the archives.

Powered by
Movable Type 3.31