Old Company Name in Catalogs and Other Documents
Old Company Name in Catalogs and Other Documents
Old Company Name in Catalogs and Other Documents
On April 1st, 2010, NEC Electronics Corporation merged with Renesas Technology
Corporation, and Renesas Electronics Corporation took over all the business of both
companies. Therefore, although the old company name remains in this document, it is a valid
Renesas Electronics document. We appreciate your understanding.
(Note 1) “Renesas Electronics” as used in this document means Renesas Electronics Corporation and also includes its majority-
owned subsidiaries.
(Note 2) “Renesas Electronics product(s)” means any product developed or manufactured by or for Renesas Electronics.
Application Notes
This document explains how to migrate the sample project created in M16C to RX.
Table of contents
Figure 1-1
Figure 1-2
Figure 1-3
Figure 1-4
Figure 1-5
Figure 1-6
Figure 1-7
Figure 1-8
Figure 1-9
Figure 1-10
Figure 1-11
Figure 1-12
Figure 1-13
Figure 1-14
Figure 1-15
Figure 1-16
Figure 1-17
Figure 1-18
Output window
Figure 1-19
double d1 = 1E30;
double d2 = 1E20;
void double_size(void)
{
d1 = d1 * d1;
d2 = d2 * d2;
When migrating to RX a program created with the requirement that the size of the double type is 8 bytes, specify the “dbl_size=8”
option. For details about specifying this option, see compiler users manual. Also, change the options specified in the created RX
project.
if (bit == 1) {
printf("OK¥n");
} else {
printf("NG¥n");
}
}
Notes
In addition to #pragma BITADDRESS, “pragma_BITADDRESS.c” also uses the “_Bool” type, which poses a problem for
ANSI-standard C89. To use the “_Bool” type in RX, specify the “lang=c99” option to use ANSI-standard C99. For details about
specifying this option, see compiler users manual.
Since #pragma PARAMETER is disregarded by RX compilers, “M16C_pragma_PARAMETER.c” does not need to be changed.
Since “M16C_pragma_PARAMETER_asm.a30” in the assembler source code of the M16C sample project cannot be migrated as
is to the RX project, a new assembler source file needs to be created, and assembler code for RX needs to be added and registered.
Since the M16C sample project contains the “RX_pragma_PARAMETER_asm.src” file with assembler code for RX already coded,
register it with the RX project.
• When performing builds with ANSI-standard C89, change inline code to #pragma inline.
• Perform builds with ANSI-standard C99.
The following gives an example of code using #pragma inline. Change the RX sample project as follows.
Notes
To use inline keywords without modifying the source, specify the “lang=c99” option to enable ANSI-standard C99. For details
about how to specify this option, see compiler users manual..
Note that C99 inline keywords require precaution due to the following two traits:
• Inline expansions are not always performed, such as when the “noinline” option is specified, or conditions are not met for the
“inline” option.
• The function specified by an inline keyword is internally linked, and therefore subject to deletion.
Since “M16C_inline_keyword2.c” in the sample program satisfies the above two conditions, when compilation is performed with the
“lang=c99” option, the definition of the inline_func function is deleted regardless of whether inline expansion is performed. As such,
a link error will occur because the inline_func function is undefined. Perform one of the following as a workaround.
• Replace inline keywords with #pragma inline, and perform unconditional inline expansion.
• Add inline functions to the extern specification, to be linked externally.
int get_value()
{
return inline_func();
}
2.5 Rebuilding
Once the specified options and source code causing compatibility problems have been changed as shown in 2.4
Handling compatibility check instructions, rebuild the project as shown in 2.3(2) Building. When the following dialog
box is displayed for a successful build, click Yes, and then download the load module.
Figure 1-20
Figure 1-21
Notes
M16C provides the following two options to promote char type data to the int type during evaluation. If either of these options is
specified, the difference in integer promotion specifications discussed here will not occur.
• -fansi
• -fextend_to_int
typedef union{
long data;
struct {
int dataH;
int dataL;
} s;
} UN;
void int_size(void)
{
UN u;
u.data = 0x7f6f5f4f;
To migrate to RX programs created based on the requirement that the size of the int type is 2 bytes, specify the “int_to_short”
option. For details about specifying this option, see 1.3 Specifying the size of int type variables in C/C++ Compiler Package for the
RX Family Application Notes: RX Migration Guide, M16C Edition. Also, change the options specified for the created RX project.
For details about how to specify this option, see compiler users manual.
Contact information
http://japan.renesas.com/inquiry
[email protected]