Pumpkin, Inc.

Pumpkin User Forums

C++

For issues specific to ARM7 and ARM9 targets, including compilers (e.g. Keil's RealView MDK) and IDEs (e.g. IAR's C-SPY).

C++

Postby aek » Thu Oct 18, 2007 9:16 am

A Salvo user reported the following steps necessary to build C++ Salvo applications using IAR's Embedded Workbench for ARM:
quote:
... 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" {
#endif

< body of file>

#ifdef __cplusplus
}
#endif

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".


------------------

-------
aek
aek
 
Posts: 1888
Joined: Sat Aug 26, 2000 11:00 pm

Return to ARM (ARM7 & ARM9)

Who is online

Users browsing this forum: No registered users and 0 guests

cron