NEC ELECTRONICS GLOBAL
nec electronics global
HOME
APPLICATIONS
PRODUCTS
TECHNOLOGY
SUPPORT
BUY ONLINE
NEWS & EVENTS
ABOUT US
header
GO
AdvancedParametric
SITE MAP CONTACT US

[CC78K0S] General

Contents

    
FAQ-ID = CC_General-nnnn
0531: Do I have to consider the 2-byte alignment when describing programs in C?
0532: What should be done to place a variable with default value for only reference in ROM?
0533: What should be done to learn the address of a global variable described in C?
0539: Building with PM+ fails if #pragma section command is executed.
0542: There are startup routines “Normal”, “For boot area”, and “For flash area”.  Which should be used?
0596: Can a bit field of 32 bits be created?
CC_General
-0531
Do I have to consider the 2-byte alignment when describing programs in C?
Q1
In the case of an assembly language description with the 78K0 and 78K0S, I know we should take the 2-byte alignment into consideration when using an instruction such as MOVW.
Does the same apply when description is made in the C language?
A1
When describing programs in C, you need not to take the alignment into consideration because the C compiler aligns the parts described in C.

Note, however, that a gap may be created between structures as shown in the figure below, when the C compiler performs alignment.
(Example)

	struct {
		unsigned char a;
		unsigned short b;
	}s;

-78K0- -78K0S-

Is this information useful for you ?
back to top  
(2006/07)

CC_General
-0532
What should be done to place a variable with default value for only reference in ROM?
Q1
What should be done to place a variable with default value for only reference in ROM?
A1
Specify a count qualifier.
(Example)

	const int a=0x12;  /* Placed in ROM */
	int b=0x12;        /* Placed in ROM/RAM */
Variable a is placed in ROM. For variable b, the default value is placed in ROM and the variable itself is placed in RAM.
(Both ROM and RAM areas are required.)
Copy the default value in ROM to the variable in RAM by using the ROMization processing of the startup routine.
As a result of ROMization, an area is necessary in both ROM and RAM

-78K0- -78K0S- -78K4-

Is this information useful for you ?
back to top  
(2006/07)

CC_General
-0533
What should be done to learn the address of a global variable described in C?
Q1
What should be done to learn the address of a global variable described in C?
Can anything like a list be output?
A1
Specify the -KP option of the linker.
A list of global symbols will be output as link map information.
This list shows the value of symbols (address of variables).

-78K0- -78K0S- -78K4-

Is this information useful for you ?
back to top  
(2006/07)

CC_General
-0539
Building with PM+ fails if #pragma section command is executed.
Q1
The following source is described to change the section of a variable but the C compiler does not generate an object.
Therefore, building with PM+ fails. What should be done?
        #pragma section @@DATA DATA1
        int b;
        #pragma section @@DATA @@DATA
A1
If the #pragma section command is executed after describing the body text in C, an object module file is not created but an assembler source file is created.
Consequently, building fails.
Specify the -SA or -A option that outputs an assembler source file when setting a compiler option.
PM+ starts up the assembler following the compiler, and an object is generated.

-78K0- -78K0S- -78K4-

Is this information useful for you ?
back to top  
(2006/07)

CC_General
-0542
There are startup routines “Normal”, “For boot area”, and “For flash area”.  Which should be used?
Q1
There are startup routines "Normal", "For boot area", and "For flash area".
Which should be used?
A1
Use "Normal" for a device that does not have a flash area self-rewriting function.

Use a startup routine "For boot area" in the boot area, and "For flash area" in the flash area.

"For boot area" and "For flash area" should be used as follows.
  • For boot area
    Use this startup routine in the boot area that is not rewritten when the flash area self-rewriting function is used.
    After RESET, call startup routine _@cstart in the boot area.
    The other interrupt vector defines an address in the flash area.
    After calling the _boot_main function in startup routine _@cstart, the program branches to ITBLTOP, first address of the flash area.

  • For flash area
    Use this startup routine in the flash area that is rewritten when the flash area self-rewriting function is used.
    Call startup routine for flash area, _@cstarte, to ITBLTOP that is the part corresponding to RESET of a vector for the flash area.
    After that, call the main function.


The operation is as follows at reset. RESET interrupt vector (boot area)
-> _@cstart (boot area)
-> _boot_main function (boot area)
-> ITBLTOP address (flash area)
-> _@cstarte (flash area)
-> _main function (flash area)

-78K0- -78K0S- -78K4-

Is this information useful for you ?
back to top  
(2006/07)

CC_General
-0596
Can a bit field of 32 bits be created?
Q1
Can a bit field of 32 bits be created?
A1
No.

A bit field is of int type with ANSI.

With CC78Kx, a bit field can be extended to be char type.

-78K0- -78K0S- -78K4-

Is this information useful for you ?
back to top  
(2006/07)









































 LEGAL  RSS Feeds       © 1995-2008  NEC Electronics Corporation