Using the Provided Workspace
Projects in IAR are organized as follows:
- Each project has corresponding
.ewp project files associated with it.
.eww "workspace" file groups different projects together.
All projects of the On-Chip Software Development Kit are grouped in the
Double-click on that file to open the workspace in IAR.
Create a New Project
All the projects shipped in the On-Chip Software Development Kit 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 <= 188.8.131.52 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.
- 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
- 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
- In the app/common group, the source code of the helper modules, taken from the
- In the inc group, the header files associated with the library, taken from the
- In the lib group, the pre-compiled libraries
libucos_full.a, taken from the
- In the modules group, the source code of the modules taken from the
- 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:
- 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):
Preinclude file, enter:
- Diagnostics tab:
- Extra Options tab:
n Output Converter: Output tab: check Generate additional output output format: binary
This output converter configuration is no longer needed. It produced a binary (
.bin) file that was compatible with loader 184.108.40.206. It is replaced by the conversion of the
.out file (as configured in the Linker output tab below) to a
.bin file in the post-build step (as configured in the next step). The new binary format requires loader 220.127.116.11 or later.
- In Build Actions:
- In the Post-build command line field, enter:
C:\Python27\python.exe "$PROJ_DIR$\..\..\..\tools\dustElfToBin\dustElfToBin.py" "$TARGET_PATH$"
- In Linker:
- Config tab:
- check the Override default
In the browse field, if you are using version 7.3 or earlier enter:
for version >= 7.4, the linker file is now bundled, so enter:
In the Configuration file symbol definitions text field, enter:
- Library tab:
- Output tab:
- Change the Output filename field to a more descriptive filename, e.g.
- List tab:
- Check Generate linker map file
- In Debugger:
- Setup tab:
- Download tab:
- check User flash loader(s)
- check Override default .board file
In the browse entry, if you are using version 7.3 or earlier enter:
for version >= 7.4, the board file is now bundled, so enter:
- Plugins tab:
- check uC/OS-II in addition to any checked plugins
- In J-Link/J-Trace:
Using the i-jet debug probe
The IAR projects in the On-Chip Software Development Kit are set up to use the j-link debug probe. If you are using the i-jet, you need to change your project options as follows:
- right-click on your project and select options
- in the options, under Debugger, Setup, set Driver to I-jet.
- The first time run the project, you will see the following message. Click OK.
- In the Memory Configuration window, click OK.
Customizing an application
The contents of the
directories are tightly linked together. We highly discourage modifying those files
. Doing so will complicate upgrading your applications to a newer version of the On-Chip Software Development Kit and may have unintended effects on other applications. Future versions of the OCSDK will make it easier to customize the modules in one project without affecting the other samples. In the meantime, If you want to customize the behavior of the local or CLI module, we suggest creating a copy with a different name. For example, to customize the local module (assuming you will make changes to the following headers):
- Copy dnm_local.h to private_dnm_local.h
- Copy loc_task.h to private_local_task.h
- Copy loc_task.c -> private_loc_task.c and replace the old #include references with the new ones.
You can now edit the local task without impacting other projects.