Setting up a new project

Setting up a new project

Using the Provided Workspace

Projects in IAR are organized as follows:

  • Each project has corresponding  .ewd and .ewp project files associated with it.

  • .eww "workspace" file groups different projects together.

All projects of the 

 are grouped in the 

all_projects.eww workspace.

Double-click on that file to open the workspace in IAR.



Create a New Project



All the projects shipped in the

have been set up. We recommend you use those projects when exploring the different sample applications. You only need to follow the steps below when creating a project from scratch.

OCSDK revisions <= 1.1.0.8 include IAR 6.x projects. Starting with OCSDK 1.2, it will included IAR 7.x project files, which are not compatible with a 6.x environment. If you are using a 6.x environment, you may need to set up project files manually, as described below.

Follows the steps below to create a new project:



We assume your project is entitled myProject.

  • Create the directory structure:

    • Create the following directories:

      • app\myProject\ to hold the your project's source code

      • myProject\ to hold the IAR project files

    • Place the source code of your project in 

      app\myProject\.  Typically, the source code consists of one of more C files, optionally header files, and the app_task_cfg.h header file.

  • Create the IAR project:

    • Open IAR

    • Select Project, Create New Project...

    • In the Create New Project dialog:

      • Tool Chain: ARM

      • Project templates: C >  main

      • Click OK

      • give your .ewp project file a name (e.g. myProject.ewp)

    • Remove the main.c file created by default:

      • In the right pane, right-click on the main.c tab and select Close.

      • In the project structure on the left, right-click on main.c and select Remove; click Yes to confirm.

      • In your project directory (e.g. 

        app\myProject\), delete the main.c file.

    • Right-click on the project and use the Add > Add Files... and Add > Add Group... entries to add and organize the source code files. Typically, the project contains:

      • In the app/myProject group, the source code of your application, taken from the 

        app\myProject\ directory.

      • In the app/common group, the source code of the helper modules, taken from the 

        app\common\ directory.

      • In the inc group, the header files associated with the library, taken from the 

        inc\ directory.

      • In the lib group, the pre-compiled libraries libip_stack.a and libucos_full.a, taken from the 

        lib\ directory.

      • In the modules group, the source code of the modules taken from the 

        modules\ directory.

      • The image below show the resulting structure of a typical project "02-gpio_net"

  • Configure the IAR project:

    • Select the new project in the Workspace view on the left by clicking on it. From the main menu select Project > Options...

    • In General Options

      • In the Target tab:

        • Core: Cortex-M3

      • In the Library Confrguration tab:

        • Set the Library low-level interface implementation to None.

    • In C/C++ Compiler:

      • Optimizations tab:

        • Set Level to High

        • Select Balanced

      • Preprocessor tab:

        • List the location of your header files in the Additional include directories text field, one per line. $PROJ_DIR$ is an IAR macro which corresponds to the directory containing the project's .ewp file. A typical configuration is (<your_app_dir> refers to the directory containing the source code of your application):

          $PROJ_DIR$\..\..\..\src\app\<your_app_dir>\ $PROJ_DIR$\..\..\..\src\app\common\ $PROJ_DIR$\..\..\..\src\inc\ $PROJ_DIR$\..\..\..\src\modules\clilib\ $PROJ_DIR$\..\..\..\src\modules\ip_applib\
        • Preinclude file, enter:

          $PROJ_DIR$\..\all_projects.iarinc
      • Diagnostics tab:

        • If you encounter compilation errors related to data type conversion with older versions of the OCSDK, you may need to disable some diagnostics:

        • In the Suppress these diagnostics text field, enter:

          Pa039,Pa050,Pe767,Go005,Pa082,Pa089,Pe167,Pe550,Pe188,Pe177
      • Extra Options tab:

        • check Use command line options

        • In the Command line options text field, enter:

          --no_path_in_file_macros --enum_is_int
    • IOutput Converter:

      • Output tab:

        • check Generate additional output

        • output format: binary