CA850
Contents
FAQ-ID = v85ca- nnnn
v85ca -0001
|
Recovering stack frames
|
| Q1 |
How do the stack frames saved with setjmp() return by longjmp() when using the CA850?
|
| A1 |
Stack frames are not used with setjmp()/longjmp().
With these functions, global variables are used for data exchange.
|
v85ca -0002
|
Referencing the PSW in C language
|
| Q1 |
How can the PSW be accessed using C language?
|
| A1 |
The PSW cannot be accessed using C language.
To access the PSW using C language,
you have to describe an assembler instruction
(use an asm declaration or declare asm using the #pragma directive).
For details of the assembler description method,
refer to 4.4 "Describing Assembler Directives" in the C Language User's Manual.
|
v85ca -0003
|
Initialization of external RAM
|
| Q1 |
I want to use external SRAM.
Do I have to clear the external SRAM at startup?
|
| A1 |
Basically you do not have to clear external SRAM.
To clear memory, you have to preset the target block (such as BCT, BSC, and DWC)
and if necessary, PMCAL, PMCAH, PMCDL, PMCS, PMCT, etc.
Since memory initialization takes time,
it is recommended to initialize only when time is not critical,
and if you want to initialize variables, then initialize only the required areas.
|
v85ca -0004
|
Result of 0 division
|
| Q1 |
What is the result of dividing a value by 0 or dividing a maximum negative value
(0x8000 for short type) by -1 ?
|
| A1 |
The results vary depending on the device used.
For short type, the results may vary depending on the target device
because the divide instruction of the actual device is used, instead of a library function.
If a library function is used in the CA850,
the MATHERR function returns Z_DIVISION for division by 0.
|
v85ca -0005
|
Absolute address specified in C language
|
| Q1 |
How should I describe in C language to access data of a specific address?
|
| A1 |
Declare the address you want to use (with a volatile declaration) and assign a name.
For example, assume that address 10000H consists of 8-bit data and its name is PORT1.
In this case, declare as:
#define PORT1 *((volatile unsigned char *) 0x10000)
You can access this address by:
PORT1 = 0x5;
|
v85ca -0006
|
Bug (V2.30 and earlier) prevention option specifications (-Wo, -XTb)
|
| Q1 |
The -Wo and -XTb options are recommended as a measure for preventing the CA703000: C compiler bug
(SBG-T-2264-E: 5.3 1-bit manipulation using &,|, or ^).
Do I have to specify both of these options?
|
| A1 |
Both options must be specified consecutively,
as "-Wo, -XTb".
If only one option is specified without specifying the other
or if these options are specified in branched locations,
the operation cannot be guaranteed.
Be sure to describe both of them in succession as "-Wo, -XTb".
|
v85ca -0007
|
When unsigned short is shifted, it gets extended to the long type.
|
| Q1 |
Why does 0x1217 get extended to the long type
even though it has been cast to the unsigned short type?
|
| A1 |
Even if 0x1217 is cast to the unsigned short type,
it is converted to the int type because the value exceeds the range of the unsigned short type
due to the following shift operation.
That is, this is a matter of operation order.
Convert it to the unsigned short type by shifting it first then casting the result.
|
v85ca -0008
|
Interrupt handler description
|
| Q1 |
I would like to ask a question about the description in 4.8 Describing
"Interrupt/Exception Handlers" (p.77) of the CA850 C Compiler Package C Language User's Manual.
Can I register a function name pointer in the interrupt vector area by describing
as instructed on p.78 [To specify the interrupt function].
Or should I define a specific vector address?
Can I describe an interrupt handler in C language only?
|
| A1 |
You can describe an interrupt handler in C language only.
|
v85ca -0009
|
Saving of the work registers (r10 through r14) for the interrupt handler
|
| Q1 |
I am creating a source to call an assembly module from C language within the interrupt handler.
On p.113 of the C Language User's Manual (U15025EJ1V0UM00),
there is a description
"When using the register variable register in the assembly-language source program,
make sure that the value of the register variable register is retained both before and
after calling the program".
However, there is no description about work registers (r10-r14).
If work registers are used in an assembly source, is there any effect on C language?
Is it OK not to retain the values of work registers during assembly?
|
| A1 |
When an interrupt handler is described in C language
(when register saving at the beginning of the interrupt handler
and register restoration at the end of the interrupt handler are completely performed in C language),
the use of work registers has no effect on C language
if an assembler description module is just called in the C program of that handler.
|
v85ca -0010
|
Link directive description sequence
|
| Q1 |
I would like to ask a question about how to create a link directive file.
Data is mapped at 0x800000, and then CONST is mapped at 0x70000.
I want the program to be executed by booting it from external EPROM, but it does not work normally.
|
| A1 |
The address of CONST is lower than the address of data.
Such an arrangement is not allowed. Arrange them in address order
(refer to 6.4 "Link Directive Format" in the Operation manual).
|
v85ca -0011
|
romp850 ROMization tool
|
| Q1 |
The compiler CA850 for the V850 contains a HEX converter (HX850)
that converts an object file (.out) created by normal build into the HEX format for ROM.
I think I can create a HEX file for ROM by using this HEX converter.
Why is a ROMization processor (romp850) tool provided?
|
| A1 |
You may have misunderstood the application of this tool.
The HEX converter is used only for converting the object format into the HEX format
and has no direct relation to ROMization referred to in the CA850.
You may have confused conversion to the HEX format with ROMization,
because the HEX format can be read by the ROM programmer.
ROMization in the CA850 involves setting the initial value of variables with an initial value,
storing in ROM a program to be executed in the internal RAM area,
and copying it from ROM to the actual execution area (RAM) when the program is started.
|
| |
| Q2 |
In a V850 + FlashROM + SRAM environment,
all the executable programs of the system are written into flash memory.
In this case, do I have to use the ROMization processor?
|
| A2 |
If you use a configuration in which a variable with an initial value is used
or a program is executed in RAM, you have to use the ROMization processor.
|
v85ca -0012
|
Library creation
|
| Q1 |
I would like to put some functions into a library.
How can a library be created? (I cannot find appropriate options for creating a library.)
|
| A1 |
Library creation is provided as an archiver function not as option specification.
The actual library creation procedures are described in Chapter 9 "Archiver"
in the Operation user's manual.
|
v85ca -0013
|
Operating environment (multiprocessor)
|
| Q1 |
I'm using the CA850 development environment on Windows NT 4.0.
Does the CPU of a PC work in a multiprocessor environment?
|
| A1 |
The CPU of a PC may work even in a multiprocessor environment.
However, an improvement in the performance cannot be expected
because use of multiprocessors is not valid according to the specifications.
|
v85ca -0014
|
Volatile modifiers
|
| Q1 |
I have set the optimization level to "Basic optimization".
Do I have to attach a volatile declaration to variables whose values are changed externally?
(Currently, no volatile declaration is attached.)
|
| A1 |
Attach a volatile declaration.
Even in the case of basic optimization, those variables may possibly be optimized.
In the case you stated in your question, be sure to attach a volatile declaration.
|
| Q1 |
In the CA850, a source file including a loop is not expanded normally
when optimization = speed-prioritized (-Ot).
|
| A1 |
This results from an attempt to reduce the execution time of this loop for optimization.
When an asm statement is described,
optimization is not performed because it is not known how the relevant part is processed.
If you need a certain number of instructions to be executed
(for example, when you want processing to wait by using a loop),
describe it in assembly language
(when described in C language, the effect of optimization may differ depending on future upgrading.)
|
| Q1 |
I want to reserve several mega bytes (8 to 10 MB) for a HEAP area.
However, I don't know which section the HEAP area is to be allocated to.
|
| A1 |
The HEAP area is defined as shown below:
----------------------------------------------------------
#define SIZEOF_HEAP 0x800000
int __sysheap[SIZEOF_HEAP>>2];
size_t __sizeof_sysheap = SIZEOF_HEAP;
----------------------------------------------------------
By changing the section name as shown below, create a section other than the .bss section.
----------------------------------------------------------
#define SIZEOF_HEAP 0x1000
#pragma section data "sss" begin
int __sysheap[SIZEOF_HEAP>>2];
size_t __sizeof_sysheap = SIZEOF_HEAP;
#pragma section data "sss" end
----------------------------------------------------------
Specify the location of this newly created section using a link directive file.
-----------Excerpts from the link directive---------------
DATA1 : !LOAD ?RW V0x100000 L0x900000{
sss.data = $PROGBITS ?AW sss.data;
sss.bss = $NOBITS ?AW sss.bss;
};
DATA : !LOAD ?RW V0xffffc000 {
.data = $PROGBITS ?AW .data;
.sdata = $PROGBITS ?AWG .sdata;
.sbss = $NOBITS ?AWG .sbss;
.bss = $NOBITS ?AW .bss;
};
__tp_TEXT @ %TP_SYMBOL;
__gp_DATA @ %GP_SYMBOL &__tp_TEXT{DATA DATA1};
__ep_DATA @ %EP_SYMBOL;
----------------------------------------------------------
|
v85ca -0017
|
Translation limits
|
| Q1 |
When many #define statements are used, the following error is output during compilation.
eel750.h 349 cafe850 fatal error: F2120:
compiler limit: preprocessor token buffer overflow [65753]
Total error(s) : 1 Total warning(s) : 0
I guess this error occurs because the preprocessor buffer of the C compiler overflows
as a result of using too many preprocessors. Is this right?
|
| A1 |
This error occurs because the length of the expanded character strings
in the macro definitions exceeds the limit during preprocessor processing.
To solve this problem, try increasing the limit number by using the -Xm option,
which increases the maximum number of macro definitions
(when -Xm is not specified, num is assumed to be 2047,
and when ?Xm is specified, a value of up to 32767 can be specified).
|
v85ca -0018
|
Version information
|
| Q1 |
How I can know the version of the device file?
|
| A1 |
Version information can be displayed using the device file installer (DFINST)
included with 32-bit version development tools.
For a device file already installed,
version information should be displayed in the lower window of DFINST.
If the device file is not installed yet,
select the folder containing the device file
whose version information you want to display using the [Browse] button in the upper window.
The device file information in the selected folder is displayed.
|
v85ca -0019
|
Error message (symbol_reset multiply defined)
|
| Q1 |
I built a sample program using the CA850 (Project Manager).
When a _reset label is defined in the startup module,
the following message is displayed. Why is this message displayed?
Is _reset a reserved word or is it defined in a library, etc.?
|
| A1 |
_reset is not used in the CA850 but is used in the RX850.
We advise you not to use this symbol.
|
| |
| Q2 |
I want to build software (including a RESET interrupt),
without using the interrupt handler automatic allocation function
(#pragma Interrupt interrupt-request-name function-name).
How can I build such software?
|
| A2 |
When you use C language,
there is no other description method except using the interrupt handler automatic allocation function.
If you have to use another method, describe in assembly language.
Refer to the interrupt example in the Q&A (Q.1.14) of the Tutorial Guide.
V800 Series (TM) Development Tool Tutorial Guide Windows (TM) Based
|
v85ca -0020
|
Error message (SCRx is not defined)
|
| Q1 |
In the SFRs of the MA1, DRC1 and SCR1, DRC3 and SCR3, DRC4 and SCR4,
and DRC6 and SCR6 are set to the same address, respectively.
When compiled, a "Not Defined" error occurs for SCR1, SCR3, SCR4, and SCR6.
Is this a problem with the device file?
|
| A1 |
Yes it is.
The current device file defines DRCx only and does not define SCRx.
This is the reason for this error.
|
v85ca -0021
|
Error message (xxx is too far from ...)
|
| Q1 |
Why is the following error message is output?
|
| A1 |
This error message is output when the branch enabled range (22 bits)
of the jarl instruction used for function call in the CA850 is exceeded.
Specify the -Xfar_jump option.
For details, refer to 5.4 "Far jump Call from C Language Program" in the CA850 C Language User's Manual.
|
v85ca -0022
|
Error message (No load segment exist for ...)
|
| Q1 |
A static variable is declared in a function.
However, in the linker, an error and warning message is output as shown below:
ld850: warning: no LOAD segment exist for mapping input section ".sdata" in file "irtpr.o",
|
| A1 |
This message indicates that the ".sdata" section does not exist in the link directive.
Add a .sdata section specification in the link directive.
|
v85ca -0023
|
Error message (W2231)
|
| Q1 |
A warning message was output during C compilation in the CA850.
However, I don't know how to take corrective action.
Level 2 is set by a compiler option.
|
| A1 |
This warning only indicates that,
when a function address is specified as an initial value of an array,
the value is address (position) dependent (not position independent).
Since this is just a warning, simply ignore it.
This warning is output because warning level 2 is set.
If you don't want this warning to be output, do not set 2 for the warning level.
|
v85ca -0024
|
Error message (W2525)
|
| Q1 |
The following warning message is output.
W2525: illegal type combination for 'operator' (type1,type2)
However, I cannot find the cause.
|
| A1 |
This warning is output because the stWk1 address with const specification
is treated as a variable that is not const.
You can prevent this warning from being output by erasing the const specification
for stWk1 or adding a const specification to ptr1.
|
v85ca -0025
|
AS850 symbol definition
|
| Q1 |
The following codes are described in the assembler.
.str "ABCDEFGH"
.word 0x12345678
I want to define "ABCDEFGH" and "0x12345678" using #define in C language.
Are there any assembler directives or methods that can be used for this purpose?
|
| A1 |
The assembler only provides assembler directives (such as .set and .local) for defining symbol values.
If you want to define a string, define it by #define then use the CA850 as a preprocessor.
In this case, you have to start the CA850 from the command line by specifying the -E option
because you cannot use the Project Manager.
|
v85ca -0026
|
The message "Warning address is too long" is output.
|
| Q1 |
A compiler message "Warning: address is too long" is output after pm1.cmd.
What should I change to prevent this message from being output?
|
| A1 |
This message is output when the address range supported by the object format is exceeded
in the HEX converter.
For addresses in your program, you have to use a format that supports 32-bit addresses.
Specify -fs as a HEX converter option.
For details, refer to Chapter 8 "Hexadecimal Converter" in the Operation manual.
|
|