<img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=1596188457259603&amp;ev=PageView&amp;noscript=1">
TruePERSPECTIVES_logo.png

How To Import IAR EWARM Projects Into Atollic TrueSTUDIO [Using The New Project Import Converter]

Posted by Magnus Unemyr on May 17, 2017 9:15:00 AM

Atollic now has a new Project Import Converter supporting IAR® EmbeddedWorkbench® for ARM® (EWARM) projects. The new Project Import Converter automatically updates EWARM projects to Atollic TrueSTUDIO format during import.

 project_importer.png

The Project Import Converter will not modify any source or project files for your original EWARM project. It is however recommended that you backup or make a copy of the original EWARM project since you most likely will need to modify some of the source code after the project has been imported to Atollic TrueSTUDIO.

How To Import The Project

Use the following method to import one or many projects. Please note the imported project(s) will not be copied to the workspace. All files in the project will be located at the original place and will be overwritten when manual changes are made later on.

To open the Import wizard, select File, Import…

iarimport1.png

In the Import wizard, select Projects from Folder or Archive and press Next.

iarimport2.png

The Import Projects from File System or Archive dialog is opened.

iarimport3.png

In the Import Projects from File System or Archive dialog, browse to the folder containing the project to be imported.

Select the project and make sure the checkbox Detect and configure project natures is enabled; otherwise the Project Import Converter will not be used. Press Finish to import the project.

The project is now imported into the TrueSTUDIO workspace. Please note that files included in the project are not copied to the workspace; instead all files are linked to the workspace. This means that the actual files will be updated in the original EWARM project.

Press OK to use the imported project.

If a folder which contains several projects are selected and Search for nested projects are selected several projects will be seen in the dialog.

iarimport4.png

Many projects can then be imported in one step using this method. However, Eclipse requires different names to be used for each selected project. If you run into this problem you can either rename the original EWARM project(s), or import them into different Atollic TrueSTUDIO Workspaces.

Before Building The Imported Project

Start by having a look in the generated log file that is included in your imported project. This log file contains valuable information about the imported project, for example if there were problems importing certain parts from EWARM.

Before you build the project, you need to make some manual modifications to the source code and make sure that the build options are set correctly.

Below is a step-by-step list and I will walk through this list and give examples on what typically needs to be done to get to a project that builds in Atollic TrueSTUDIO.

There are essentially four parts of the migration process that you need to update manually:

  • Review and modify build options
  • Modify assembler source code
  • Add a linker script file
  • Watch out for tool specific code

These steps are described below and will in most cases lead to a project that builds and functions correctly.

Linker scripts, startup code and standard C/C++ libraries are tightly related so you must make sure to use either Atollic TrueSTUDIO or EWARM versions of this code and scripts.

It is strongly recommended to use Atollic TrueSTUDIO versions since migrating all this from EWARM to Atollic TrueSTUDIO would be very time consuming and prone to errors.

In the process of manually updating the new Atollic TrueSTUDIO project, you will need startup code and a linker script file. You can easily get this if you create a dummy project in the Atollic TrueSTUDIO Workspace.

The only thing you have to remember is to make sure that the dummy project is based on the same ARM device as our original project.

1. Update Atollic TrueSTUDIO build options.

Make sure that pre-defined symbols, include paths, FPU selection and C/C++ language settings match the original project.

With one exception, all pre-defined symbols and search paths have already have been updated, but you should make sure that options like FPU and C/C++ language matches the original project.

The exception mentioned in the paragraph above is the CMSIS include path. In EWARM, you can specify to use CMSIS with the Use CMSIS option.

iarimport6.png

If Use CMSIS is checked, you will need to add a path to the CMSIS library to use in your application. You can do this in the Directory part of the C Compiler settings. The path to add is the absolute path to the CMSIS/Include located in your EWARM installation, typically something like this:

C:\Program Files (x86)\IAR Systems\Embedded Workbench x.x\arm\CMSIS\Include

In the Directory part of the C Compiler setting (see picture below), click the Add… button to add your path.

 

iarimport7.png

 

2. Modify or replace assembler source files.

The IAR assembler code syntax differs from what is used by Atollic TrueSTUDIO so you will have to rewrite all assembler source code.

A special case is the startup file that comes with most projects and usually are written in assembler code. Atollic TrueSTUDIO can generate this startup file for you so that you do not have to write this code yourself.

A recommended way is to add an. iar extension to the startup file that was added to your imported EWARM project. After this you can add a Atollic TrueSTUDIO startup file based on the same ARM device to your imported project. If you created a dummy project as described in the tip above, then you can simply drag-and-drop the startup file from your dummy project to your imported project.

Once you have your new startup file, you can compare it against the original startup file. You can ignore the C/C++ initialization code since you will be using Atollic TrueSTUDIO standard libraries and you are using an Atollic TrueSTUDIO generated startup file now.

What you should pay attention to is for example the content of vector table and exception/interrupt handlers. For example, interrupt handlers that was implemented and used in the original project must also be implemented in our new startup file.

3. Add an Atollic TrueSTUDIO linker script file.

No linker script file is included so you need to add one that matches what you had in your original EWARM project. A starting point is to have Atollic TrueSTUDIO generate a linker script file that is based on the same ARM device as the original project and add that linker script file to your imported project.

If you have a dummy project as described above, then you can simply, in the Atollic TrueSTUDIO Project Explorer, drag-and-drop that linker script file into the root of your imported project.

You need to let the linker know which linker script file to use and this is done in the General Settings of the C++ Linker.

iarimport8.png

You can either browse to the linker script file, or if it is located in the root of your imported project, type in the path. In this example, I use STM32F4 so that path would be then “../stm32f4_flash.ld”.

With the linker script file in place you should make sure that your new application will be located in a similar way as the original application. Usually most memory segments do not have to be located at a specific address, but just in the correct memory region. There are however applications that require that some memory regions and entry labels are located at an absolute address. In this case, you should make sure your new application locates these regions/labels at the same memory location.

4. The last step before you try your build is to see if there are tool specific code in our project, other than the startup file mentioned above.

Applications and libraries that comes from silicon vendors or 3rd party companies can contain source code, or libraries, that are created just for a specific development toolchain. If this is the case in your project, then you should see if you can find that corresponding code for TrueSTUDIO or GCC and replace source code, libraries and include paths with the versions created for TrueSTUDIO or possible GCC.

As an example, FreeRTOS have a Source folder with a sub-folder called portable. Here you have source code ported to various development tool vendors. An imported EWARM project using FreeRTOS would normally contain files in the Source/portable/IAR folder. You should replace that code with the code in Source/portable/GCC.

Once you have replaced this code you must also update our build tools include paths so that any reference to Source/portable/IAR is changed to Source/portable/GCC.

Intrinsic functions are also part of code that can differ from tool vendor to tool vendor. Luckily CMSIS defines a set of intrinsic functions used for Cortex-M and both EWARM and Atollic TrueSTUDIO follow CMSIS. In order to make sure that you include declarations of CMSIS you should include CMSIS cmsis_gcc.h instead of EWARM intrinsics.h in our source code.

You are now ready to build the newly imported project and correct any remaining error and check warnings.

Common Build Errors

This section will list and suggest solutions for the most common errors you would see after building a project imported from EWARM to Atollic TrueSTUDIO.

fatal error: intrinsics.h: No such file or directory

EWARM intrinsics.h mostly contains declarations of various intrinsic functions. Most of the ones used in a Cortex-M project are available in the CMSIS core_cmFunc.h and cmsis_gcc.h header files. So, what you can do is to replace all occurrences of intrinsics.h with for example cmsis_gcc.h.

undefined reference to ‘xyz'

Here, ‘xyz’ can be a variable or a function that is used in your application but not defined. One way to find where this missing variable/function should be defined is to find the definition in the original EWARM project.

There is a chance that the missing function could be defined as an intrinsic function that is not included in our core_cmFunc.h or cmsis_gcc.h header files.

Configuring the Debugger

After the imported project builds without errors, you can test and debug the application using any of the Atollic TrueSTUDIO supported debuggers. Before you download and debug your application you need to configure the debugger and you do this in the Debug Configuration dialog that you can access from the Run menu.

In the Main tab, you need to make sure that the Name of the ElfDwarf file is correct, as well as the Application and the Project selected.

iarimport9.png

After this is done, select the Debugger tab. Here, first of all select which Debug probe you will be using. Once you have selected debug probe you can modify the GDB Connection, select debug interface, add trace (if available) and more.

iarimport10.png

If you like to get more control over the download and debug session, then you can do this in the Startup Scripts tab. Here you can add commands to for example load additional files or debug information, chose to download without starting a debug session, stop at the application entry point or run to main (or any global label in your application) and much more.

Now you are ready to download and test your application, and you can do this by clicking on OK or Debug (depending on how you started the Debug Configuration dialog).

To try the new IAR Project import converter, you need to register to get the TrueSTUDIO v8.0 Beta.

IAR, IAR Systems and EmbeddedWorkbench are Trademarks or Registered trademarks of IAR Systems AB.

Topics: Atollic TrueSTUDIO

The new standard in ARM development

Subscribe