Step by step migration for EW430 4.20

Step by step migration for EW430 4.20

This is a quick step by step description on how to migrate code and embedded workbench projects from version 1.x to version 3.x of EW430. More detailed information about the migration process is available in the migration part in the MSP430 IAR Embedded Workbench Migration Guide.

Upgrading from version 2.x to version 3.x does not require any changes in your code. Some changes are however needed in the projects settings, especially if you are using the DLIB runtime library. See the MSP430 IAR Embedded Workbench Migration Guide for detailed information.

The migration process

The project file

  1. Start version 3.x of EW430. An empty workspace will be opened.

  2. From the Project menu select Add Existing Project to include your old project into the workspace. This step will create two new project files with the same name as the old one, but with the extensions .ewp and .ewd. The .ewp file contains all settings required to build the application while the .ewd file contains all settings related to the debugger. The old project file will remain untouched.

  3. The debugger related options will have to be set up again. It is recommended that you verify that also your other options has been set up correctly.

  4. To generate a text file with the command line equivalents of all project options in your old project, see the MSP430 IAR Embedded Workbench Migration Guide.

  5. The Device option on the Target options page in the General Options category must be set by hand, as it is new. This option will select the correct linker command file and device description file.

  6. If you have your own linker command file, compare this file with the original file in the old installation and make the required changes in a copy of the corresponding file in the new installation. The following segment names have been changed:

    Old name New name
    CDATA0 DATA16_ID
    CONST DATA16_C
    CSTR DATA16_C
    IDATA0 DATA16_I
    NO_INIT DATA16_N
    UDATA0 DATA16_Z
  7. The specification of runtime library has, together with the specification of, stack and heap size been moved from the linker command file. This means that it is possible to use the same linker command file for both C and assembler code. The library can be set on the Library Configuration options page in the General Options category. The size of the stack and the heap is specified on the Stack/Heap options page in the General Options category.

  8. Configure your library according to your requirements on the Library Configuration and Library Options page. The Compact math libraries option should be selected if you want to use the same floating-point arithmetics as in version 1 (only available for CLIB).

  9. Set any appropriate new options.

System startup and program entry

C source code

  1. Replace or modify used extended keywords according to the MSP430 IAR Embedded Workbench Migration Guide. The include file for the old intrinsics, in430.h, defines some of the old extended keywords and can be used if you want to keep the old syntax. However, the syntax of the following extended keywords must be changed:

    • Interrupt
      Old interrupt syntax:
          interrupt[VECTOR] void my_function(void)

      New interrupt syntax:

      
          #pragma vector=VECTOR
          __interrupt void my_function(void)
    • If you want to keep your source compatible with earlier version of the compiler the following code can be used:

      
          #if __VER__ < 200
          interrupt [ VECTOR ] void my_function( void )
          #else
          #pragma vector=VECTOR
          __interrupt void my_function( void )
          #endif
          {
          }
      

      The following error messages will be diplayed if the old interrupt syntax is used:
      Error[Pe077]: this declaration has no storage class or type specifier
      Error[Pe065]: expected a ";"

      A Perl script that can be used to make the conversion can be found in the 430\src\scripts directory. Perl can be downloaded from www.activestate.com

    • sfrb/sfrw
      These extened keywords have been removed and must be replaced:

      sfrb name = address;

      must be replaced with

      __no_init volatile unsigned char name @ address;

      and

      sfrw name = address;

      must be replaced with

      __no_init volatile unsigned short name @ address;

  2. Replace or modify used pragma directives according to the migration guide.

  3. Make sure that you do not use nested comments in your code, in ICC430 version 3, nested comment are never allowed.

  4. The new compiler uses a different C parser and a large number of new optimizations have been added, this might require that you must modify your source code. One example of this is a simple delay loop like:

    
        i = 50000;
        do (i--);
        while (i != 0);
    

    This code will be optimized away unless you declare the variable 'i' as a volatile.

  5. If your are using a I/O include file named io430xxx.h, you must change the name of the include file to msp430xxx.h. The new set of io430xxx.h files are using bit fields to define individual bits and will require that your code is changed.

Assembler source code

  1. Set the option Assembler only project on the Target options page in the General category.

  2. Replace used segment names according to this list:

    Old name New name
    CDATA0 DATA16_ID
    CONST DATA16_C
    CSTR DATA16_C
    IDATA0 DATA16_I
    NO_INIT DATA16_N
    UDATA0 DATA16_Z

    If you do not want to change the names of the segment in your code, you can include the file 430\inc\asm_segments430.h instead.

  3. If your are using a I/O include file named io430xxx.h, you must change the name of the include file to msp430xxx.h.

Library considerations

The library called IAR CLIB is the same library as in version 1, and can be used in the same way as before, with one exception:

If you are using the DLIB library, the following need to be considered: