First IAR Project
To create a new IAR project, go to the "Project -> Create New Project" menu.
IAR will open a "Create New Project" dialog box, where you can set the initial configuration of your project. Since we are going to write a program in C language for ARM processors, we choose "ARM" in the drop-down list "Tool chain", and "C-> main" in the "Project templates" window.
After you click "OK", IAR will ask you to specify the project name in the "Save As" dialog box. I used a "first" both for the project and workspace names:
At the conclusion of this short wizard, IAR has generated a very simple main() function for our project:
So far, we have not indicated the type of processor for our project. The processor type and the way to download the compiled binary into the processor is specified in the project options (menu Project->Options).
There is one detail in the IAR GUI interface, which must be taken into account at this stage. When you go to the “Project -> Options” menu, IAR shows the options for the item that is currently selected in the “Workspace” window. If the “main.c” row is currently active in the "Workspace" window, you will see the options of this file. Therefore, pay attention to select the root entity (the project name) in the "Workspace" window.
Another possibility to get access to the project options is to right click on the project name in the “Workspace” window and select “Options” from the context menu:
We can specify the type of our device in the “General Options” category. Select the "Device as "Processor variant" and click the small button next to the edit field. Now we have a long way through the drop-down menus…
It seems that we can simply specify the device type in the text box, but do not. This is another case of strange behavior of the IAR GUI. You can place the cursor in this text box, you can even select the text, but when you press any key, nothing happens. IAR has a very good compiler, but its GUI is sometimes unpredictable.
I chose NXP LPC4350_M4. Depending on the type of your evaluation board, you can also specify LPC4357_M4 or LPC1850.
There is an option for a second core (LPC4350_M0). This option is not suitable for our project. The main reason is that the Cortex-M0 core cannot start on their own. Cortex-M4 core is responsible for loading and running Cortex-M0 core. We will consider the use of Cortex-M0 core in one of the following chapters.
One more thing to note: when you open the Project Options dialog, you'll see options for the current configuration. If you change the configuration (select "Release" instead of "Debug" in the drop-down list at the top of the "Workspace" window), you will see that all our settings are gone. This is because they are set to "Debug" configuration and not to "Release".
Let's set a breakpoint in the function main () (you can use the F9 key) and run our application (menu "Project -> Download and Debug").
Excellent! Now our project is compiled and we can start debugging.
Comments
Using external flash
Is there any way to program and debug applications in external flash? LPC4350 processor doesn't have embedded flash.
Yes. You can use either the
Yes. You can use either the Segger j-flash utility or the flash loader. The flash loader gives an opportunity to program the external flash directly from the IDE. Diolan has flash loaders for both IAR and KEIL. Download them from http://www.diolan.com/downloads/lpc4350-db1_demo.zip.