Migrating from EWA90 to EWAVR

Updated: 06/Jul/2001 [IOLW]
Archived: $Revision: 1.5 $

SUMMARY

KEYWORDS

Background

Required Modifications

The Solution

The Migration Process

  1. Install the IAR Embedded Workbench toolkit with the AVR IAR C/EC++ Compiler toolkit in a directory separate from the AT90S IAR C Compiler. Make sure that all your source code files and project files are kept apart.
  2. Create a new project and copy your existing source code files to it.
  3. Examine the use of doubles in the existing source code.

    The AT90S IAR C Compiler supports only 4-byte doubles, while the AVR IAR C/EC++ Compiler supports both 4-byte and 8-byte doubles. Use the compiler option -–64bit_doubles to control the size of the double type.

    If you do not use 8-byte doubles, it is not necessary not modify doubles in the source code.

  4. Replace the AT90S IAR C Compiler extended keywords in the source code with AVR IAR C/EC++ Compiler keywords.

    In the AVR IAR C/EC++ Compiler, all extended keywords except asm start with two underscores, for example __near. This is taken care of by the migration macros in the file comp_a90.h.

    Notice that the behavior of the following extended keywords has changed: memory specification keywords (for example, __near and __flash), __no_init, __interrupt, and __monitor.

    In the AVR IAR C/EC++ Compiler, the sfrb and sfrw keywords are not available. Replace sfrb with volatile __io unsigned char and replace sfrw with volatile __io unsigned int.

    Refer to the AVR IAR C/EC++ Compiler Reference Guide for details.

  5. Replace the AT90S IAR C Compiler #pragma directives with AVR IAR C/EC++ Compiler directives. Notice that the behavior differs between the two products. For example:

    The set of #pragma directives in the AVR IAR C/EC++ Compiler is quite different from that in the AT90S IAR C Compiler. Refer to the AVR IAR C/EC++ Compiler Reference Guide for details.

  6. Replace the AT90S IAR C Compiler intrinsic functions with AVR IAR C/EC++ Compiler intrinsic functions.

    In the AVR IAR C/EC++ Compiler, the intrinsic functions start with two underscores, for example __enable_interrupt. This is taken care of by the migration macros in the file comp_a90.h.

    The AT90S IAR C Compiler intrinsic functions _args$ and _argt$ are not available in the AVR IAR C/EC++ Compiler. Other AT90S IAR C Compiler intrinsic functions are available, but have new names in the AVR IAR C/EC++ Compiler. The translation of names is taken care of by the migration macros in the file comp_a90.h.

    New intrinsic functions have been added in the AVR IAR C/EC++ Compiler. Refer to the AVR IAR C/EC++ Compiler Reference Guide for details.

  7. Rewrite interrupt functions from: to
  8. Modify the predefined symbols.

    In the AVR IAR C/EC++ Compiler, all predefined symbols start and end with double underscores, for example __IAR_SYSTEMS_ICC__.

    New predefined symbols have been added in the AVR IAR C/EC++ Compiler, for example, __ICCAVR__ which allows you to distinguish between the compilers. See the AVR IAR C/EC++ Compiler Reference Guide for details.

  9. Compile the code using appropriate AVR IAR C/EC++ Compiler compiler options; these are described in the chapter Compiler options in the AVR IAR C Compiler Reference Guide. If you use the IAR Embedded Workbench, refer to the AVR IAR Embedded Workbench User Guide.
  10. Use one of the ready-made linker command files provided with the product to link the code. Alternatively, use the appropriate linker command file template and modify it in accordance with the requirements of your application. This is described in the Configuration chapter in the AVR IAR C/EC++ Compiler Reference Guide.
  11. Run the project in the IAR C-SPY Debugger in order to sort out any remaining problems.

The User Benefits

Conclusion

Copyright 2000-2001 IAR Systems. All rights reserved.