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
Start version 3.x of EW430. An empty workspace will be opened.
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.
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.
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.
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 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.
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).
Set any appropriate new options.
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.
System startup and program entry
The
cstartup.s43
file has been split into two files,cstartup.s43
andcexit.s43
. If you need to customize the system startup, make the required changes to the newcstartup.s43
file and just include this file to your project.There is a new linker option Entry Lable (-s) to specify a start lable available on the Config page of the Linker category. In version 3.x, the default program entry label in cstartup.s43 is
__program_start
, which means the linker will start loading from there.If you build your application from the command line, the -s option must be explicitly specified when linking a C/C++ application. If you link without the option, the resulting output executable will be empty because no modules will be referred to.
In an assembler code only project, you do not need a start label. Use the linker configuration option Defined by application for assembler-only projects.
C source code
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
- Interrupt
- 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;
Replace or modify used pragma directives according to the migration guide.
Make sure that you do not use nested comments in your code, in ICC430 version 3, nested comment are never allowed.
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.
- If your are using a I/O include file named
io430xxx.h
, you must change the name of the include file tomsp430xxx.h
. The new set ofio430xxx.h
files are using bit fields to define individual bits and will require that your code is changed.
Assembler source code
Set the option Assembler only project on the Target options page in the General category.
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.If your are using a I/O include file named
io430xxx.h
, you must change the name of the include file tomsp430xxx.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:
To use the hardware multiplier peripheral unit, make sure that Hardware multiplier is selected on the Target options page, or, on the command line, extend the linker command line with
-f multiplier.xcl
.
If you are using the DLIB library, the following need to be considered:
A library configuration file has been introduced to configure what parts to include in a library when building it. Each library file has one corresponding library configuration file.
The library configuration file must also be used when building the application that will use the library, to ensure that the standard header files will be used in the same way as when the library was built. For all prebuilt libraries in the
430\lib
directory, there is a library configuration file (.h) with the same name.When using the IAR Embedded Workbench, the correct library configuration file will be selected automatically.
When building on the command line, you must make sure that the correct configuration file is used. For example, if the application will be linked with the library
...\430\lib\dl430dn.r43
, each compilation must use the corresponding library configuration file...\430\lib\dl430dn.h
.icc430 -D_DLIB_CONFIG_FILE=...\430\lib\dlib\dl430dn.h file.c
Detailed information about the configuration of the DLIB library can be found in The DLIB runtime environment chapter in the MSP430 IAR C/C++ Compiler Reference Guide.