Professional Documents
Culture Documents
In this step-by-step tutorial Ill show how to make a simple project for LPC43xx series microcontroller using IAR Embedded Workbench IDE. It is primary intended for beginners, but it may also be useful for developers with some experience in other development environments (like KEIL, LPCXpresso, etc.). Hardware and software I use in this step by step tutorial: 1. 2. 3. 4. IAR Embedded Workbench for ARM, version 6.40. For our purpose 32KB Kickstart (freely available at IAR web site) is more than enough. IAR In-circuit Debugging Probe for ARM I-jet Diolan LPC4350-DB1 development board. Diolan LPC4357-DB1 Development Board.
Following this tutorial you will learn how to: 1. Configure IAR Embedded Workbench for LPC43xx microcontroller. 2. Use LPC43xx CMSIS-Compliant Standard Peripheral Firmware Driver Library. 3. Initialize and use the LPC43xx GPIO peripheral.
4. 5. 6. 7.
Run code from the LPC43xx internal RAM and external Flash. Start Cortex M0 core to run the program on both LPC43xx cores. Implement simple inter-process communication. Simultaneously debug the application on both LPC43xx cores.
In the dialog box that appears select "ARM" tool chain, and "C -> main" project template. After you click the "OK" button, IAR will prompt you to specify the project name in the "Save As" dialog. I use "first" both for the project and workspace names:
IAR has generated a very simple main function for our project:
But how do we get this project to run at our LPC4300 development board? IAR knows nothing about our project yet. We need to specify the processor type and the way to upload the compiled binaries to this processor. Let's visit our project options (menu Project -> Options). There is one detail about IAR GUI to know at this step. When you go to the Project -> Options menu, IAR shows options for the entity that is currently selected in the Workspace window. If you select the main.c row, you will see the options for this file. So pay attention that the root entity (the project name) is selected. Another possibility to get to the project options is to right click the project name in the Workspace window and select Options from the context menu:
We can specify the device type at the General Options category. Select the "Device" option in the "Processor variant" options group and click the small button after the edit field. Now we have a long way through the pull-down menus
It seems that we can simply specify the device type in the edit field, but not this is another strange behavior of the IAR GUI. You can place the cursor in this edit field, you can even select the part of the text, but when you press any button nothing happens. IAR compiler is very good, but its GUI is sometimes unpredictable.
I have selected the NXP LPC4350_M4. Depending on your exact demoboard type you can also select the LPC4357_M4 or LPC1850 device type. There is also the option for another core (LPC4350_M0), but this is not for us just now. The main reason is that the Cortex-M0 core cant start without the CortexM4 core. The Cortex-M4 core is responsible to load and start the Cortex-M0 core. Now we can build the project specifically for our processor, but how will we
load it? I use the IAR I-jet probe, so lets configure it.
As you can guess, the debugger is set in the Debugger category. Just select the I-jet option. Now our project is configured, so click the OK button to close the dialog. One more note: when you open the project options dialog, you see the options for currently selected configuration. If you change the configuration (select Release
instead of Debug in the combo box at the top of the Workspace window), you will see that all our changes have gone. This is because they are set for the "Debug" configuration and not for the "Release". Lets set the breakpoint inside our main function (you can use the F9 button) and run our application (menu Project -> Download and Debug).
Great! Now our project is compiled and we can run it. Tags:
IAR
In the next article we will use the LPC43xx CMSISCompliant Standard Peripheral Firmware Driver Library to initialize LPC43xx clocks and interrupt vector table.