Precautions For Creation Of Sources - Epson S5U1C17001C Manual

Cmos 16-bit single chip microcontroller (c compiler package for s1c17 family) (ver. 3.2)
Hide thumbs Also See for S5U1C17001C:
Table of Contents

Advertisement

2.4 Precautions for Creation of Sources

(1)
Place a tab stop every 4 characters wherever possible. Source display/mixed display with the gdb debugger of a source set at a
tab interval other than 4 characters may result in displaced output of the source part.
(2)
When compiling/assembling a C source or assembly source that includes debugging information, do not include other source
files (by using #include). It may cause the gdb debugger operation error. This does not apply to ordinary header files that
do not contain sources.
(3)
When using C and assembler modules in a program, pay attention to the interface between the C functions and assembler
routines, such as arguments, size of return values and the parameter passing conventions.
(4)
The C compiler assumes that the address size is 24 bits by default. Therefore, be aware that the expected results may not be
obtained from an operation using an unsigned int/unsigned short type variable and a pointer, as int type variables
are 16-bit size, as shown below.
int* ip_Pt;
unsigned int i = 1;
ip_Pt += (-1)*i;
The code above is written to expect "ip_Pt += (-1);", however it will be processed as "ip_Pt += 0xffff;".
Although it will be processed normally when the address space is 16-bit size, an invalid address will result if the address
space is 24-bit size.
To perform a pointer operation when the address space is 24-bit size, avoid using unsigned int/unsigned short type
variables, or add the suffix 'L' to the constant as shown below so that it will be handled as a long type constant.
ip_Pt += (-1L)*i;
(5)
In C sources, function names can be used as the pointer to the function, note, however, that the pointer values cannot be
assigned to real type (float/double) variables and arrays using the function names.
They can be assigned to integer type variables and arrays.
However, if assigning a value to a global variable/array using a function name at the same time the variable/array is declared,
the types of variables/arrays are limited depending on the address space size.
In 24-bit address space (default condition)
The long/unsigned long type variables/arrays only allow substitution with a function name.
In 16-bit address space (when -mpointer16 is specified)
The short/unsigned short/int/unsigned int type variables/arrays only allow substitution with a function name.
If it is not at declaration, global variables/arrays in any integer type can be substituted with a function name.
Integer type local variables/arrays always allow substitution with a function name regardless of whether it is at declaration or
not.
Example: In 16-bit address space (when -mpointer16 is specified)
1) short s_Global_Val = (short)boot;
→ A function name can be used to assign the pointer to the short type global variable s_Global_Val when it is
declared.
2) long l_Global_Val = (long)boot;
→ An error occurs if a function name is assigned to the long type global variable l_Global_Val when it is
declared
error: initializer element is not constant
3) short s_local_val = (short)boot;
→ A function name can be used to assign the pointer to the short type local variable s_local_val.
4) long l_local_val = (long)boot;
→ A function name can be used to assign the pointer to the long type local variable l_local_val.
S5U1C17001C Manual
(Rev. 1.0)
Seiko Epson Corporation
2 Source Files
2-13

Advertisement

Table of Contents
loading

Table of Contents