Page 1 of 1


PostPosted: Thu Oct 18, 2007 9:16 am
by aek
A Salvo user reported the following steps necessary to build C++ Salvo applications using IAR's Embedded Workbench for ARM:
... the C++ integration was quite painless. Here are some notes:

(1) set Options C/C++Compiler/Language and set to "Automatic (extension based)"

(2) for .h files that are normally intended for c++ use, but need to be included in a .c file, add the following around all all declarations (essentially around the whole file)

#ifdef __cplusplus
extern "C" {

< body of file>

#ifdef __cplusplus

This will keep the c/c++ name spaces the same. Many compile errors will result if you don't modify salvo.h and files such as board.h (hardware definitions).

Misc. notes:
* It is safe and wise to use #pragma once to ensure a .h file is included only once.
* Salvo works great in either ARM or THUMB mode. I like thumb mode very much (its faster in the Atmel AT91SAM7 due to its built-in one word I-cache, plus code is about 40% smaller). Your choice.

One other note: I can compile all files at MAX optimization (or any level you wish) except for main.cpp which seems to require NONE. I don't know why this is as this file pretty much only has the Salvo task definitions, initialization, OSSched() and tasks. If I don't turn optimization off the code gets the processes running but does with a DATA ABORT (e.g. non-aligned access). So for now I just turn off optimization for this file only by "override project defaults".