 |
|
 |
MESC TOOL NEWS:
MESCT-NC308WA_2-001001D
NC308WA V.3.00 Release 1 NC30WA V.4.00 Release 1 and NC79WA V.4.00 Release 1 Precautions
|
- Please take note of the following problems in using C compilers (with an assembler and integrated development environment):
| NC308WA |
for the M16C/80 series MCUs
|
| NC30WA |
for the M16C/60 and M16C/20 series MCUs
|
| NC79WA |
for the 7900 series MCUs
|
- * Describing the condition expression that tests bit fields in an "if" statement may result in incorrect code being generated.
- * Utilities utl308, utl30, and utl79 may unexpectedly terminate their processing.
| utl308: | SBDATA declaration and SPECIAL Page Function declaration utility included with NC308WA V.3.00 Release 1 |
| utl30: | SBDATA declaration and SPECIAL Page Function declaration utility included with NC30WA V.4.00 Release 1 |
| utl79: | DPnDATA declaration utility included with NC79WA V.4.00 Release 1 |
- If the condition expression in an if statement comprises two or more expressions testing a bit field each and performs the logical AND operation of them, incorrect code will be generated.
- 1.1 Versions Concerned
- NC308WA V.3.00 Release 1
- NC30WA V.4.00 Release 1
- NC79WA V.4.00 Release 1
- 1.2 Conditions
- This problem occurs if the following four conditions are satisfied:
- (1) Options "-OR -O4" or "-OR -O5" are used.
- (2) The condition expression in an if statement consists of two or more expressions that test a bit field each.
- (3) The condition expression performs the logical AND operation (with && operators) of all the expressions that test a bit field each.
- (4) Each expression inside the condition expression checks either a bit field equals to 0 ("==0") or equals to 1 ("==1"), and at least one expression checks a bit field equals to 1 ("==1").
- 1.3 Example
-----------------------------------------------------------------------
struct {
unsigned int b0:1;
unsigned int b1:1;
unsigned int b2:1;
} s;
int i;
void func(void)
{
if ((s.b0 == 0) && (s.b1 == 1) && (s.b2 == 0)) {
i++;
}
}
-----------------------------------------------------------------------
- 1.4 Workaround
- Use the "-Ono_logical_or_combine"(-ONLOC) option, which will suppress the above optimization if it causes the problem to arise.
- 1.5 Schedule of Fixing Problem
- We plan to fix this problem in our next release.
NC308WA V.3.00 Release 1, NC30WA V.4.00 Release 1 and NC79WA V.4.00 Release 1 Precautions MESCT-NC308WA_2-001001D
- Utilities utl308, utl30, and utl79 may unexpectedly terminate their processing.
- 2.1 Versions Concerned
- utl308 included with NC308WA V.3.00 Release 1
- (SBDATA declaration and SPECIAL Page Function declaration utility)
- utl30 included with NC30WA V.4.00 Release 1
- (SBDATA declaration and SPECIAL Page Function declaration utility)
- utl79 included with NC79WA V.4.00 Release 1
- (DPnDATA declaration utility)
- 2.2 Conditions
- This problem occurs if the following two conditions are satisfied:
- (1) A variable or function is defined in the assembler.
- * If a variable defined, the area for the variable is reserved in the source file written in assembly language.
- * If a function defined, the processing of the function is described in the source file written in assembly language.
- (2) The reference of the variable or function in (1) is made to the C source file.
- 2.3 Example
- (1) A variable defined
[Assembly-language source file: source1.a30]
----------------------------------------------------------------
.section asm_area,data
.glb _data1
_data1:
.blkw 1 ; Condition (1)
.end
----------------------------------------------------------------
[C-language source file: source2.c]
----------------------------------------------------------------
extern int data1;
void func1(void)
{
data1 = 0; /* Condition (2) */
}
----------------------------------------------------------------
- (2) A function defined
[Assembly-language source file: source3.a30]
----------------------------------------------------------------
.section asm_prog,code
.glb _func2
_func2: ; Condition (1)
mov.w #0123H,R0
rts
.end
----------------------------------------------------------------
[C-language source file: source4.c]
----------------------------------------------------------------
int func2(void);
int main(void)
{
int i;
i = func2(); /* Condition (2) */
return i;
}
----------------------------------------------------------------
- 2.4 Workaround
- (1) For the variable
- Comment out the reservation of the area for the variable in the assembly-language source file; then, reserve it in the C-language source file.
[Assembly-language source file: source1.a30]
----------------------------------------------------------------
.section asm_area,data
; The section where data is placed depends
; on the description in C source file
.glb _data1
; _data1: ; Comment out the label
; .blkw 1 ; Comment out the directive for reserving the area
.end
----------------------------------------------------------------
[C language source file: source2.c]
----------------------------------------------------------------
int data1; /* Remove extern */
void func1(void)
{
data1 = 0;
}
----------------------------------------------------------------
- (2) For the function
- Comment out the processing of the function described in the assembly-language source file; then, describe them in the C source file, in which also describe mnemonics in between #pragma ASM and #pragma ENDASM or using asm functions.
[Assembly language source file: source3.a30]
----------------------------------------------------------------
.section asm_prog,code
; The section where data is placed depends
; on the description in C source file
.glb _func2
; _func2: ; Comment out the label and all the processing
; mov.w #0123H,R0
; rts
.end
----------------------------------------------------------------
[C language source file: source4.c]
-------------------------------------------------------------
int func2(void);
int main(void)
{
int i;
i = func2();
return i;
}
#pragma SECTION program asm_prog
/* Add the definition of the function */
int func2(void)
{
/* Add the processing commented out
in assembly-language source file */
#pragma ASM
mov.w #0123H,R0
rts
#pragma ENDASM
}
-------------------------------------------------------------
- 2.5 Schedule of Fixing Problem
- We plan to fix this problem in our next release.
|
 |