| |||||
Technical Support Support Resources
Product Information |
/****************************************************/
/* Release Notes to Version 4 */
/* 166/167 DEVELOPMENT TOOL KITS */
/****************************************************/
This file contains release notes and last minute changes relating to the
166/167 Version 4 tool chain. Information in this file, the accompanying
manual, and software is Copyright (c) 1998 Keil Software and Keil Elektronik.
All rights reserved.
Contents
========
1. uVision2 Integrated Development Environment
2. New Features in C166 Version 4.0
2.1 EXTENSIONS FOR ACCESSING BIT FIELDS
2.2 #pragma PACK & BYTEALIGN directive
2.3 PREPRINTONLY directive
2.4 ASMEXPAND, NOASMEXPAND directive
2.5 USERSTACKDPP3 directive
2.6 DYNAMICUSRSTK directive
2.7 NOFRAME directive
2.8 SAVESYS, SAVEUSR directive
2.9 OPTIMIZE(7) directive: Common Tail Merging
3. New Features in L166 Version 4.0
3.1 WARNING 22: CLASS RANGE NOT GIVEN IN INVOCATION LINE
3.2 DISABLEWARNING directive
3.3 CINITTAB directive
4. Example Programs
5. Sales and Technical Support
1. uVision2 Integrated Development Environment
This release includes uVision2 for Windows. uVision2 is an integrated
development environment that encapsulates a project manager, integrated
make facility, tool configuration, editor and a powerful debugger. You
use uVision2 to write, compile and debug your programs using our tools.
The example programs provided are designed to work with uVision2.
2. New Features in C166 Version 4.0
2.1 EXTENSIONS FOR ACCESSING BIT FIELDS
C166 supports now the accessing of bits in bit-field structures which are
located into the bdata address space.
Example:
struct test {
int bit0: 1;
int bit1: 1;
int bit2: 1;
int bit3: 1;
int bit4: 1;
int bit5: 1;
};
struct test bdata t;
void main (void) {
t.bit0 = 1;
if (t.bit1) t.bit2 = t.bit0;
}
A new memory type has been introduced to allow the access to extended bits of
the SFR area. This memory type has the name 'ebdata'. The memory class is
EBDATA or EBDATA0.
You can use this bit address mode also for accessing the SFR registers of the
166 derivatives. You must simply define all the CPU SFR registers in an
C source file and translate this file with the ORDER directive. Then you can
locate the section which contains the SFR definitions with the SECTIONS
directive:
Example:
L166 ... SECTIONS (?EB?SFRBIT%EBDATA (0F100H), ?BD?SFRBIT%BDATA (0FF00H))
You can also use the HOLD directive to locate bit-field structures which
contain members with bit size 1 to the BDATA memory class. The C166 compiler
handles accesses to such structures the same way as accesses to 166 hardware
bits.
Example:
C166 ... HOLD (bdata 2, near 6)
This will locate all structures with bit-field members an size < 2 bytes to
the bdata memory class. The access to such members is performed the same way
as bit accesses.
2.2 #pragma PACK & BYTEALIGN directive
The C166 Compiler supports a new directive pack which allows you to generate
BYTE aligned structures with word elements. This is useful when you exchange
data structures with other systems, where no alignments are required. The
directive is compatible to Microsoft C. The usage is shown in the following
sample program. It should be noted that the C166 compiler generates
considerably more code to access BYTE aligned WORDs. Therefore the pack(1)
directive should be used only, when you need it.
#pragma pack(1) /* alignment is BYTE for the following structures */
struct s1 {
int i1; // i1 has offset 0
char c1; // c1 has offset 2
int i2; // i2 has offset 3
char c2; // c2 has offset 5
int i3; // i3 has offset 6
char z1; // z1 has offset 8
};
#pragma pack() /* reset to default: WORD alignment */
struct s2 {
int i1; // i1 has offset 0
char c1; // c1 has offset 2
int i2; // i2 has offset 4
char c2; // c2 has offset 6
int i3; // i3 has offset 8
char z1; // z1 has offset 10
};
The pragma pack(1) assumes that you do not generate pointers to structures
which are not WORD aligned. If your application contains struct pointers
to byte-aligned structures, you must use in addition to the #pragma pack(1)
also the #pragma BYTEALIGN directive.
Example:
#pragma pack(1) /* alignment is BYTE for the following structures */
#pragma BYTEALIGN
struct s1 {
int i1; // i1 has offset 0
char c1; // c1 has offset 2
struct s2 {
int i2; // i2 has offset 3
char c2; // c2 has offset 5
int i3; // i3 has offset 6
} s2;
char z1; // z1 has offset 8
} s1;
struct s2 *s2p;
void main (void) {
s2p = &s1.s2; // this is a pointer to a bytealign struct
s2p->i2 = 0; // this is an access to a bytealign int
}
2.3 PREPRINTONLY (Abbr. PPO) directive
When you are using this directive, the C166 Compiler stops after pre-processing
the C source file. The PREPRINTONLY directive is similar to the PREPRINT
directive and has an optional output filename. The default filename for the
PREPRINT file is 'basename.I'.
Example: C166 myfile.c PREPRINTONLY (myfile.pp)
2.4 ASMEXPAND/NOASMEXPAND (Abbr. AE/NOAE) directive
The NOASMEXPAND directive instructs the C166 Compiler to copy the text
between #pragma asm & #pragma endasm without any pre-processor text
expansion. The default setting of C166 is ASMEXPAND where all symbols
used are expanded, even those symbols which are inside asm/endasm.
Example:
#pragma noasmexpand
#define abc 1
#define xx0 2
#define xx1 3
#pragma asm
abc equ 2 ; above 'abc' not expanded
xx0 equ 10 ; above 'xx0' not expanded
#ifdef QQQ
xx1 equ 20
#endif
#pragma endasm
int a = abc, b = xx0, c = xx1; /* expanded anyway. */
2.5 USERSTACKDPP3 (Abbr. U3) directive
The USERSTACKDPP3 directive changes the assuption made by the C166 Compiler
regarding the accesing of the USER STACK AREA. The default is that the
user stack is allocated in the NDATA memory area. You can change the memory
class to IDATA or SDATA if you are using the USERSTACKDPP3 directive.
To do so, simply change the definition of the ?C_USERSTACK section in the
STARTUP.A66 or START167.A66 file as shown below:
?C_USERSTACK SECTION DATA PUBLIC 'IDATA'
or
?C_USERSTACK SECTION DATA PUBLIC 'SDATA'
also you need to change the line:
MOV R0,#DPP2:?C_USERSTKTOP
to MOV R0,#DPP3:?C_USERSTKTOP
2.6 DYNAMICUSRSTK (Abbr. DU) directive
The DYNAMICUSRSTK directive tell the C166 compiler, that you modify the
user stack area. This is useful when you write an real-time operating system
which changes the user stack area. With the DYNAMICUSRSTK directive it is
possible to have 16KB user stack for each task. Without this control the
complete user stack area must reside in the NDATA class (which is limited to
a maximum of 64KB).
2.7 NOFRAME (Abbr. NOF) directive
The NOFRAME directive suppresses the Prolog and Epilog for Interrupt
Service Routines. The example below shows the difference between the
standard interrupt frame and NOFRAME. #pragma NOFRAME is active for
the function which follows the directive. It automatically turns off
after the function is translated. NOFRAME is useful when you write
interrupt functions which never return, i.e. CPU RESET.
1 int i1, i2, i3;
2
3 void intr_func1 (void) interrupt 0x21 {
4 1 i1 = i2 * i3;
5 1 }
6
7 #pragma NOFRAME
8 void intr_func2 (void) interrupt 0x22 {
9 1 i1 = i2 * i3;
10 1 }
ASSEMBLY LISTING OF GENERATED OBJECT CODE
; FUNCTION intr_func1 (BEGIN RMASK = @0x2030)
; SOURCE LINE # 3
0000 C6871000 SCXT MDC,#010H
0004 EC06 PUSH MDH
0006 EC07 PUSH MDL
0008 ECF4 PUSH R4
000A ECF5 PUSH R5
; SOURCE LINE # 4
000C F2F50000 R MOV R5,i3
0010 F2F40200 R MOV R4,i2
0014 0B45 MUL R4,R5
0016 F2F40EFE MOV R4,MDL
001A F6070400 R MOV i1,MDL
; SOURCE LINE # 5
001E FCF5 POP R5
0020 FCF4 POP R4
0022 FC07 POP MDL
0024 FC06 POP MDH
0026 FC87 POP MDC
0028 FB88 RETI
; FUNCTION intr_func1 (END RMASK = @0x2030)
; FUNCTION intr_func2 (BEGIN RMASK = @0x2030)
; SOURCE LINE # 8
; SOURCE LINE # 9
002A F2F50000 R MOV R5,i3
002E F2F40200 R MOV R4,i2
0032 0B45 MUL R4,R5
0034 F2F40EFE MOV R4,MDL
0038 F6070400 R MOV i1,MDL
; SOURCE LINE # 10
003C FB88 RETI
; FUNCTION intr_func2 (END RMASK = @0x2030)
2.8 SAVESYS, SAVEUSR directive
The C166 directive SAVEUSR directs the C Compiler to save temporary
results and saved-by-callee variables to the USER STACK. The SAVESYS
directive (which is the default setting) allows you to save temporary
results to the SYSTEM STACK. Since the SYSTEM STACK is always the
on-chip RAM it is faster, but the size is limited.
Example:
1 extern void func (void);
2
3 #pragma SAVEUSR // Temporary Saves to USER STACK
4 int func1 (int i1, int i2) {
5 1 func ();
6 1 return (i1 + i2);
7 1 }
8
9 //#pragma SAVESYS // Temporary Saves to SYSTEM STACK (default)
10 int func2 (int i1, int i2) {
11 1 func ();
12 1 return (i1 + i2);
Example:
1 extern void func (void);
2
3 #pragma SAVESYS // Temporary Saves to SYSTEM STACK (default)
4 int func1 (int i1, int i2) {
5 1 func ();
6 1 return (i1 + i2);
7 1 }
8
9
10 #pragma SAVEUSR // Temporary Saves to USER STACK
11 int func2 (int i1, int i2) {
12 1 func ();
13 1 return (i1 + i2);
14 1 }
ASSEMBLY LISTING OF GENERATED OBJECT CODE
; FUNCTION func1 (BEGIN RMASK = @0x7FFF)
; SOURCE LINE # 4
0000 ECFD PUSH R13
0002 ECFE PUSH R14
0004 F0D9 MOV R13,R9
;---- Variable 'i2' assigned to Register 'R13' ----
0006 F0E8 MOV R14,R8
;---- Variable 'i1' assigned to Register 'R14' ----
; SOURCE LINE # 5
0008 CA000000 E CALLA cc_UC,func
; SOURCE LINE # 6
000C F04E MOV R4,R14
000E 004D ADD R4,R13
; SOURCE LINE # 7
0010 FCFE POP R14
0012 FCFD POP R13
0014 CB00 RET
; FUNCTION func1 (END RMASK = @0x7FFF)
; FUNCTION func2 (BEGIN RMASK = @0x7FFF)
; SOURCE LINE # 11
0016 88D0 MOV [-R0],R13
0018 88E0 MOV [-R0],R14
001A F0D9 MOV R13,R9
;---- Variable 'i2' assigned to Register 'R13' ----
001C F0E8 MOV R14,R8
;---- Variable 'i1' assigned to Register 'R14' ----
; SOURCE LINE # 12
001E CA000000 E CALLA cc_UC,func
; SOURCE LINE # 13
0022 F04E MOV R4,R14
0024 004D ADD R4,R13
; SOURCE LINE # 14
0026 98E0 MOV R14,[R0+]
0028 98D0 MOV R13,[R0+]
002A CB00 RET
; FUNCTION func2 (END RMASK = @0x7FFF)
2.9 OPTIMIZE(7) directive: Common Tail Merging
The compiler analyzes the generate code function by functino and tries to
find common heads and tials. If the compiler detects common code sequences,
it will replace one code sequnece by a jump instruction to the other
equivalent code sequence. This situation arises many times with switch/
case statements for example. While analyzing the code, the compiler also
tries to replace sequences with cheapter instructions.
The default of the C166 Compiler is still OPTIMIZE(6). Therefore you have
to enable OPTIMIZE(7) with the OPTIMIZE directive.
3. New Features in L166 Version 4.0
3.1 WARNING 22: CLASS RANGE NOT GIVEN IN INVOCATION LINE
Now the L166 outputs a WARNING 22 when you are using memory classes without
defining an address range for the classes with the CLASSES or DPPUSE directive.
The WARNING 22: CLASS RANGE NOT GIVEN IN INVOCATION LINE is not generated for
the following classes: IDATA, IDATA0, BIT, BIT0, BDATA, BDATA0.
3.2 DISABLEWARNING (Abbr. DW) directive added
With this directive you can selectively disable some of the Linker warnings.
Example: L166 myfile.obj DISABLEWARNING (20, 22)
This will disable the report of Warning Number 20 and 22.
3.3 CINITTAB (Abbr. CI) directive added
With this directive you can locate the C166 Initilization Sections
?C_CLRMEMSEC and ?C_INITTAB to a specified address range.
Example: L166 myfile.obj CINITTAB (0x10000 - 0x18000)
This will locate the sections ?C_CLRMEMSEC and ?C_INITTAB to the address
range 0x10000 - 0x18000. L166 will issue a warning if this is not possible.
4. Example Programs
Several example programs have been included in the EXAMPLES directory.
These files demonstrate how to use the uVision2 Project Manager and
Debugger. More Information about uVision2 can be found in the Brochure
Quick Start Guide.
5. Sales and Technical Support
We at Keil Software are dedicated to providing you with the best
development tools and the best sales and technical support. If you
experience any problems or have any questions about this product,
contact one of our offices for assistance.
In the USA... In Europe...
KEIL Software, Inc. KEIL Elektronik GmbH
16990 Dallas Parkway, Suite 120 Bretonischer Ring 15
Dallas, Texas 75248-1903 D-85630 Grasbrunn, Germany
Sales (800) 348-8051 Sales +49 89 456040-0
Support (972) 735-8051 Support +49 89 456040-24
Fax (972) 735-8055 Fax +49 89 468162
Email sales.us@keil.com Email sales.intl@keil.com
support.us@keil.com support.intl@keil.com
INTERNET: http://www.keil.com/
-O-
| ||||
| |||||