Keil Logo
         /****************************************************/
         /*           Release Notes for 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) 1999 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
2.10 FIXPEC directive

3.   New Features in A166 Version 4.0
3.1  64-Bit Values in Numeric Evaluations
3.2  New Directives and Operands to Support 32 and 64 bit values
3.3  More Reserved Symbols
3.4  New standard MACRO processor
3.5  Object File Differences
3.6  Support for ST10 MAC unit

4.   New Features in L166 Version 4.0
4.1  WARNING 22: CLASS RANGE NOT GIVEN IN INVOCATION LINE
4.2  DISABLEWARNING directive
4.3  CINITTAB directive

5.   Example Programs

6.   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 accessing bits in bit-field structures which are located in
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 access to extended bits of
the SFR area.  This memory type has the name 'ebdata'.  The memory class is
EBDATA or EBDATA0.

You may use this bit addressing mode for accessing SFR registers of the 166
derivatives.  Simply define all the CPU SFR registers in a C source file and
translate this file with the ORDER directive.  Then, you may locate the
section which contains the SFR definitions with the SECTIONS directive:

Example:
  L166 ... SECTIONS (?EB?SFRBIT%EBDATA (0F100H), ?BD?SFRBIT%BDATA (0FF00H))

You may 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 locates all structures with bit-field members with 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 alignment is required.  The 
directive is compatible with the Microsoft C directive.  The usage is shown
in the following sample program.  Note that the C166 compiler generates
considerably more code to access BYTE-aligned WORDs.  Therefore, the pack(1) 
directive should be used only when necessary.

#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
};


#pragma pack(1) assumes that structure pointers point to WORD-aligned
structures.  If your application uses structure pointers to byte-aligned
structures, you must use the #pragma BYTEALIGN directive in addition to the
#pragma pack(1) directive.

Example:

#pragma pack(1)     /* alignment is BYTE for the following structures */
#pragma BYTEALIGN   /* struct pointers point to BYTE-aligned structs */

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 use the PPO directive, the C166 Compiler stops after pre-processing
the C source file.  This 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 inside the asm/endasm block.

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 accesses to the USER STACK AREA.  By default, the user stack is
allocated in the NDATA memory area.  You may change the memory class to IDATA
or SDATA when you use the USERSTACKDPP3 directive.  To do so, 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 tells the C166 compiler, that your program
modifies the user stack area.  This is useful for developers who create
real-time operating systems that change the user stack area.  With the
DYNAMICUSRSTK, directive it is possible to have a 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 (ISRs).  The example below shows the difference between a standard
interrupt frame and a NOFRAME ISR.  #pragma NOFRAME suppresses the prolog and
epilog for the ISR immediately following the directive.  This directive is
active for only one function.  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 SAVEUSR C166 directive 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 in 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 generated code, function-by-function, and tries to
find common heads and tails.  If the compiler detects common code sequences,
it replaces one code sequence by a jump instruction to the other equivalent
code sequence.  This situation arises frequently with switch/case statements.
While analyzing the code, the compiler also tries to replace sequences with
shorter instructions.

The default optimizer level is still OPTIMIZE(6).  You must enable OPTIMIZE(7)
with the OPTIMIZE directive.


2.10 FIXPEC directive:  Insert NOP to avoid JMP - JMP constructs

When using OPTIMIZE(7) the Compiler may generate JMPs to functions (instead
of CALLs).  If the function starts with a JMP instruction you may experience
a problem with the PEC (on some chip steppings).  To avoid this, use the
FIXPEC directive.  This is found under Options-C166-MISC.  This directive
ensures that a JMP instruction is never used at the beginning of a function.


3.   New Features in A166 Version 4.0

The new Assembler Version 4 allows re-translation of A166 Version 3 assembly 
modules.  However, since Verison 4 supports 64-bit expressions, the following
incompatibilities may arise when old modules are re-translated.

3.1  64-Bit Values in Numeric Evaluations

A166 Version 3 uses 16-bit numbers for all numerical expressions.  A166
Version 4 uses 64-bit values.  This can cause problems when overflows occur
in numerical expressions.  For example:

Value    EQU    (8000H + 9000H) / 2

has the result 800H in A166 Version 3 since the result of the addition is a
16-bit value (1000H).  However, A166 Version 4 calculates Value as 8800H.


3.2  New Directives and Operands to Support 32 and 64 bit values
 
Now, there are more ways to define and initialize variables.  Each method is
listed here:

Syntax:	[name[:]]	DB	init [, init] [,...]
	[name[:]]	DW	init [, init] [,...]
	[name[:]]	DD	init [, init] [,...]   /* new: DWORD init */
	[name[:]]	DF32	init [, init] [,...]   /* new: 32-bit IEEE float init */
	[name[:]]	DF64	init [, init] [,...]   /* new: 64-bit IEEE float init */
	[name[:]]	DW	init [, init] [,...]
	[name[:]]	DBIT	[expression]
	[name[:]]	DS	expression
	[name[:]]	DSD	expression              /* new: DWORD reserve space */
	[name[:]]	DSB	expression
	[name[:]]	DSW	expression

The following operators have been added to A166 Version 4.

DATA32, DATA64	for 32-bit and 64-bit constant values.

WORD0, WORD2,	extract a WORD from an expression.
WORD4, WORD6

BYTE0 .. BYTE7	extract a BYTE from an expression


3.3  More Reserved Symbols

A166 Version 4 has more reserved symbols than A166 Version 3 and allows
support for floating-point numbers and DWORD initializations.  If your
assembly modules use the same names reserved by A166 Version 4, you must
change them.  For example, the symbol DD may not be used as a label name since
it is a new directive.


3.4  New standard MACRO processor

A166 Version 4 supports standard macros as available in Keil A51 and A251.
The following new directives are available:

NOMACRO disables all Macro processors
NOMPL   disables the MPL Macro processor
MPL     enables the MPL Macro processor


3.5  Object File Differences

A166 Version 4 uses a new relocatable OMF-166 file format for object files.
This new OMF format allow linkage with 32-bit and 64-bit numbers.  This format
is supported with L166 V4.02 and higher.  The absolute OMF format is not
changed so your existing degbugging tools will continue to function with no
problems.


3.6  Support for ST10 MAC unit

A166 now supports all instructions of the ST10 MAC unit.  The MAC instructions
are enabled with the EXTMAC directive.

Example:   A166 MYFILE.A66 EXTMAC



4. New Features in L166 Version 4.0

4.1 WARNING 22: CLASS RANGE NOT GIVEN IN INVOCATION LINE

The L166 Linker outputs a WARNING 22 when you use memory classes without
defining an address range with the CLASSES or DPPUSE directive.  Note that
this warning is not generated for the following classes:  IDATA, IDATA0, BIT,
BIT0, BDATA, and BDATA0.



4.2 DISABLEWARNING (Abbr. DW) directive added

With this directive you can selectively disable Linker warnings.

Example:  L166 myfile.obj DISABLEWARNING (20, 22)

This disables Warning 20 and Warning 22.


4.3 CINITTAB (Abbr. CI) directive added

The CINITTAB directive locates the C166 Initilization Sections, ?C_CLRMEMSEC
and ?C_INITTAB, to a specified address range.

Example: L166 myfile.obj CINITTAB (0x10000 - 0x18000)

This locates the sections ?C_CLRMEMSEC and ?C_INITTAB to the address
range 0x10000 - 0x18000.  L166 issues a warning if relocation is not possible.



5. Example Programs

Several example programs are included in the EXAMPLES directory.  These files
demonstrate how to use the uVision2 Project Manager and Debugger.  More
Information can be found in the uVision2 Quick Start Guide.

Now, the Keil Monitor-166 is pre-configured for serveral commerical boards.
You may select the monitor for debugging in several of the example programs.


6. Sales and Technical Support

At Keil Software, we 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-
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.