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.
- 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)
- Create a new workspace: File/New/Workspace
- 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.
- 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
- 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);
}
}
- 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.)
- 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.