 |
|
 |
MAEC TOOL NEWS:
MAECT-M3T-NC30WA-020301D
Notes on C Compiler M3T-NC30WA V.5.00 Release 1
|
Please take note of the following problem in using C compiler (with an assembler and integrated development environment) M3T-NC30WA V.5.00 Release 1 for the M16C/60, M16C/20, and M16C/10 series MCUs:
- On calling a function declared to be a #pragma SPECIAL directive command
- On debug information
- Problem on Calling a Function Declared to be a #pragma SPECIAL Directive
- 1.1 Description
- When function A calls out the function declared to be a #pragma SPECIAL directive (hereafter called a special page function) immediately before returning the results, M3T-NC30WA does not generate any rts instruction necessary to function A's returning.
- 1.2 Conditions
- This problem occurs if the following five conditions are satisfied:
- (1) A special page function is called inside function A.
- (2) Function A returns the results immediately after calling the special page function.
- (3) Function A does not construct any stack frame. (For details of construction of stack frames, see Section D.3.4 of NC30 V.5.00 User's Manual.)
- (4) The special page function has neither return values nor arguments passed to the stack.
- (5) Either of two optimizing options -OR and -OS is used at compilation.
- 1.3 Example
---------------------------------------------------------------------
#pragma SPECIAL 255 func()
void func(void); /* Condition (4) */
extern int gc;
void sub1(void) /* Condition (3) (Check the assembly-
{ language file.) */
if(gc){
func(); /* Condition (1) */
return; /* Condition (2) */
}
gc++;
}
void sub2(void) /* Condition (3) */
{
gc++;
func(); /* Condition (1) */
} /* Condition (2) */
---------------------------------------------------------------------
- 1.4 Workaround
- Immediately after calling a special page function, describe a dummy asm function.
[Example]
---------------------------------------------------------------------
#pragma SPECIAL 255 func()
void func(void);
extern int gc;
void sub1(void)
{
if(gc){
func();
asm(); /* A dummy asm function added */
return;
}
gc++;
}
void sub2(void)
{
gc++;
func();
asm(); /* A dummy asm function added */
}
---------------------------------------------------------------------
- 1.5 Schedule of Fixing the problem
- We plan to fix this problem in our next release.
Notes on C Compiler M3T-NC30WA V.5.00 Release 1 MAECT-M3T-NC30WA-020301D
- Problem on Debug Information
- 2.1 Description
- M3T-NC30WA cannot correctly generate debug information on structures and unions in the absolute module file. Then, when debugger M3T-PD30 or M3T-PD30SIM downloads such an absolute module file, an error arises during downloading, resulting in the debugger's forced termination.
- 2.2 Condition
- This problem occurs when pointer declaration is made to the structure or union that is not yet defined.
- 2.3 Example
---------------------------------------------------------------------
/* The strtag structure is undefined
in the same file */
struct strtag *a; /* Pointer declaration */
---------------------------------------------------------------------
- 2.4 Workaround
- Before declaring a variable to be the pointer to a structure or union, be sure to define the structure or union.
[Example]
---------------------------------------------------------------------
struct strtag { /* A structure defined */
int i;
char c;
};
struct strtag *a; /* A pointer declared */
---------------------------------------------------------------------
- 2.5 Schedule of Fixing the Problem
- We plan to fix this problem in our next release.
|
 |