Download Using GHS Compiler with RH850

Transcript
Using GHS Compiler with RH850
2.3.2
RH850, GHS Compiler, Linker
Mixing Memory Models
The different addressing modes SDA and ZDA are allowed to be used
 In the same module
 Across modules in the same project
Using both modes simultaneously requires strong consistency over definition and declaration of the variables.
Example:
/*
* Module A.c
* Definition
*/
/*
* Module A.h
* Declarations
*/
__ZNEAR( const int, count1);
__SNEAR( long,
time);
__FAR(
long,
OtherCount);
__ZNEAR( extern const int, count1);
__SNEAR( extern long,
time);
__FAR(
extern long,
OtherCount);
Table 1 Symbol Definition/Declaration
Please note that the syntax used above is derived from C99 spec., using these definitions:
#define PRAGMA(x)
_Pragma(#x)
#define __SNEAR(type, x)
PRAGMA( ghs startsda)
type
x;
PRAGMA( ghs endsda);
\
\
#define __ZNEAR(type, x)
PRAGMA( ghs startzda)
type
x;
PRAGMA( ghs endzda);
\
\
#define __FAR(type, x)
PRAGMA( ghs startdata)
type
x;
PRAGMA( ghs enddata);
\
\
R20AN0330ED0200 Rev. 1.00
Oct. 27, 2014
Page 8 of 25