 |
|
 |
MAEC TOOL NEWS:
MAECT-CC32R-010616D
Please take note of the following problem in using cross-tool kit CC32R for the M32R family of microcomputers:
- Incorrect debug information may be output for auto-variables of type short or char, resulting in variables being not referenced properly by the debugger.
- Versions Concerned
CC32R V.1.00 Release 1 -- V.3.00 Release 1
- Description
When variables are assigned to the stack, debug information may not normally be output, so that debugger will not reference these variables.
Note that this problem is only for debug information; instruction code is created correctly.
- 2.1 Conditions
- This problem occurs if a group of variables meet conditions (1) through (4) below and another group of variables meet conditions (2) through (4), and their total number is more than ten in a function.
- (1) Variables are of type short or char (including signed and unsigned).
- (2) The storage class of variables is auto.
- (3) Variables do not reference addresses with the address operator (&).
- (4)
- (a) Variables are declared to be registers, or
- (b) optimizing options provided with the function of "-O4" are used at compiling the source files containing those variables.
- 2.2 How to Check Variables
- Whether auto-variables are assigned to the stack or not can be checked using the "ASSIGN" information outputted by the merging utility of C-language source files (cmerge); that is, the following information indicates that the variable is assigned to the stack.
;[ASSIGN] Variable name @(Offset value, R15)
If ten or more variables in a function meet the conditions in 2.1 and are all indicated by the above information, these variables would not be displayed correctly in the debugger.
- Note:
If a variable is assigned to a register, it is indicated by the following display.
;[ASSIGN] Variable name Register name
- 2.3 Example
- In variables v01 through v12 below, condition (4) is satisfied because option "-O4" is selected in the command procedure explained later.
-----------------------------------------------------------------------
extern int func1(void);
extern int func2(int, int, int, int);
void foo( void )
{
char v01 = 0x1001; /* Conditions (1) through (4) */
unsigned char v02 = 0x1002; /* Conditions (1) through (4) */
short v03 = 0x1003; /* Conditions (1) through (4) */
unsigned short v04 = 0x1074; /* Conditions (1) through (4) */
int v05 = 0x1005; /* Conditions (2) through (4) */
int v06 = 0x1006; /* Conditions (2) through (4) */
int v07 = 0x1007; /* Conditions (2) through (4) */
int v08 = 0x1008; /* Conditions (2) through (4) */
int v09 = 0x1009; /* Conditions (2) through (4) */
int v10 = 0x100a; /* Conditions (2) through (4) */
int v11 = 0x100b; /* Conditions (2) through (4) */
int v12 = 0x100c; /* Conditions (2) through (4) */
if (func1() == 2) {
v01 = 0x2001;
v02 = 0x2002;
v03 = 0x2003;
v04 = 0x2004;
v05 = 0x2005;
v06 = 0x2006;
v07 = 0x2007;
v08 = 0x2008;
v09 = 0x2009;
v10 = 0x200a;
v11 = 0x200b;
v12 = 0x200c;
}
func2(v01, v02, v03, v04);
func2(v05, v06, v07, v08);
func2(v09, v10, v11, v12);
}
-----------------------------------------------------------------------
Example of command procedure in CC32R (a % sign represents a prompt)
-----------------------------------------------------------------------
% cc32R -g -c -O4 test.c ... (Condition (b) in (4))
-----------------------------------------------------------------------
- When creating a load module in the SYSROF format by linking the object module generated (test.mo), and referencing variables by reading the load module into such a debugger as PD32R, variables v01 through v04 cannot properly be displayed on the debugger.
- Workaround
- This problem will be circumvented in either or both of the following ways depending on the conditions involved:
- (1) In the case where a variable is declared to be a register (Condition (a) in (4))
- -> Cancel the declaration of the variable to be a register
- (2) In the case where optimizing options with function of "-O4" are used (Condition (b) in (4))
- -> Add a code referencing an address with the operator(&) after the line declaring the variable involved.
-----------------------------------------------------------------
short var_shalf = 0x1072; /* The line declaring
the variable involved */
short *dummy_addr = &var_shalf; /* Add this line */
-----------------------------------------------------------------
* The assignment expression to the added variable "dummy_addr" is deleted by optimization.
- Schedule of Fixing the Problem
We plan to fix this problem in our next release.
|
 |