This article explains how to tackle conversion of projects distributed by TI, usually for IAR Embedded Workbench or Code Composer Essentials, into projects that compile, link, and then work in CrossStudio. This article considers only IAR Embedded Workbench.
Although this article addresses projects provided by TI, it's useful when you are converting any project from Embedded Workbench to CrossWorks.
Where to start?
CrossWorks is mostly compatible with IAR's Embedded Workbench at the source level. In fact, TI have been making Code Composer Essentials compatible with Embedded Workbench at the source level too. So we recommend that you start converting an IAR EW project rather than a CCE project and we don't consider CCE further.
There are three distinct steps to getting an EW project to work under CrossWorks:
- Convert assembly language source files to assemble under CrossWorks.
- Convert C source files to compile under CrossWorks.
- Make changes to assembly language source files to account for calling convention changes.
After step two, you should have something that compiles and links but possibly does not work. After stage three, everything should work.
Making assembly language source files assemble
The format of CrossWorks assembler source code is mostly compatible with EW, but there are differences in naming conventions and directives. We'll set aside calling conventions for the moment and focus on simply getting EW source code to compile and link under CrossStudio.
Remove redundant directives
Delete all source lines that start with MODULE or RTMODEL as these are not required and have no equivalent in CrossWorks.
Change public symbol names
All symbols that are mentioned in PUBLIC directives should have an underscore prepended to them; CrossWorks maps the C object "foobar" to the assembly-level symbol "_foobar". You will also need to change all occurrences of that symbol name in the assembly source code itself, so it's best to do this mechanically using a search-and-replace with whole-word case-sensitive matching.
Deal with section name differences
EW uses different section naming conventions to CrossWorks. It's a simple matter of replacement in most cases.
- Replace RSEG DATA16_N with BSS.
- Replace RSEG CODE with CODE. (However, see below!)
- Replace COMMON INTVEC with VECTORS.
After making these changes, the source code should compile and link. If not, please get in touch with us by adding a comment to this article and I'll update it!
Making C source files compile
The CrossWorks C compiler accepts plain old C just like the EW C compiler does. There are differences, of course, where both compilers deviate from the C standard for real-time work (interrupts) and data layout (structure packing, bitfields, and so on).
Change assembly source for calling convention differences
EW and CrossWorks have different views on parameter passing, so if you are calling C functions from assembly code, or assembly code functions from C, you must pay attention to the way that registers are used.
If you find errors in this article, please drop us a note or add a comment.
As an example of what we have discussed here, I modified TI's SLAA307a application note sources and have attached them here.
You will find the original application note in PDF and the associated code files for IAR at: