Home

80C196 C Compiler User`s Guide

image

Contents

1. MA006022 00 0107 80C196 v6 1 C COMPILER USER S GUIDE Al TASKING Quality Development Tools Worldwide A publication of TASKING Documentation Department Copyright 1999 TASKING Inc All rights reserved Reproduction in whole or part is prohibited without the written consent of the copyright owner The following trademarks are acknowledged FLEXIm is a registered trademark of Globetrotter Software Inc HP and HP UX are trademarks of Hewlett Packard Co Intel MCS and ICE are trademarks of Intel Corporation MS DOS and Windows are registered trademarks of Microsoft Corporation SUN is a trademark of Sun Microsystems Inc UNIX is a registered trademark of X Open Company Ltd All other trademarks are property of their respective owners Data subject to alteration without notice E mail support tasking com WWW http www tasking com The information in this document has been carefully reviewed and is believed to be accurate and reliable However TASKING assumes no liabilities for inaccuracies in this document Furthermore the delivery of this information does not convey to the recipient any license to use or copy the software or documentation except as provided in an executed license agreement covering the software and documentation TASKING reserves the right to change specifications embodied in this document without prior notice TABLE OF CONTENTS al TASKING uality Development To
2. define high byte x unsigned char amp x 1 BRR kk ck ck Ck kk kk kk kk ko OR k Ck oko kk kk ke k ko kk kk Ck k k k kk kk ke IO k k k k kk k k kk kk ke k kkk e ke f Figure 5 10 Digital filter source text initialization in dsfinit b BRR kk KR Ck kk kk kk ke IIR IRR kk ke IR IR kk ke kk kk kk ko IO kk Ck kk ke kk kk kk ke k ek kk kk k f 45 4 This program implements a digital signal filter with the following equation V new K input M V old g ued BRR RIK IK KR RK IK IR ke kk kk Ck kk kk I IR OR RRR k IO OR k k kk k k kk k ke k kkk e ke f BRR IK IK KR RK IK RR IR ke IR RIK I k ko kk kk RR k k k I IO OR OR k k kk k I OR OK e ke f ie software_timer is the interrupt routine for HSO software timer 0 Ey px ep BRR e IR oko ke ke kk kk ke IIR ek ko ke kk kk kk ke kk ko kk ke kk kk kk kk ke IO ke kk kk kk k kk kk ke kk e kk ek f void software timer void ad_command 8 Start A D channel 0 hso command 0x18 Give command to HSO sy hso time timerl 64 Set HSO command to occur in 126 microseconds BRR kk kk Ck kk ko kk kk kk ok kk kk IK kk ke k ko kk kk kk kk kk kk ke IO OR kk ko kk kk kk ke OR ek e kk f BRR kk kk ek kk ke kk kk ke IIR ek ko ke kk kk kk ke Sk ek kk ke kk kk kk ke ke ke IOI ke kk kk kk k kk kk ke k ek kk kk k f f ura analog conversion done is the interrupt routine for A to D conversion d a BRR kk kk ok kk kk kk Ck ke IIR IIR kk ke IR IR
3. 1 where function is the name of a function defined in the source text n is the piha pihb interrupt number or the absolute interrupt address Class General control Description These controls are only valid for those models which have a piha and pihb block Use this control to specify a function in the source text to handle some condition signaled by an interrupt An interrupt function must be of type void and cannot take arguments The interrupt designation must precede the function definition See the interrupt control for more information qo fastinterrupt generatevectors interrupt interruptpage model Compiler Controls 4 49 interruptpage Function Specifies an interrupt page or base address Select the EDE C Compiler Options Project Options menu item Enter a value in the Specify the Interrupt page 0 0FFH or base address field in the Object tab mgl interruptpage num base where num is the page number 0 OxFF for interrupt vectors base is the base address Abbreviation ip Class Primary control Default ip 0xO for non 24 bit models ip OxFF for 24 bit models Description Use this control to specify the page number or base address for interrupt vectors By default the interrupt vectors are put in the OxFF page for 24 bit models and in page 0 for other models Values 0 0xFF are taken as page numbers and shifted 16 bits other values are taken as the ba
4. For integral operands if the mathematical quotient is not an exact integer then the result will be one of the two integers closest to the mathematical quotient of the operands Of those integers the one closer to 0 is chosen if both operands are positive If either operand is negative the C196 implementation also choses the one closer to 0 The binary operator computes the remainder when the first operand is divided by the second Operands may be of any integral type The type of the result is that of the converted operands 10 20 Chapter 10 It is always true that a b b a b is equal to a if b is not 0 When both operands are positive the remainder operation will always be equivalent to the mathematical mod operation If either operand is negative the C196 implementation is defined in a manner corresponding to the integer division The sign of the remainder will be the same as the sign of the first operand Examples int ayb d r a 14 b 4 d a b Division is 3 r a b Remainder is 2 d a b Division is 3 r a b Remainder is 2 d a b Division is 3 r a b Remainder is 2 d a b Division is 3 r a b Remainder is 2 10 4 8 VOLATILE OBJECTS Access to a volatile object constitutes a load and a store reference when the object is one of the following e An operand of a prefix or postfix increment or decrement for example cou
5. Chapter 6 There are two type qualifier keywords win and winl you can use for certain models in parameter declarations to indicate that the parameter being defined should reference a particular window in the register area controlled by the WSR special function register win or by the WSR1 special function register _win1 The parameter must be a pointer No more than one parameter in a function may use the same qualifier both _win and win may be used together Example pragma typedef int int windowram 0x100 0x17F struct wheel struct nflags oflags whatever WheelStruct _reg _reg _reg _reg void void WheelStruct WheelStruct WheelStruct WheelStruct ProcessWh Wheel LF Wheel RF Wheel LR Wheel RR l WheelStruct win Wheel Wheel gt oflags Wheel gt nflags Wheel gt nflags f whatever main void int flags whatever ProcessWh l amp Wh ProcessWh l amp Wh ProcessWh ProcessWh l amp Wh l amp Wh whatever nm A d E 0 C flags flags flags flags imt f Do not use the windows control when using windowed parameters ASSEMBLY CODE INSTRUCTIONS al TASKING uality Development Tools Worldwide Assembly Code Instructions 7 3 This chapter describes ways to include assembly language instructions inside your C19
6. Compiler Controls 4 123 windows Function Specifies that the whole application uses vertical windows Syntax windows no hold nowindows Abbreviation wd nowd Class Primary control Default nowindows Description Use this control to use the additional registers of the processors that support vertical windows through the vertical windowing feature of these microcontrollers This control causes the compiler to generate instructions to save and set the wsr register in the prolog and restore the wsr register in the epilog of all functions except for static and public functions which have no local register variables and no calls to other functions If you are using the HOLD HOLDA protocol along with vertical windowing specify the hold parameter This parameter causes the compiler to generate additional code to preserve the HOLDEN bit of the Window Select Register WSR Specifying windows without any parameter is equivalent to specifying windows hold If you are not using the HOLD HOLDA protocol specify the nohold parameter to reduce the amount of overhead code The WSR management code allows access to local and static register variables located in the mapped area of the register file and above from 80H or OCOH or OEOH depending on the window size Public register variables allocated in the register segment are restricted to the registers below the mapped area below 80H or 0COH or OEOH depending on the w
7. Compiler Controls 4 43 interrupt Function Specifies a function to be an interrupt handler Select the EDE C Compiler Options Project Options menu item Add the control to the Additional options field in the Misc tab sss interrupt function n 1 where function is the name of a function defined in the source text n is the interrupt number or the interrupt address Abbreviation in Class General control Description Use this control to specify a function in the source text to handle some condition signaled by an interrupt An interrupt function must be of type void and cannot take arguments The interrupt designation must precede the function definition You can specify the same interrupt function for multiple interrupts For example the following pragma directive is valid pragma interrupt int log 1 int log 2 int log 20x2006 However you cannot specify multiple interrupt function handlers for one interrupt The following example generates a fatal error pragma interrupt int log 1 rst func 1 4 44 Chapter 4 The interrupt control causes the compiler to generate prolog and epilog code to save and restore registers The compiler takes into consideration the differences between the selected processor models when generating the call and return sequences The exact sequence generated depends on the argument to the model control Note that the compiler does not automaticall
8. E preprint filename nopreprint where filename is the filename including a device name and directory name or pathname if necessary in which the compiler places the preprint information Abbreviation pp nopp Class Invocation control Default nopreprint Description Use this control to create a file containing the text of the source after preprocessing Use the default nopreprint control to suppress creation of a preprint file Preprocessing includes file inclusion macro expansion and elimination of conditional code The preprint file is the intermediate source text after preprocessing and before compilation This file is not related to the print file created by the print control The preprint file is useful for observing the results of macro expansion conditional compilation and the order of include files If the preprint file contains no errors compiling the preprint file produces the same results as compiling the primary source file and any files included in the compiler invocation 4 84 Chapter 4 By default the compiler places the preprint file in the directory containing the source file If you do not provide a filename the compiler composes the default preprint filename from the source filename with the i extension For example the compiler creates a preprint file named proto i for the source file proto c The preprint and nopreprint controls affect the entire source text You can specify one
9. where function is the name of a function defined in the source text Abbreviation vp Class General control Default varparams Description Use this control to cause the specified functions to use the variable parameter list VPL calling convention The VPL calling convention provides more flexibility than the FPL calling convention See the fixedparams control for more information on the FPL calling convention Use the VPL calling convention for functions that take a variable number of parameters A function s calling convention dictates the sequence of instructions that the compiler generates to manipulate the stack and registers during a call to the function Code generated for the VPL calling convention performs the following sequence of operations 1 The calling function pushes the arguments onto the stack with the rightmost argument pushed first 2 The calling function transfers control to the called function 3 The called function executes 4 116 7 Chapter 4 The called function returns control to the calling function 5 The calling function removes the arguments from the stack The calling convention specification must precede the function declaration The first declaration or definition of a function sets the calling convention for that function based on the fixedparams or varparams control in effect for the function or based on the alien keyword or the comma and ellipsis if s
10. Processor models 8096 90 4 60 8096 BH 4 61 80C196CA 4 61 Index Index 13 SOC196CB 4 61 SOC196EA 4 61 SOC196EC 4 61 80C196JO 4 61 80C196JR 4 61 80C196JS 4 61 80C196JT 4 61 80C196 V 4 61 S0C196KB 4 61 80C196KC 4 61 80C196KD 4 61 S0C196KL 4 61 80C196KO 4 61 S0C196KR 4 62 SOC190KS 4 62 SOC19OKT 4 62 S0C196LB 4 62 SOC196MC 4 62 SOC196MD 4 62 SOC196MH 4 62 SOC19GONP 4 62 80C196NT 4 62 S0C196NU 4 62 Program Status Word 10 13 Program status word 10 12 Program status word PSW 6 5 Manipulation 6 5 project files adding files 2 13 Prolog 10 7 10 9 Propagated directive 3 16 Pseudo assembly instructions 7 4 Syntax 7 4 pts control 4 87 PTS interrupts 4 87 4 89 PTS vectors 4 87 4 89 Loading a PTS control block 4 87 4 89 pts_piha control 4 89 pts_pihb control 4 89 Reentrancy Allocation 4 90 Calling convention 4 32 4 90 4 115 6 8 10 12 Controls 4 90 4 91 6 8 Examples 6 6 Keywords 4 90 6 8 Registers 4 90 6 8 10 12 Specifying 4 91 TASKING extensions 4 90 reentrant control 4 90 reentrant keyword 4 23 4 24 4 90 6 8 regconserve control 4 92 6 7 Register REGISTERS macro 3 14 4 94 16 bit direct addressing mode 6 10 8 bit direct addressing mode 6 10 Allocation 4 23 4 92 4 93 4 94 4 96 6 6 6 7 6 10 Budget 4 93 4 96 Calling convention 4 90 6 8 10 12 Compilation summary 3 22 Conservation 4 92 Control 4 93 4 94 4 96 Controls 9
11. Project Options menu item Enable or disable the Generate jump table for switch statement check box in the Code tab ess inst noinst Abbreviation is nois Class Primary control Default noinst Description Use this control to prevent the C196 compiler from generating vector tables for switch statements You must use this control if you are overlapping ROM and RAM memory because the processor reads data from these tables rather than fetching code from them When inst is in effect the compiler generates a series of compare instructions instead of the vector table qo See the 80C196 Utilities User s Guide listed in Related Publications for more information on overlapping ROM and RAM memory 4 41 4 42 Chapter 4 Note that the inst control may be somewhat confusing It has to do with the fact that in an older version of OMF96 v2 0 all rommable information i e code and constant data went into the CODE segment However in case the INST pin of the processor is used the constant data should not be mixed with the code instructions The Intel iC 96 had the inst control to prevent the compiler to generate constant data in the middle of code instructions With the newer definitions of OMF96 a better solution is available all constant data in collected in a separate segment In other words this inst control is only useful if the output format of the compiler is OMF96 v2 0 see the oldobject and omf controls
12. Prototype Declaration void enable pts void Header File xx funcs h xx represents a processor model Description Use this function to enable the peripheral transaction server s PTS interrupts This function is valid only for the 80C196KC and higher processors Returns The enable pts function does not return a value 8 20 Chapter 8 fpinit Initializes floating point library Prototype Declaration void fpinit void Header File fpal96 h Description Use this function to perform the following necessary initializations for the functions in the FPAL96 libraries e Setrounding flag in control word to round to nearest e Mask all exceptions in control word e Set floating point accumulator to indicate signalling Not a Number sNaN e Set stat field to indicate sNaN and clear error byte of status word e Attach a dummy error handler A program must call the fpinit function before performing any floating point operation See the 80C196 Utilities User s Guide listed in Related Publications for more information on floating point numbers and initialization Returns The fpinit function does not return a value Libraries idle Function Enters a power saving mode Prototype Declaration void idle void Header File xx funcs h xx represents a processor model Description Use this function to place the 80C196 processor in the power saving idle mode The idle function is availabl
13. Syntax wordalign nowordalign Abbreviation wa nowa Class Primary control Default nowordalign Description Use this control to prevent the compiler from aligning objects to longword boundaries This control causes the compiler to place all objects requiring word alignment or longword alignment on word boundaries but not necessarily on longword boundaries Using this control will allocate your data in the same order that it was allocated by C196 version 2 x qo oldobject 4 126 Chapter 4 xref Function Specifies symbol table cross reference in listing Select the EDE C Compiler Options Project Options menu item Enable or disable the Include identifier cross reference check box in the Listing tab Eee xref noxref Abbreviation xr noxr Class Primary control Default noxref Description Use this control to add cross reference information to the symbol table listing in the print file Use the default noxref control to suppress the cross reference information The print file lists the cross reference line numbers on the far right with the data or function type under the ATTRIBUTES column in the symbol table listing The cross reference line numbers refer to the line numbers in the source text listing in the print file An asterisk indicates the line where the object or function is declared Specifying noprint or notranslate suppresses the print file causi
14. The number of operands specified in the instruction is incorrect See the 80C196 Assembler User s Guide listed in Chapter 2 for the syntax of each instruction invalid object type A variable declaration specified an invalid data type for example a variable of void type invalid operand operand number operand number is a decimal value stating which operand is invalid in the instruction Probable causes are a byte register was specified where a word register is expected a constant was not specified where an immediate value is expected a word aligned register variable or register number was not specified for the base register or an operand of the call instruction was not a C function name invalid pointer aritbmetic The only arithmetic allowed on pointers is adding an integral value and a pointer subtracting an integral value from a pointer or subtracting two pointers of the same type Any other arithmetic operation is illegal invalid redeclaration name An object or function is being redeclared but not with the same type For example a function reference implicitly declares the function as a function returning an int If the actual definition that follows is different an error results 9 22 Chapter 9 7 invalid register operand The C variable used as a register operand in the instruction is not valid because it was not declared as a register variable Declare the C variable with the register storage class This err
15. at Ox17 r BRR IK ok RRR RR IIR e kk ek kk RI IO IR IR RI IO IO IR IR ek ek ke Additional SFRs of the 80C196KC wg x BRR kk Ck kk kk kk kk kk ke kk kk Ck kk kk kk ke IR OR kk k k k kk kk k IO k k k k kk k kk kk ke kkk k kkk f extern volatile register unsigned char ad time at 0x03 r w extern volatile register unsigned short ptssel at 0x04 r w extern volatile register unsigned short ptssrv at 0x06 r w extern volatile register unsigned char t2control at Ox0c r w extern volatile register unsigned char pwml_control at 0x16 r w extern volatile register unsigned char pwm2_control at 0x17 r w BR RR kk Ck ck Ck kk Ck kk kk ke kk kk Ck kk o kk I k ko kk kk kk kk kk kk ke IO OR kk ko k k kk kk ek ek ek e ke f Define typedefs for PTS Control Blocks of 80C196KC ed BRR kk IK RR RI kk ok k k k k k k kk k k ke IO IR kk kk kk kk kk kk IO kk IIR A I IO KR f Single Transfer PTS Control Block sy typedef struct STran_ptscb_t unsigned char ptscount str ct i unsigned int di si du su bw L G a a G La mode ptscon void ptssrc void ptsdst int 16 unused STran ptscb Figure 3 13 Digital signal filter preprint file continued 3 36 Chapter 3 i Block Transfer PTS Control Block typedef struct BTran ptscb t unsigned char ptscount struct unsigned int di Ly si 15 du 1T su Ly bw 15 mode 3 ptscon void ptssrc
16. library module main processes the initialization table it copies the initial constant data to the corresponding variables and zeroes the uninitialized variables You may modify the main module if you do not need the initialization and wish to save space in ROM by eliminating the initialization routine There are up to five data segments with initial values one for each of the register overlay data and far data segments and one for all the absolute segments produced by the locate pragma and the _reg storage class modifier The initialization segments corresponding to the four relocatable segments are congruent to those segments and need only one table entry each The single initializaton segment for all the absolute segments requires one table entry for each such variable since they can be scattered all over the place The following pragmas controls can be used for data initialization init noinit allows the compiler to produce the initialization segments and tables The default setting is init init can be abbreviated it Use the noinit control pragma to prevent the generation of initializing data and tables even though you have used initializers in your source code noinit also prevents zeroing of uninitialized variables zero nozero allows the compiler to zero uninitialized variables in relocatable data segments The default setting matches the setting of the init control noinit forces nozero zero can be abbreviate
17. servicing The 196 processor requires that the first instruction in the interrupt must be a PUSHA See the processor User s Manual for details on interrupt The next example The first section say 2000h 23FFh is permanently in ROM the second section say 0C000h 0FFFFh can be in RAM downloading or in some EPROM that can be replaced IntHandO0 IntHandl IntHand2 IntHand3 Example KSEG at DCW DCW DCW DCW CSEG at PUSHA LCALL POPA RET PUSHA LCALL POPA PUSHA LCALL POPA PUSHA LCALL OPA WS 2000h IntHandO IntHand1 IntHand2 IntHand3 0co00h IntFuncO IntFuncl IntFunc2 IntFunc3 The following is an example of a valid interrupt control specified on the invocation line interrupt int handle 1 1 int_handle_24 0x2030 Compiler Controls 4 47 The source text compiled using this control contains the following declarations void int handle 1 void frea void int_handle_2 void ssa qo fastinterrupt generatevectors interrupt piha interrupt pihb interruptpage model 4 48 Chapter 4 interrupt_piha interrupt pihb Function Specifies a function to be an interrupt handler in the piha block or pihb block respectively Syntax Select the EDE C Compiler Options Project Options menu item Add the control to the Additional options field in the Misc tab E interrupt piha function n interrupt pihb function 2n
18. 10 4 IMPLEMENTATION DEPENDENT C196 FEATURES This section provides information about how C196 implements some characteristics of the C language as specified by the ANSI C standard The STDC macro defined as 0 indicates that the compiler does not conform strictly to the ANSI C standard 10 4 1 CHARACTERS The C196 source character set is 7 bit ASCII except in comments and strings where it is 8 bit ASCII The execution character set is 8 bit ASCII The compiler maps characters one to one from the source to the execution character set You can represent all character constants in the execution character set 10 4 2 IDENTIFIERS The C196 compiler supports 40 character significance in external and internal names The compiler forces external names to uppercase Case is significant in internal names 10 4 3 EXTENDED SEMANTICS AND SYNTAX The C196 compiler supports the alien reentrant and nonreentrant keywords and allows file level register variables when the extend control is in effect These C196 storage class specifiers operate as follows alien has the same effect as specifying the fixedparams control for the function reentrant has the same effect as specifying the reentrant control nonreentrant has the same effect as specifying the noreentrant control The C196 compiler allows an extended syntax for type qualifiers that does not conflict with ANSI C Language Implementation 10 15 In C196 a qualifie
19. 4 72 Constants Character 10 4 Optimization 4 72 Contiguity 10 4 Continuation lines Source text 3 18 Control word 8 20 Controls 4 1 abszero 4 4 Affecting the print file 3 17 3 19 bmov 4 5 case 4 6 ccb 4 8 code 4 10 cond 4 12 debug 4 14 define 4 16 diagnostic 4 19 divmodopt 4 21 eject 4 22 extend 4 23 extratmp 4 26 farcode 4 27 farconst 4 29 fardata 4 30 fastinterrupt 4 31 fixedparams 4 32 generatevectors 4 35 hold 4 36 include 4 38 init 4 40 inst 4 41 interrupt 4 43 interrupt_piha 4 48 interrupt pibb 4 48 interruptbage 4 49 list 4 51 listexpand 4 53 listinclude 4 55 Listing 3 4 locate 4 57 mixedsource 4 59 model 4 60 nearcode 4 64 nearconst 4 65 neardata 4 66 norelocatabletemps 4 97 object 4 67 Object file content 3 4 oldobject 4 69 omf 4 70 4 104 optimize 4 71 pagelength 4 79 Index 6 pagewidtb 4 81 preprint 4 85 print 4 85 pts 4 87 pis piba 4 89 pis pibb 4 89 reentrant 4 90 regconserve 4 92 registers 4 04 relocatabletemps 4 97 searchinclude 4 99 signedchar 4 102 Source processing 3 3 Suppressing the object file 3 23 symbols 4 105 tabwidth 4 106 title 4 107 tmpreg 4 109 translate 4 112 type 4 113 Types 3 4 varparams 4 115 warning true false 4 118 windowram 4 121 windows 4 123 xref 4 126 zero 4 128 creating a makefile 2 13 Creating libraries 2 5 Cross reference 3 20 cstart a96 5 3 cstr
20. Chapter 1 1 2 4 SETTING THE ENVIRONMENT The C196 compiler recognizes several environment variables that you can use to reduce the amount of typing required for a compiler invocation These environment variables are as follows PATH Q PATH is recognized by DOS Windows as a list of pathnames of directories containing executable or batch files If one of the pathnames in this list specifies the directory containing the C196 compiler you need not retype the full pathname each time you invoke the compiler If you installed the software under C NC196 you can include the executable directory C C196 BIN in your search path Your PC literature explains how to define the PATH environment variable In EDE select the EDE Directories menu item Add one or more executable directory paths to the Executable Files Path field C196INC C196INC is recognized by the compiler as a list of prefix strings separated with semicolons that the compiler can use to locate include files If you specify a filename or partial pathname with the include control or the include preprocessor directive the compiler prepends each string in C196INC in turn and uses each resulting pathname as the name of the include file The compiler uses the pathnames formed from the list in C196INC in addition to any you specify with the searchinclude control For example the following definition of C196INC locates the files e cl196 include stdio h an
21. If the arguments point to the same location the cstr function overwrites the original UDI string with the new C type string Returns The cstr function returns a pointer to the converted string This return value is the same as the value passed in via the c ptr parameter 8 16 Chapter 8 disable Function Disables the processor s interrupts Prototype Declaration void disable void Header File xXx funcs h xx represents a processor model Description Use this function to disable the processor s interrupts Returns The disable function does not return a value Libraries 8 17 disable_pts Function Disable the peripheral transaction server s interrupts Prototype Declaration void disable_pts void Header File xx funcs h xx represents a processor model Description Use this function to disable the peripheral transaction server s PTS interrupts This function is valid only for the 80C196KC and higher processors Returns The disable pts function does not return a value 8 18 Chapter 8 enable Function Enable the processor s interrupts Prototype Declaration void enable void Header File xx funcs h xx represents a processor model Description Use this function to enable the processor s interrupts Returns The enable function does not return a value Libraries 8 19 enable pts Function Enable the peripheral transaction server s interrupts
22. Imstat allows you to instantly monitor the status of all network licensing activities Imstat allows a system administrator to monitor license management operations including e Which daemons are running e Users of individual features e Users of features served by a specific DAEMON Flexible License Manager FLEXIm A 9 The usage of Imstat is as follows lmstat 7a S DAEMON f feature s server t value c license file A 1 regular expression a Display everything A List all active licenses c license file Use license file S DAEMON List all users of DAEMON s features f feature name List users of feature s 1 regular expression List users of matching license s s server name Display status of server node s t value Set Imstat timeout to value Imdown The Imdown utility allows for the graceful shutdown of all license daemons both Imgrd and all vendor daemons such as Tasking on all nodes To use Imdown simply type lmdown with the correct license file in either usr local license dat or the license file pathname in the environment variable LM LICENSE FILE In addition Ilmdown takes the c license file path argument to specify the license file location Since shutting down the servers will cause loss of licenses execution of Imdown is restricted to users with root privileges lmremove The Imremove utility allows the sy
23. Name Imdown graceful shutdown of all license daemons Synopsis Imdown c icense file q Description Imdown allows the system administrator to send a message to every license daemon asking it to shut down The license daemons write out their last messages to the log file close the file and exit All licenses which have been given out by those daemons will be revoked so that the next time a client program goes to verify his license it will not be valid Options c license file Use the specified license file If no c option is specified Imdown looks for the environment variable LM LICENSE FILE in order to find the license file to use If that environment variable is not set lmdown looks for the file usr local flexlm licenses license dat q Quiet mode If this switch is not specified Imdown asks for confirmation before asking the license daemons to shut down If this switch is specified Imdown will not ask for confirmation qe Imgrd 1 Imstat 1 Imreread 1 A 12 Appendix A Imgrd 1 Name Imgrd flexible license manager daemon Synopsis Imgrd c license Hie 1 logfile t timeout s interval Description Imgrd is the main daemon program for the FLEXIm distributed license management system When invoked it looks for a license file containing all required information about vendors and features Options c license file 1 ogfile t timeout s i
24. Peripheral transaction server PTS 8 17 8 19 PL M 96 Calling convention 4 32 10 8 PLMREG Definition 6 6 Examples 6 6 PLMREG variable 4 109 6 3 power_down function 8 22 powerdown function 6 5 powerdown mode 8 22 preprint control 3 13 4 83 Preprint file 3 11 3 12 4 112 Contents 4 83 Filename 4 83 Preprocessor directives Conditional compilation 3 13 4 12 Include files 4 38 4 59 4 55 Limits 10 22 Macro definition 3 13 4 16 4 17 Preprint file 3 13 Primary control 9 6 Index Primary controls 3 4 Primary source file 4 38 print control 4 85 Print file 3 11 3 16 Code listing 4 10 Compilation heading 3 16 Compilation summary 3 22 3 23 Conditional compilation 4 12 Cross reference table 3 17 3 20 Diagnostic messages 5 20 Diagnostics 4 20 4 55 Filename 4 85 Generation 4 85 Include files 4 38 4 55 Macros expanded 4 53 Mixed assembly source 4 59 Page header 3 16 3 17 Page length 4 79 Page width 4 81 Pseudo assembly listing 3 17 3 21 Source text 4 12 4 53 4 55 Source text listing 3 18 4 51 Symbol table 3 17 4 113 4 126 Symbolic information 4 105 4 126 Symbols table 5 20 Tab widtb 4 106 Title 4 107 printf function 8 23 Processor _ARCHITECTURE_ macro 3 14 Compatibility 4 60 Header files 6 5 8 8 8 9 Instruction set 4 44 4 60 10 12 10 13 Interrupt numbers 4 44 Registers 0 1 8 9 Selection 4 36 4 60 4 123 State 6 5 8 8 8 21 8 22 10 13
25. The compiler places the structure at a word aligned location since the structure contains members that must be aligned A gap appears between the last byte of byte array and the following integer variable second word because second word must start on an even byte address 10 6 Chapter 10 15 8 7 0 struct gaps first word int first_word gap bits1 first byte char first byte unsigned bits1 5 unsigned bits2 4 unsigned bits3 4 unsigned bits6 6 byte array 1 byte array 0 char byte array 3 int second word gap bits6 bits3 bits2 gap byte array 2 IE second word OSD246 Figure 10 2 Alignment of structure members Bit fields members of structures or unions are not necessarily aligned on byte or word boundaries A bit field cannot span a word boundary but it can span a byte boundary The compiler allocates two or more adjacent bit fields to a single word whenever possible You can use bit fields for padding to force a structure to conform to an externally imposed format If no field name precedes the field width expression the compiler allocates an unnamed field of the specified number of bits An unnamed field with a length of zero creates a gap until the next word boundary Figure 10 3 shows a structure allocation using bit fields for padding 15 8 7 0 struct pad gap first byte char first_byte gap second_byte un
26. Use this control to include in the program listing code that is not compiled because of conditional preprocessor directives Use the default nocond control to suppress listing of source text eliminated by conditional compilation Whether you specify the cond control or not the conditional preprocessor directive lines appear in the print file They only affect the source text listing in the print file If you specify notranslate or noprint the source text listing is completely suppressed and cond has no effect Also in any part of the source text listing suppressed by nolist or nolistinclude the cond control has no effect Compiler Controls 4 13 q You can specify these controls in the compiler invocation and in pragma preprocessor directives throughout the source text If the cond or nocond control is embedded within the source text the control only affects the source text that follows the control line until the compiler encounters the opposite control or the end of the source text list print listinclude translate 4 14 Chapter 4 debug Function Includes or suppresses debug information in the object module Select the EDE C Compiler Options Project Options menu item Enable or disable the Generate symbolic debug information check box in the Debug tab ess debug nodebug Abbreviation db nodb Class Primary control Default nodebug Description Use this control to place in
27. are listed with the source text Compiling and Linking 3 17 Symbol table and provides symbolic information and cross reference cross reference information Pseudo assembly listing lists the assembly language object code produced by the compiler The code does not contain all the assembler directives necessary for a complete assembly language program but shows the instructions generated by the compiler Compilation summary tabulates the size of the output module the number of diagnostic messages and the completion status successful termination or fatal error of the compilation You can use compiler controls and pragma preprocessor directives to produce suppress or partially suppress the source text listing messages pseudo assembly listing and cross referenced symbol table The following controls affect the format and contents of the print file no code no listexpand no symbols no cond no listinclude tabwidth diagnostic pagelength title no list pagewidth no xref 3 4 2 2 PAGE HEADER Each page of the output listing file begins with a page header The page header describes the compiler identifies the module compiled and shows the date and page number The page head C196 compiler compiling the module CTYPI 2 26 p m Page numbers range from 1 to 99 er in Figure 3 2 shows the E on 01 29 99 at approximately 9 then start over at 0 The example in Figure 3 2 is from the first page of the pri
28. e The c c196 bin directory contains the c196 exe compiler e The c c196 include directory contains the kb s rs h include file e The c Nproject working directory contains the following files The dsf c source text file used as the primary source file in this example This file contains the source text shown in Figures 3 11 and 3 12 The dsfinit h source text file to be included at the beginning of the primary source text by the default initialization file This file contains the source text shown in Figure 3 10 The c96init h default initialization file containing the following preprocessor directives used for all compilations of this example include lt dsfinit h gt pragma pagelength 30 pragma pagewidth 72 Compiling and Linking 3 33 Specify these directories by giving the following DOS commands before invoking the compiler set C196INC c c196 include c project working set C96INIT c project working Setting the c196inc environment variable provides the default search path prefixes that the compiler uses for include files in all subsequent compilations Setting the c96init environment variable provides the path prefix that the compiler uses for the c96init h initialization file in all subsequent compilations You need to set these environment variables only once each time you reset your host system before compiling the program 3 8 3 PREPROCESSING Before compiling the source text into object
29. nocase Abbreviation cs nocs Class Primary control Default case Description Use this control to tell the compiler to work in a case sensitive manner However some general rules regarding case sensitivity must be considered 1 Options supplied on the command line and V are always handled case sensitive 2 Controls supplied on the command line are always handled case insensitive 3 Keywords are always handled case insensitive When you use the nocase control 4 All module names public and external symbols are converted to upper case 5 All filenames are converted to lower case Compiler Controls When you use the default case control 6 None of the conventions mentioned in 4 or 5 is performed 4 7 4 8 Chapter 4 ccb Function Specifies the initial chip configuration byte value Select the EDE C Compiler Options Options file menu item Enter a single or multiple byte value in the Specify Chip Configuration one module only field in the Object tab E ccb value where value is a single or multiple byte value Abbreviation cc Class Primary control Description Use this control to initialize the value of up to four chip configuration bytes CCB located at 2018H or at OFF2018H OFF201AH and OFF201CH for the 80C196NT The 80C196 processor reads the CCB on reset to initialize the value of the chip configuration register CCR See
30. the C196 compiler for efficient register allocation 6 1 REGISTER MEMORY Figure 6 1 shows the register memory layout of the 80C196KB processor This layout is the same as the register memory layout of the 8096 90 and 8096BH Not shown in the figure is the additional register space of the 80C196KC the 80C196KR and the 80C196NT microcontrollers The 80C196KC 80C196KR and 80C196NT have 256 bytes of additional registers from 100H through 1FFH or higher The C196 compiler tries to allocate variables to the register memory as much as possible if the registers all control is in effect so that instructions can be more compact and can execute faster Some of these locations have dedicated or default uses as follows e Special function registers SFRs are defined in xx sfrs obj For an explanation of the structure and use of the SFRs see the 80C196 Assembler User s Guide or the Embedded Microcrontrollers and Processors Handbook listed in Related Publications e The stack pointer SP in locations 18H and 19H indicates the address of the top of the stack e Temporary registers in locations 1CH through 23H or 2BH are used for intermediate calculations and for returning the value of a typed function The compiler treats this section of memory as the TMPREGO and TMPREGS if needed register variable You can use the tmpreg control to change the location of the temporary registers qe See Chapter 4 for more information about t
31. where string is the print file title Abbreviation tt Class Primary control Default title primary source filename Description Use this control to specify the print file title A title can be up to 60 characters long To specify no title use at least one blank space character in the title string Do not use the null string The compiler uses the primary source filename without the filename extension as the title For example if myprog c is the primary source file myprog is the print file title The compiler places the title at the top of each page of the print file A narrow page width can cause the compiler to truncate a long title The noprint and notranslate controls suppress the print file causing the title control to have no effect 4 108 Chapter 4 The title control affects the entire print file You can specify this control in the compiler invocation or in a pragma preprocessor directive preceding the first line of data definition or executable source text To override a pragma title string specified in the source text specify title with a different string in the compiler invocation pagelength tabwidth pagewidth translate print Compiler Controls 4 109 tmpreg Function Locates the temporary registers Syntax tmpreg addr where addr is a valid absolute address in decimal or hexadecimal format Abbreviation tr Class Locating control Default tmpreg 1CH
32. 1 9 B C196INC 1 4 1 9 C96INIT 1 4 1 9 LM LICENSE FILE 1 8 A 6 PATH 1 4 1 9 TMPDIR 1 5 1 10 Epilog 10 7 10 8 10 9 10 10 10 13 B 4 Error messages 4 19 9 12 Fatal 9 5 errors FLEXIm license A 25 example starting EDE 2 7 examples 2 7 using EDE 2 7 using tbe makefile 2 13 Exit status 4 20 extend control 4 23 6 7 7 3 Extended addressing 10 20 Extended semantics 10 14 Extensions 3 10 extern storage class 4 23 extratmp control 4 26 F far 10 20 farcode 4 27 10 21 farconst 4 29 fardata 4 30 10 21 fastinterrupt control 4 31 Fatal error messages 9 3 9 5 Filename conventions 3 10 Fixed parameter list 4 32 fixedparams control 4 32 Flexible License Manager A 1 FLEXIm A 1 daemon log file A 17 daemon options file A 6 license administration tools A 8 license errors A 25 user commands A 11 Floating point Argument 10 8 Data types 10 4 Initialization 5 4 8 20 Input formatting 8 25 Library 8 3 8 7 Linking 3 25 Output formatting 8 23 Floating point support c96fp lib library 8 3 fpal96 lib library 8 3 fpal96 lib library 8 3 fpinit function 8 20 FPL calling convention 4 32 Frame 10 9 10 10 frame 4 109 Frame pointer 6 3 10 9 10 10 frame pointer 4 109 Function redeclaration 4 24 G Gaps 10 5 10 6 General controls 3 4 General registers 6 3 generatevectors control 4 35 Global register variables 6 13 glossary B 1 Index 8 Header files 8
33. 12 9 5 Warnings i beret mister atem bt Saeed 9 28 9 6 Remarks 2 cese br eC OO wes BAC Pre d 9 36 VIII Table of Contents LANGUAGE IMPLEMENTATION 10 1 10 1 Data Representation vues eec mE Y ce es 10 3 10 1 1 Data TY Pes a tede reta b a ip oe ron docto e eios 10 3 10 1 2 Contiguity ii russa seran dec n mona RATE Ree e eR Rc 10 4 10 1 3 Alignment neran ra p be too et c e Re 10 5 10 2 Calling COMVENHONS viecsevarewdess M e qu RERO 10 7 10 2 1 Passing ArgumentS csse eR RE ORO ER 10 8 10 2 2 Returning a Value 2 0 eee 10 9 10 2 3 Local Variables 4 5 uet rae d EEEE T x et 10 9 10 2 4 Reentrant Functions eas iiaii r R ss 10 12 10 2 5 Interrupt Functions Srei 2 aR T EC R TR T enn 10 13 10 5 Stack Size Calculation s saisi panii eee 10 13 10 4 Implementation dependent C196 Features 10 14 10 4 1 Characters cce ettet MR TO RR RIDERE ADR 10 14 10 4 2 Ideft flefs 4X vues quU eoe Wie ed ees QU Ne e CP 36 10 14 10 4 3 Extended Semantics and Syntax 00 000s 10 14 10 4 4 InitializatiOD 42 saiia gutes ovp bh beg wd Bowe en 10 15 10 4 5 Data Type Conversion ca a 00 000 cee eee ee 10 18 10 4 6 Bit Fields seca edo erbe gents ee ees 10 19 10 4 7 Division Remainder Operators esses 10 19 10 4 8 Volatile Objects 10 20 10 4 9 Extended Addressing cre R 0 RR KR sees 10 20 10 4 9 1 Far and Near Data 4 raa tita R ewan ane RR DRE 10 21 10 4 9 2 Far and Near Code cose rir R eee 10 21 10 5 Compiler
34. 7 Special function registers 0 5 Table of 8 7 Heap space 8 28 hold control 4 36 6 12 6 15 Host system 9 3 Identifiers 10 14 idle function 6 5 8 21 idle mode 8 21 Implementation dependent features 10 14 Bit Fields 10 19 Characters 10 14 Data type conversion 10 18 Division Remainder operators 10 19 Extended semantics 10 14 Identifiers 10 14 Initialization 10 15 Syntax 10 14 Volatile objects 10 20 In line assembly code 7 3 Accessing array elements 7 5 Constant table declaration 7 6 Restrictions 7 4 7 5 Syntax 7 3 include control 4 38 Include files 4 99 C196INC 10 22 c96init b 10 22 Compiling 4 38 Controls 3 15 ctype b header file 8 10 Default 1 4 1 9 Diagnostics 4 55 Environment variables 1 4 1 9 Examples 3 18 4 100 Index Header files 8 7 Nesting 5 18 Preprint file 3 13 Preprocessor directives 3 15 4 38 4 39 4 55 Print file 3 18 4 51 4 55 Scope 4 38 Search path 1 4 1 9 4 99 4 100 10 22 Source text 4 38 string h header file 8 13 xx_funcs h header file 8 8 xx sfrs b header file 8 9 Indeterminate storage operation optimization 4 75 init control 4 40 init serio function 5 4 8 23 Initialization 4 40 Zero absolute 4 4 Zero relocatable 4 128 Initialization table 10 17 Initializing the CCB 4 8 inst control 4 41 Installation UNIX 1 6 Windows 95 1 3 Windows 98 1 3 Windows NT 1 3 Installation procedure 1 1 Instruction set Compatibility 4 60
35. 8 pragma pts single 0 Assign control block to vector 0 pragma interrupt timer1 0 Interrupt vector zero 4 88 q int count const char ere char dst 20 This AX Chapter 4 S a pts test unsigned char save wsr init serio strcpy dst This should not be count 0 single ptscount 20 single ptscon di 1 single ptscon si 1 single ptscon du 1 single ptscon su 1 single ptscon b_w 1 single ptscon mode 4 single ptssrc void single ptsdst void Save wsr wsr wsr 1 ptssel 1 wsr save wSr int mask 0x01 iocl 0x04 enable asm epts while count 1 printf src s n r printf dst s n r void timer1 void count interrupt pts_piha wd cos dst Hwindow 1 Enable pts timer overflow Enable timer overflow Enable timerl overflow interrupt Enable PTS Wait for timer ovfl interrupt sre dst Interrupt Handler for vector 0 Compiler Controls 4 89 pts piha pts pihb Function Loads a piha pihb PTS vector with the address of a PTS control block Syntax pragma pts piha struct name vector pragma pts pihb struct name vector where struct name is a name assigned to the control block vector is an interrupt vector number or an interrupt vector address Class General control Description These c
36. ASM196 module to use the vertical windowing done in C declare wsr as an external byte variable in your ASM196 module and add the WSR management code to the prolog use the address of wsr which is wsr and to the epilog of local routines where appropriate The following example shows how to write your ASM196 module This example assumes that the ASM196 module is called by main Your C196 module contains the following line void func void main func Your ASM196 module must contain the following lines example module Sinclude _SFR_INC_ oseg varl dsw 1 cseg public func func push wsr andb wsr 80h orb wsr wsr ld varl 10 ldb wsr sp add sp 2 ret end Processor Registers 6 15 If you have a specific use for vertical windows and do not want the C196 compiler to allocate windows for your application do not compile with the windows control Move the desired value to the wsr register to switch to the desired window inside the desired function You must restore the original window before exiting that function Do not link with the registers and windowsize controls 6 4 3 2 USING WINDOWED PARAMETERS Structures can be placed at locations that can be mapped into one of the vertical windows and the window can then be used by a function to access the fields of the structure using the best possible addressing mode direct register access You can use this feature by inserting
37. Access the Project menu and select Open Select the project file to open and then click OK For the LED light program select the file ea_examp p jt in the subdirectory ea examp in the examples subdirectory of the 80C196 product tree If you have used the defaults the file ea examp pjt is in the directory c Nc196Nexamples Vea examp If you want to build another example open the project file in the corresponding subdirectory of the examples directory Overview 2 9 How to Load Open Files The next two steps are not needed for the demo program because the source files and makefile are already open To load the file you want to look at 1 In the Project menu click on Load files This opens the Choose Project Files to Edit dialog 2 Choose the file s you want to open by clicking on it You can select multiple files by pressing the Ctrl or Shift key while you click on a file With the Ctr1 key you can make single selections and with the Shift key you can select everything from the first selected file to the file you click on Then press the OK button Choose Project Files to Edit x Project Files 1 of 1 selected d isdn demo c This launches the file s so you can edit it them How to Build the Demo Application The next step is to compile the file s together with its dependent files so you can debug the application Steps 1 and 2 are optional Follow these steps if you want to
38. Description Use this control to locate the temporary registers namely TMPREGO at a different address qe See Chapter 6 for more information on TMPREGO and see Chapter 10 for more information on the FRAMEO1 variable By default the temporary registers are located at address 1CH To relocate these registers specify an address in the addr parameter using decimal or hexadecimal format For example the address 44 in decimal is equivalent to 2CH or 0x2C in hexadecimal format The address you specify must be on a double word boundary If you specify this control TMPREGO appears as TMPRxx and FRAMEO1 appears as FRAMExx in the listing file The placeholder xx stands for the hexadecimal address where the registers are currently located For example if you locate the temporary registers to 2CH TMPREGO appears as TMPR2C and FRAMEO1 appears as FRAME2C 4 110 Chapter 4 To correctly use this feature you must link to your application using RL196 a module containing a declaration that reserves eight bytes of memory space sixteen bytes for model nt at the address specified by addr You can create this module with ASM196 The compiler uses these eight bytes as the new temporary registers Name the variable TMPRxx where xx is the hexadecimal address specified by addr For example if you want to locate the temporary registers to 2CH the variable name must be TMPR2C See the example section for instructions on
39. E andb Tmp0 ad result lo 8 OH Figure 5 15 Digital signal filter code listing level 0 optimization 3 42 001A 001D 001F 0022 0024 0026 0026 002A 002D 002F 0032 0034 0034 C196 Compiler 0038 003C 0040 0043 0043 0045 0047 0048 0049 0049 004B 004E 0050 0053 0056 0059 005C 005F 981C00 DFO7 997100 DF02 1702 5180001C 981C00 DF05 B00200 200F 5D71021C DSF Assembly Listing 5D71001E 441E1CO0 B00100 CC1E CCIC F5 FO 1100 B12200 1100 B11800 A0001C 09061C A01CO0 EF0000 2000 E R 80003 E E 80004 R Chapter 3 cmpb RO TmpO be 80003 cmpb ad result hi 4 71H be 80003 Statement 35 incb input Statement 36 andb Tmp0 ioport0 80H cmpb RO TmpO be 0004 Statement 37 ldb ioportl input Statement 38 br 80005 Statement 40 mulub TmpO input 71H 01 29 99 15 14 37 Page 14 of Object Code E R 80005 main mulub Tmp2 ioportl 471H add word value Tmp0 Tmp2 Statement 41 ldb ioport1 word_value 1 Statement 43 pop Tmp2 pop TmpO popa ret Statement 55 Statement 56 clrb ioportl Statement 57 ldb int mask 22H Statement 59 clrb int pending Statement 60 ldb hao command 18H Statement 61 ld TmpO timerl shl TmpO 6 ld hso time TmpO Statement 63 call enable Statement 64 br 80008 Figure 5 15 Digilal signal filter code listing level 0 optimi
40. Limits 2 0 0 0 eee 10 22 FLEXIBLE LICENSE MANAGER FLEXLM A 1 1 INtWOdUCHON esas o E ER raspii RET EG MO TERNS OES A 3 2 License Administration serri sentera tai EnA R A 3 2 1 OVervieW osssxexkevekteder ke etkeseeU ever Ee A 3 2 2 Providing For Uninterrupted FLEXIm Operation A 5 2 3 Daemon Options File sees A 6 2 4 License Administration Tools 00 00 0005 A 8 3 FLEXIm User Commands s roti kens A 11 Table of Contents 4 The Daemon Log File esee er RR e es A 17 4 1 Informational Messages sess eee A 18 4 2 Configuration Problem Messages sess A 21 4 3 Daemon Software Error Messages ss issus A 23 5 FLEXlm License Errors craveri reene ER T eee A 25 GLOSSARY B 1 INDEX RELEASE NOTE CONTENTS Table of Contents Manual Purpose and Structure XI MANUAL PURPOSE AND STRUCTURE PURPOSE This manual is aimed at users of the TASKING 80C196 C Compiler It assumes that you are familiar with the 80C196 architecture and the C programming language INSTALLING THE COMPILER To install the C196 compiler see Chapter 1 Software Installation The installation utility on the distribution media leads you through installing the compiler and the utilities on your host system To automate the compiling and linking processes configure the environment variables listed in the Software Installation chapter and see Chapter 3 for instructions on how
41. Object Primary faster code and less code size Default speed 0 symbols sb Generates or suppresses the identifier Listing Primary nosymbols nosb list in the print file Default content nosymbols tabwidth a tw Specifies the number of characters Listing Primary between tabstops in the print file format Default 4 characters between tabstops title a tt Places a title on each page of the Listing Primary print file Default modulename format tmpreg a tr Locates the temporary registers at a Object Primary different memory location Default 1CH translate t Completes or stops the compilation Object Invocation notranslate notl after preprocessing Default translate The notranslate control overrides all object and listing controls except preprint type ty Generates or suppresses type Object Primary notype noty information in the object module Default type warning true false wt Enables or disables the comparison Object Primary nowarning true false nowt always returns TRUE and comparison always returns FALSE warnings Default warning true false winil 32 v3 Combination of pragma locate and Object General winil 64 v6 pragma overlay Only if WSR1 is present in processor win32 w3 Combination of pragma locate and Object General win64 w6 pragma overlay win128 w1 windowram a Wr Specifies the area s of memory from Object General which to allocate windowed variables windows a wd Specifies that the whole applicat
42. Rz SN C 1993 Tasking BV Compilation of module EXFRM C 1980 1990 1992 1993 Intel Corporation Object module placed in EXFRM obj Compiler invoked by c Nc196MbinNC196 EXE EXFRM c code xref Line Level Incl 1 main 2 3 i int a b c 4 1 a bcoc 5 al Symbol Table Name Size Class Address Attributes a 2 Auto 2 int in function main 3 4 b 2 Auto 4 int in function main 3 4 oi 2 Auto 6 int in function main 3 4 main Public reentrant VPL function returning int Assembly Listing of Object Code Statement 2 0000 main 0000 69060018 sub SP 6H 0004 C800 E push FRAMEO1 0006 01800 E ld FRAMEO1 SP Statement 4 0009 A300041C 000D 670006 ld Tmp0 b FRAMEO1 add Tmp0 c FRAME01 g Ej pj ws 0011 c300021C st Tmp0 a FRAMEO1 Statement 5 0015 cCcc00 E pop FRAMEO1 0017 65060018 add SP 6H 001B FO ret Figure 10 5 Print file 10 12 Chapter 10 ATTRIBUTES VALUE NAME PUBLICS CODE ENTRY 2083H MAIN REG WORD 001AH FRAMEO1 REG NULL 001CH TMPREGO NULL NULL 002kEH MEMORY NULL NULL 1FD2H MEMORY SIZE Figure 10 6 Map file illustrating frame pointer 10 2 4 REENTRANT FUNCTIONS The prolog of a reentrant function includes code if necessary to save all registers that are to be used by the function The epilog includes code to restore the saved registers to the values used by the calling function The prolog of each reentrant public function contains a statement or statements push
43. Selection 4 60 Intel extensions Character handling 8 10 Floating point 8 20 8 23 8 25 Input formatting 8 25 Interrupts 6 16 8 17 8 19 Keywords 6 8 Output formatting 8 23 Processor state 8 9 8 21 8 22 Register variables 6 7 Registers 8 9 Index Index 9 Storage classes 0 7 Strings 8 13 8 15 6 27 Intermediate results 6 6 Interrupt Address 4 44 Base address 4 49 Calling convention 4 31 4 32 4 43 4 44 4 48 4 49 10 12 10 13 Control 4 43 4 44 4 48 Disabling 6 5 8 16 8 17 Enabling 6 5 8 18 8 19 Fast 4 31 Function 4 31 4 43 4 44 4 48 4 49 9 20 Functions 10 13 Header files 8 9 interruptpage control 4 49 Mask 10 12 Numbers 4 43 4 44 4 48 4 49 Page number 4 49 Priority 4 44 Processor differences 4 43 4 44 4 49 Processor state 10 13 Reentrancy 6 8 Registers 10 12 Vector 4 35 4 43 4 44 4 48 4 49 Vector table 4 44 interrupt control 4 43 Interrupt handlers Assigning 4 43 4 48 4 49 interrupt_piha control 4 48 interrupt_pihb control 4 48 Interrupting compilation 4 112 interruptpage control 4 49 Invocation 3 3 Elements 3 3 Syntax 5 5 Invocation only controls 3 5 isascii function 8 10 J Jump optimization 4 74 L Language implementation 10 1 LIB196 library manager 2 5 3 25 Libraries Creating 2 5 Selection 3 25 3 29 User defined 3 25 Library files 8 1 8 3 c96 lib library 8 3 c96fp lib library 8 3 fp
44. a print file Use noob ject to find statement numbers and scope information any diagnostic messages symbolic information and the size of the compiled object code without generating a new object file The default name for the object file is the same as the primary source file name with the obj extension substituted for the original extension as shown in Table 3 3 The compiler places the object file in the directory containing the source file To override the defaults use the object control If a file with the same name already exists the compiler writes over it 3 24 Chapter 3 3 5 AUTOMATICALLY INVOKING THE C196 COMPILER TASKING offers two ways of automatically invoking a series of commands makefiles batch files shell scripts command procedure files This section describes how to use these files to automatically invoke the C196 compiler 3 5 1 USING MAKE UTILITY MK196 q mk196 takes a file of dependencies a makefile and decides what commands have to be executed to bring the files up to date These commands are either executed directly from mk196 or written to the standard output without executing them For a detailed discription of this utility see Chapter MK196 Make Utility of the 800196 Utilities User s Guide 3 5 2 USING BATCH FILES Batch files are a facility within DOS whereby one or more commands can be executed from within a file Assume that the following sequence of calls is frequently us
45. all open streams exit This routine is the exit routine without support of atexit and without stream support If you cannot use the default omf 2 control it might be necessary for you to also call some of the following subroutines Note that you should also recompile several library routines for omf 1 Startup Code 5 5 Jpinit Initialization routine for floating point operations The call is only needed if you use floating point calculations This call is only needed in the main routine which is provided in c96fp lib init stdio Initialization routine to set up the streams stdin stdout and stderr These streams are used for the printf routines and the scanf routines init atexit Initialization routine to set up the atexit routine This is only necessary if you use the ANSI C compatible exit routine init malloc Initialization routine for dynamic memory allocation This call is only needed if you use dynamic memory allocation The _main routine can be tailored to your specific needs by adding define statements The main routine as is supplied within the libraries contains the minimum required calls to execute an application It only calls imain main and exit 5 3 WRITING YOUR OWN STARTUP CODE You can write your own startup code using the ASM196 assembly language You must declare your module to be the main module by using the cmain attribute Load the sta
46. area of the register file and above from 80H or OCOH or OEOH depending on the window size Public register variables allocated in the register segment are restricted to the registers below the mapped area below 80H or 0COH or OEOH depending on the window size This allocation scheme allows access to these variables without swapping the wsr qe See Section 6 4 3 for more information on vertical windows If you specify the hold control the compiler produces the following WSR management code in the prolog ldbze Tmp0 WSR push TmpO andb WSR 80H to retain hlden in wsr orb WSR WSR Otherwise with the nohold control the following code is produced ldbze Tmp0 WSR push TmpO ldb WSR WSR The compiler produces the following code in the epilog with or without the hold parameter Idb WSR SP pop RO The hold control can only be used with processors that support vertical windows Otherwise the compiler generates a fatal error qo model reentrant regconserve registers windowram 4 38 Chapter 4 include Function Inserts text from specified file Select the EDE C Compiler Options Project Options menu item Enter a filename in the First include file s field in the Misc tab You can enter multiple filenames by separating them with commas ER include iename where filename is the file to be included and compiled before the primary source file Abbr
47. calls are assumed to be within the 32K range of a normal call Note that in extended mode all return addresses are four bytes long regardless of the type of call instruction used 4 28 Chapter 4 The farcode control can only be used with 24 bit models farconst fardata model nearcode nearconst neardata Compiler Controls 4 29 farconst Function Specifies that the default placement of constant data is the far const segment Syntax Select the Far Const radio button in the EDE CPU Model menu item mgl farconst Abbreviation fk Class Primary control Default nearconst Description Use this control to allow constant data to be placed anywhere in the 24 bit extended address space of the 24 bit processors This control causes the compiler to place switch table constants in the farconst segment of the object module as well as any user defined constant data that is not qualified with the near keyword The generated code will use extended addressing to access these constants When you link your program module s with RL196 you can locate the farconst segment anywhere you have ROM The farconst control can only be used with 24 bit models NT CNF or NT ENF qo farcode fardata model nearcode nearconst neardata 4 30 Chapter 4 fardata Function Specifies that the default placement of variable data is the far data segment Syntax Select the Far Data radio butt
48. change the last fourth field of a SERVER line in the license file This cannot have any effect on the error message but changing it will cause other problems license file does not support tbis version If this is a first time install then follow the procedure for the error message FLEXlm license error encryption code in license file is inconsistent because there may be a typo in the fourth field of a FEATURE line of your license file In all other cases you need a new license because the current license is for an older version of the product Replace the FEATURE line for the old version of the product with a FEATURE line for the new version it can be found on the new license data sheet Run the Imreread command afterwards You can have only one version of a feature previous versions of the product will continue to work FLEXIm license error cannot find license file Make sure the license file exists If the pathname printed on the line after the error message is incorrect correct this by setting the LM LICENSE FILE environment variable to the full pathname of the license file FLEXIm license error cannot read license file Every user needs to have read access on the license file and at least execute access on every directory component in the pathname of the license file Write access is never needed Read access on directories is recommended FLEXIm license error no sucb feature exists Check the licens
49. code you can check the preprocessing performed in your program to verify all your macro expansions and conditional compilation expressions Macro expansion file inclusion and conditional compilation are all shown in the preprint file Diagnostic messages appear on your console not in the preprint file and you can redirect these messages to a log file To generate a preprint file without generating object code redirecting any messages to dsf pre log specify the preprint and notranslate controls as follows C c196 dsf c preprint notranslate dsf pre log AN define macro definitions do not appear in the preprint file The compiler substitutes the body of the macro wherever the macro name appears in the source text Since no errors occurred during preprocessing dsf_pre log contains only the following sign on message 80C196 C compiler vx y rz SN000000 004 c year TASKING Inc C 1980 1990 1992 1993 Intel Corporation When errors occur during preprocessing dsf_pre log contains in addition to the sign on message lines such as the following Error at line 12 of c project working dsfinit h illegal constant expression 3 34 Chapter 3 Figure 3 13 shows the resulting dsf i preprint file Compiling this file has the same result as compiling the dsf c file line 1 c96init h line 1 dsfinit h BRR kk ck ck Ck kk kk kk ke k ko kk kk kk kk o kk kk ke IR OR RR ko OR OR kk kk kk kk ek ek ek kk T This
50. compiler invocation but the preprocessor only issues a warning if the invalid identifier occurs in a pragma directive invalid syntax for control control The compiler control contained a syntax error Invalid control syntax is a fatal error if it occurs in the compiler invocation but the preprocessor only issues a warning if the invalid syntax occurs in a pragma directive line no more free space The internal structure used to hold macros is exhausted Use fewer macros in your program null argument for control control Null arguments for compiler controls are not allowed For example the following is illegal varparams f1 f2 A null argument is a fatal error if it occurs in the compiler invocation but the preprocessor only issues a warning if the null argument occurs in a pragma directive out of memory The internal memory buffer used to hold macros was exhausted Use fewer macros in your program previous errors prevent furtber compilation The compiler was unable to recover from previous errors in the compilation Correct the errors reported thus far then recompile 9 10 i Chapter 9 regconserve conflicts witb registers all registers all conflicts witb regconserve The registers all control specifies that the compiler is to allocate all program variables to registers including variables declared without the explicit registers attribute register variables The regconserve control specifies that the
51. compiler is to conserve registers placing only register variables and optionally a subset of the non register variables in registers The compiler cannot resolve these conflicting directions This error is fatal if both controls are specified in the compiler invocation but the preprocessor only issues a warning if the conflict occurs in pragma directives switch table overflow Too many active cases exist in a switch statement that has not yet been completed symbol table overflow Too many symbols are defined in the module Remove unused definitions or break the module into two or more smaller modules too many directories are specified for search pathname Too many directories are specified in the compiler invocation with the control searchinclude The pathname is the directory at which the error occurred that is the first directory over the limit too many include files Too many include files have been specified Combine include files or break the module into two or more smaller modules syntax error An unrecoverable syntax error has occurred Two situations that can cause this error are e The alien reentrant or nonreentrant keyword is present with the noextend control in effect e An identifier is present in function context but does not have a body for example int f1 syntax error missing semicolon int t21 valid Messages and Error Recovery 9 11 type table full Too many symbols with
52. conditional code diagnostic determines class of messages that appear no list generates or suppresses source text listing no listexpand generates or suppresses macro expansion listing no listinclude generates or suppresses text of include files Table 3 5 Controls that affect tbe source text listing 3 20 Chapter 3 7 3 4 2 5 REMARKS WARNINGS AND ERRORS Compiler messages indicate fatal errors errors warnings and remarks The compiler prints each message referring to syntax such as a misplaced keyword on a separate line immediately following the offending statement All messages referring to semantics such as too many register variables appear at the end of the source text listing If the offending statement is not printed the compiler prints the messages in the listing as the compiler generates them To suppress the generation of remarks and warning messages use the diagnostic control Figure 3 5 shows a syntax error message qo See Chapter 9 for a complete list of error messages generated by the compiler Line Level Incl 1 include ctype h Error at line 1 of ctype x c illegal syntax in a directive line 2 3 unsigned char upcx unsigned char input 4 5 1 if isascii input amp amp input gt a amp amp input lt f 6 1 return input a A qx else 8 1 return input 9 1 Figure 3 5 Print file source text listing with error message 3 4 2 6 SYMBOL TABLE
53. control The argument specified for control is not valid For example the argument specified for model is invalid invalid control control A control not supported by the compiler was specified Check the spelling of the control An invalid control is a fatal error if it occurs in the compiler invocation but the preprocessor only issues a warning if the invalid control occurs in a pragma directive Messages and Error Recovery 9 33 invalid decimal argument value Non decimal characters were found in an argument that must be a decimal value An improper argument is a fatal error if it occurs in the compiler invocation but the preprocessor only issues a warning if the improper argument occurs in a pragma directive invalid identifier identifier An identifier does not follow the rules for forming identifiers in C An invalid identifier is a fatal error if it occurs in the compiler invocation but the preprocessor only issues a warning if the invalid identifier occurs in a pragma directive invalid syntax for control control The compiler control contained a syntax error Invalid control syntax is a fatal error if it occurs in the compiler invocation but the preprocessor only issues a warning if the invalid syntax occurs in a pragma directive null argument for control control Null arguments for compiler controls are not allowed For example the following argument is illegal varparams f1 f2 A null argument is a fa
54. control does not have any effect if the noprint or nolist control is in effect qo list print Compiler Controls 4 23 extend Function Recognizes or suppresses Intel C196 extensions Select the EDE C Compiler Options Project Options menu item Select the Enable all language extensions or Disable language extensions strict ANSI mode radio button in the Language tab ess extend noextend Abbreviation ex noex Class Primary control Default extend Description Use this control to direct the compiler to accept file scope register variables and the alien far near reentrant and nonreentrant keywords in the source text This control also ensures compatibility between prototype and non prototype function declarations Use the noextend control to suppress recognition of these extensions These extensions provide compatibility with earlier versions of C196 When extend is in effect the register storage class and allocation of registers work as follows e You can declare file scope variables with the register storage class e The regconserve and noregconserve controls determine whether file scope non register variables as well as block scope non register variables are allocated to registers 4 24 Chapter 4 e You can combine the static and extern storage classes with register declarations at both block and file scope for example static register int sri xtern register in
55. e Embedded Microcontrollers and Processors Handbook 270645 e 8XC196xx User s Manuals E Only the TASKING publications are included in the C196 manual package Intel publications can be ordered from Intel s Literature Center Manual Purpose and Structure XV CONVENTIONS USED IN THIS MANUAL The notation used to describe the format of call lines is given below Items shown inside curly braces enclose a list from which you must choose an item Items shown inside square brackets enclose items that are optional The vertical bar separates items in a list It can be read as OR italics Items shown in italic letters mean that you have to substitute the item If italic items are inside square brackets they are optional For example filename means type the name of your file in place of the word filename An ellipsis indicates that you can repeat the preceding item zero or more times b You can repeat the preceding item but you must separate each repetition by a comma screen font Represents input examples keywords filenames controls and screen output examples bold font Represents a command name an option or a complete command line which you can enter For example command option filename This line could be written in plain English as execute the command command with the optional options option and with the file filename Illustrations The following illustrations are used in this manua
56. even byte addresses and occupying consecutive words in memory Scalar variables shorter than one word char signed char and unsigned char variables and aggregate variables that contain only unaligned members are byte aligned starting on any byte address and occupying consecutive bytes in memory Register variables that are a multiple of four bytes in length are longword aligned unless the wordalign control is in effect Language Implementation 10 5 The alignment of variables affects the amount of memory space occupied by the program s data The compiler attempts to realign data items to optimize the memory space used This realignment can result in an arrangement of the declared items in memory different from the arrangement of the declarations in the source text Figure 10 1 shows an example of the memory allocation corresponding to a set of declarations The variables occupy the low order byte first starting from bit 0 15 8 7 0 signed int first word first word char first byte second byte unsigned int second word second word char byte ary 2 byte ary 1 byte ary 0 second byte first byte OSD245 Figure 10 1 Contiguity of variables 10 1 3 ALIGNMENT Members of an aggregate variable occupy contiguous storage in the order specified in the declaration Byte gaps are introduced as needed for alignment Figure 10 2 shows the memory allocation of a structure
57. first declaration or definition of a function sets the calling convention for that function based on the fixedparams or varparams control in effect for the function or based on the alien keyword or the comma and ellipsis if specified for the function The comma and ellipsis indicate that the number of parameters to the function has no limit In this Case varparams is in effect The notranslate and noobject controls suppress the object file causing fixedparams to have no effect However if you specify the code control with the noobject control the effect of ixedparams does appear in the pseudo assembly code listing You can specify fixedparams in the compiler invocation and in pragma preprocessor directives throughout the source text When specified without arguments this control affects all functions in the subsequent source text and remains in effect until the compiler encounters the opposite control varparams or the end of the source text The fixedparams control specified with an argument list affects only the functions in the argument list A More than one explicit calling convention specification for any one function causes a warning A warning occurs if a function in the source text is explicitly declared with a variable parameter list and is named in the function list for the fixedparams control pragma fixedparams x int x INE 1 2 In this example varparams is in effect Examples 1 The followin
58. for the 8096 processor uses a pushf instruction code for the 80C196 processors use a pusha instruction In the epilog of the interrupt function the last instruction pops the saved PSW off the stack This action restores the processor state to what it was before the interrupt Code for the 8096 processor uses a popf instruction code for the 80C196 processors use a popa instruction The compiler pushes pops all temporary registers when an interrupt function calls any other function This has been done for savety reasons If possible it will be more efficient not to call any function at all In that case only the used registers will be saved restored 10 3 STACK SIZE CALCULATION For each function the C196 compiler calculates its stack size requirements The results of these calculations can be seen in the Function Statistics as they are printed for each function in the pseudo assembly listing see section 3 4 2 7 The C196 compiler also calculates the total stack size required by each module This result can be found in the Module Information in the list file see section 3 4 2 8 The stack size calculated is correct as long as there are no recursive function calls in the source If there are any recursive function calls the compiler will generate a warning and the user should reserve additional room for the stack while linking This can be done with the ss control see the linker documentation for that 10 14 Chapter 10
59. function 8 13 8 15 ctype h header file 8 10 Customer comments 2 5 Customer service hotline 2 5 Data type conversion 10 18 Date 3 17 debug control 4 14 debugger starting 2 12 Index Debugging DEBUG macro 3 14 4 15 Controls 4 14 4 15 4 113 Object file 4 14 Optimization 4 15 4 71 Print file 4 105 4 126 RL196 4 14 Symbolic information 4 14 4 15 4 113 with In circuit emulator 4 14 Debugging code 3 39 4 10 define control 4 16 diagnostic control 3 20 4 19 9 4 Diagnostic levels 4 19 Diagnostic messages 9 1 Diagnostics DIAGNOSTIC macro 3 14 4 20 Completion message 4 19 9 3 Console 4 20 4 112 Controls 3 20 4 19 4 20 9 3 Examples 3 20 Exit status 4 20 Include files 4 55 Preprocessing 4 112 Print file 3 20 4 20 disable function 6 5 8 16 disable pts function 6 5 8 17 Disabling interrupts 8 16 Disabling the PTS interrupts 8 17 Division 4 21 Division operator 10 19 divmodopt control 4 21 Duplicate code optimization 4 74 Dynamic memory allocation 5 5 8 28 EDE 2 7 build an application 2 9 load files 2 9 open a project 2 6 select a toolchain 2 8 Index Index 7 start a new project 2 12 starting 2 7 eject control 4 22 Ellipsis 4 3 embedded development environment See EDE enable function 6 5 8 18 enable pts function 6 5 8 19 Enabling interrupts 8 18 Enabling the peripheral transaction server s interrupts 8 19 environment variable 1 4
60. generatevectors hold ho Specifies whether the windowing code Object Primary nohold noho needs to preserve the HOLD HOLDA bit in the WSR Default nohold include a ic Specifies a file to process before the Source Invocation primary source file init it Tells the compiler to produce Object Primary noinit noit initialization segments and tables Default init inst is Specifies whether the compiler Source Primary noinst nois creates vector tables for switch statements Default noinst interrupt a in Specifies a function to be an interrupt Object General handler interrupt piha a Specifies a function to be an interrupt Object General interrupt pihb a handler in the piha pihb block interruptpage a ip Specifies an interrupt page number or Object Primary base address list li Includes or suppresses the source Listing General nolist noli text listing in the print file Default content list The nolist control overrides cond listexpand and listinclude listexpand le Includes or suppresses macro Listing General nolistexpand nole expansion in the print file Default content nolistexpand listinclude Ic Includes or suppresses text from Listing General nolistinclude nolc include files in the print file Default content nolistinclude The nolistinclude control overrides listexpand and cond for include files locate a lo Locates symbols to absolute Object General addresses Can only be specified in a pragma directive mixedsou
61. how to create this module This control is particularly useful for multi tasking applications The control allows each task to have its own set of temporary registers Examples As mentioned in the discussion you must reserve an eight byte or sixteen byte memory space to be used as the new temporary registers so that no other module attempts to use these eight bytes The following example shows how to declare this variable in assembly language This example also explains how to assemble compile and link the module to your application Create an assembly module called tmpreg a96 for this example with the declaration shown below This example locates the temporary registers at location 2CH and allocates a relocatable register for the frame pointer public TMPR2C rseg at 2CH TMPR2C equ dsl 2 rseg FRAME2C equ dsw 1 end Assemble this module See the 80C196 Assembler User s Guide for the ASM196 assembly invocation syntax Compile your C196 programs with the tmpreg 2CH or tmpreg 0x2C control This control tells the compiler that the temporary registers are now located at 2CH During the link phase link the ASM196 object module with your C196 object modules as follows rl196 cprgl obj cstart obj cprg2 obj tmpreg obj c96 1ib Compiler Controls 4 411 TMPREGO can be pulled in by using MUL DIVL etc If that is not what you want use the following example TMPR2C equ PREGO equ qe FRAMEO1 extrat
62. in the compiler invocation or in a pragma preprocessor directive preceding the first line of data definition or executable source text To override a diagnostic level set in a pragma preprocessor directive specify a different diagnostic level in the compiler invocation Messages see Chapter 9 print Compiler Controls 4 21 divmodopt Function Enables generation of efficient DIV instruction Select the EDE C Compiler Options Project Options menu item Enable or disable the Generat fficient DIV instruction and don t care about overflow check box in the Optimization tab ess divmodopt nodivmodopt Abbreviation dm nodm Class Primary control Default nodivmodopt Description Use the divmodopt control to enable generatation of an efficient DIV instruction even if there are chances for overflow Normally the run time routine DIVL does a better job in case of overflow but the code is less efficient If you do not care about the overflow you can now generate the instruction with the divmodopt control 4 22 Chapter 4 eject Function Inserts a form feed into the print file Syntax eject Abbreviation ej Class Primary control Description Use this control to insert a form feed into the print file You can only specify the eject control in a pragma directive The page breaks after the control line and the compiler generates a header at the top of the page This
63. is the initialization code for the digital signal filter rd fX id BRR ok ck ek kk kk kk kk ke IR ke kk kk kk kk kk ke IORI kk kk kk kk kk ko IO kk kk koe kk kk kk kk kk kk kk f pragma model kb Select instruction set for the 80C196KB processor pragma interrupt software timer 5 pragma interrupt analog_conversion_done 1 line 1 c c196 kb sfrs h kb sfrs h kp sfrs h declarations for 80C196 SFRs a superset of ud 8096 registers and 80C196 specific library m function declarations AU extern volatile register unsigned short r0 at 0x00 r extern volatile register unsigned char ad command at 0x02 w register unsigned char ad_result_lo at 0x02 r register unsigned char ad result hi at 0x03 r extern volatil extern volatil extern volatile register unsigned char hsi_mode at 0x03 w extern volatil register unsigned short hso_time at 0x04 w extern volatile register unsigned short hsi_time at 0x04 r extern volatile register unsigned char hso_command at 0x06 w extern volatile register unsigned char hsi_status at 0x06 r extern volatil register unsigned char sbuf at 0x07 r w register unsigned char int mask at 0x08 r w register unsigned char int pending at 0x09 r w extern volatil extern volatil D 00000000000 00000 00000000 0 extern volatile register unsigned char watchdog at Ox0a w extern volati
64. is useful for noticing program variations such as those that result from changing optimization levels The assembler cannot assemble the pseudo assembly language listing because it is not a complete program The generated pseudo assembly language lacks the proper assembly directives to define the module and the variables used inside the program This listing contains a location counter a source line number and the equivalent assembly code The location counter is a hexadecimal value that represents an offset address relative to the start of the object code Use the no code control to generate or suppress the pseudo assembly listing 3 22 C196 001F 001F 0022 0024 0024 0026 Figure 5 7 Print file pseudo assembly listing Compiler Chapter 3 CTYPE 01 29 99 14 26 30 Page 4 Assembly Listing of Object Code cseg Statement 4 upcx C800 R push OVRBASE B3180400 R ldb input 4 SP H Statement 5 ACOO1C R ldbze Tmp0 input 8980001C cmp TmpO 80H DB10 be 0002 996100 R cmpb input 61H D30B bne 0002 996600 R cmpb input 66H D906 bh 0002 P Statement 6 5920001C R subb Tmp0 input 20H 2005 br 0001 H Statement 7 80002 Statement 8 B0001C R ldb Tmp0 input 2000 br 0001 Statement 9 80001 ccoo R pop OVRBASE FO ret Function Statistics for upcx i Code Size 39 Parameter Count T Stack Size 0 Parameter Size 2 OReg Size 1 Stack Depth i 2 end 3 4 2 8 COMPILATION SUMMARY The final line o
65. language x3 159 1989 and also supports applications that use features specific to 80C196 architecture qe See Chapter 10 for more information on language implementation 2 2 CUSTOMER SUPPORT The 80C196 software is under warranty During the warranty period you are entitled to the following e Free replacement of any defective media upon notification in writing of the defect and product information Telephone consultation and bug reporting e Our best efforts to replace or repair any software that does not meet the specification described in the 80C196 documentation 2 6 Chapter 2 TASKING offers various support contracts that provide benefits as free product updates reduced rate upgrades and telephone support Contact your local TASKING sales representative for information about support contracts and standard warranties You will find the addresses and telephone numbers in the Read This First Envelop included with this package 2 2 1 IF YOU HAVE A PROBLEM USING THE SOFTWARE To help expedite your calls please have the following information available when you contact us for help The serial number of your software distribution This number is printed on the label of the tape cassette or first floppy of your software distribution In addition you may be able to obtain the serial number by running C196 with option V you may wish to record the serial number here Product Serial The product na
66. may be so qualified Remove or relocate the near qualifier nesting too deep One of the nesting limits described in Chapter 10 has been exceeded 9 24 Chapter 9 newline in string or cbar constant The new line character can appear in a string or character constant only when it is preceded by a backslash X For example the following line generates this error printf Hello no body for static function function name The function_name function is declared as a static function and is called but is not defined in the module no more room for macro body Argument substitution in the macro has increased the number of characters to more than maximum allowed non addressable operand The amp operator is used illegally such as to take the address of a register or of an expression non constant case expression The expression in a case is not a constant nothing declared A data type without an associated object or function name is specified number of arguments does not match number of parameters The number of arguments specified for the macro expansion does not match the number of arguments specified in the macro definition operand stack overflow operand stack underflow An illegal constant expression exists in a preprocessor directive line operand too large Constant specified in shift count dcb operand bit count etc is too large operator not allowed on pointer An operand is a pointer and the
67. model is 24 bit The library files are listed in Table 8 1 Lib Library Code Data Const Segment Code Remarks Directories Model Addressing Addressing nt c cstart obj note 16 bit HighCode 16 bit Compatibility np_c c96 lib Mode c96fp lib fpal96 lib nt_e cstart obj note 16 bit FarCode 24 bit Extended np_e c96 lib Mode c96fp lib fpal96 lib nt cnf cstart obj note 16 24 bit HighCode 16 bit Compatibility np cnf c96 lib Mode c96fp lib fpal96 lib nt ent cstart obj note 16 24 bit FarCode 24 bit Extended np_enf c96 lib Mode c96fp lib fpal96 lib nt cf cstart obj note 24 bit HighCode 16 bit Compatibility np cf c96 lib Mode c96fp lib nt ef cstart obj note 24 bit FarCode 24 bit Extended np_ef c96 lib Mode c96fp lib all other cstart obj Any 16 bit Code 16 bit c96 lib c96fp lib fpal96 lib 1 nt libraries are used by the models NT CB EA and EC np libraries are used by the models NP and NU Table 8 1 Library Object Files The objects and libraries in the subdirectories nt_c and np_c of the lib directory are suitable only for use with the 80C196NT CB EA EC or 80C196NP NU respecively running code compiled with the nearcode control in effect They use only near code linkage but all data pointers are 16 bits wide Libraries 8 5 The objects and libraries in the subdirectory nt e and np e of the lib directory are suitable only for use with the 80C196NT CB EA EC
68. non standard data types are defined in the module Remove unused definitions or break down the module whiles fors etc too deeply nested The statement nesting structure of the module exhausted an internal structure in the compiler A possible solution is to make a function out of the more deeply nested control structures and call that function 9 12 Chapter 9 i 9 4 ERROR MESSAGES Error messages have the following syntax Error at line nn of filename message where filename is the name of the primary source file or include file in which the error occurred nn is the source line number where the error is detected message isthe explanation Following is an alphabetic list of error messages operator missing macro argument operand The operator must be followed by a macro argument operator occurs at beginning or end of macro body The 4 token concatenation operator is used to paste together adjacent preprocessing tokens so it cannot be used at the beginning or end of a macro body address out of range The constant expression used as the absolute address is greater than OxFFFF OxFFFFFF for a 24 bit model This error can only occur if you are dereferencing a constant expression for example the following code generates the error char 0x10000 5 0x10000 is OxFFFF anonymous parameter An argument in a function definition is prototyped but not named argument
69. of the register file Use the Window Select Register WSR to switch between windows The C196 compiler uses the additional registers for the block scope and static register variables allocated in overlay segments Block scope variables are variables declared within non reentrant functions Figure 6 3 shows the register allocation scheme that the linker uses to locate register and overlay segments on the 80C196KC processors There are two distinct methods provided by the compiler for using vertical windows one using the windows control and one using windowed parameters 1FFH x Overlay Segments OFFH Mapped Window 80H COH EOH X Window Base Register Segments 1AH V OSD1053 Figure 6 3 80C196KC register allocation scheme 6 12 Chapter 6 i 6 4 3 1 USING THE WINDOWS CONTROL To read or write to the local register variables the C196 compiler generates the WSR management code in the prolog and epilog of all public functions compiled with the windows control except for functions that do not contain local register variables do not access static variables and do not call another function The windows control must be in effect in order for the WSR management code to be generated If your application is using the HOLD HOLDA protocol along with vertical windowing specify the windows control with the hold parameter Specifying windows without any parameter is equivalent to specifying windows hold The compiler
70. of these controls once in the compiler invocation Do not use these controls in a pragma preprocessor directive qo translate Compiler Controls 4 85 print Function Generates or suppresses the print file Select the EDE C Compiler Options Project Options menu item Enable or disable the Generate a listing file lst check box in the Listing tab ess print filename noprint where filename is the file including a device name and directory name or pathname if necessary in which the compiler places the print information Abbreviation pr Class Primary control Default print Description Use this control to produce a text file of information about the source and object code The print file is not the same as the preprint file By default the compiler places the print file in the directory containing the source file If you do not provide a filename the compiler composes the default print filename from the source filename with the 1st extension For example the compiler creates a print file named main 1st for the source file main c The noprint control suppresses the print file The compiler then displays all diagnostic messages at the console The noprint control overrides all other listing controls Only the notranslate control can override the print control 4 86 Chapter 4 The print and noprint controls affect the entire source text You can specify either of these c
71. operator requires non pointer operands for example amp gt gt lt lt Messages and Error Recovery 9 25 operator stack overflow operator stack underflow An illegal constant expression appears in a preprocessor directive line parameter list cannot be inberited from typedef A function body was supplied for an identifier that has function type but whose type was specified with a typedef identifier as in the following example typedef void func void func f parameters can t be initialized An attempt was made to initialize the arguments in a function definition respecified storage class A storage class specifier is duplicated in a declaration respecified type A type specifier is duplicated in a declaration respecified type qualifier A type qualifier is duplicated in a declaration sizeof invalid object An implicit or explicit sizeof operation references an object with an unknown size Examples of invalid implicit sizeof operations are fp where fp is a pointer to a function or struct sigtype siga when sigtype is not yet completely defined stack segment too large The estimated or requested stack size is greater than 64 kilobytes string too long A string of over 1024 characters is being defined syntax error An error is discovered in the syntax of an assembly instruction 9 26 Chapter 9 syntax error near string A syntax error occurred in the pr
72. or features Options a Display everything A List all active licenses c license file Use the specified license file If no c option is specified Imstat looks for the environment variable LM LICENSE FILE in order to find the license file to use If that environment variable is not set Imstat looks for the file usr local flexlm licenses license dat f feature List all users of the specified feature s l regular expression List all users of the features matching the given regular expression s server Display the status of the specified server node s S daemon List all users of the specified daemon s features t timeout Specifies the amount of time in seconds Imstat waits to establish contact with the servers The default value is 10 seconds A larger value may be desirable if the daemons are being run on busy systems or a very heavily loaded network qo Imgrd 1 Flexible License Manager FLEXIm A 17 4 THE DAEMON LOG FILE The FLEXIm daemons all generate log files containing messages in the following format mm dd hh mm DAEMON name message Where mm dd hh mm Is the month day hour minute that the message was logged DAEMON name Either license daemon or the string from the DAEMON line that describes your daemon In the case where a single copy of the daemon cannot handle all of the requested licenses an optional _ followed by a number indicates th
73. pointer and the name of the variable itself Use optimization level 3 only when the compiler need not insert code to guard against aliasing The compiler performs this optimization as follows e When the code assigns an expression to a variable the compiler generates code to evaluate the expression and assign the result to the variable The result also remains in the register used in evaluating the expression e When the code subsequently uses the same alias for the variable the compiler does not generate code to gain access to the variable instead it inserts a reference to the register e The compiler refers to the same register each time the code uses the alias This use of registers improves run time performance since the processor can access the register faster than the variable stored in memory 4 76 This optimization can introduce errors when the code uses multiply aliased variables The compiler does not insert code to check for intermediate references to a variable using a different alias If the code modifies a variable using a different alias the value in the variable is not necessarily the same as the value in the register referenced by the compiler For example in the following code under optimization level 3 y erroneously acquires the value 1 instead of 2 If the optimization level is less than 3 the compiler codes the assignment correctly int x y int a amp x x 1 a 25 y Xi Ce Use t
74. print a pr Generates and names or suppresses Listing Primary noprint nopr the print file Default sourcename Ist content The noprint control overrides all listing controls except preprint pts a pt Loads a PTS vector with the address Object General of a PTS control block pts piha a Loads a piha pihab PTS vector with Object General pts pihb a the address of a PTS control block reentrant a re Specifies reentrancy or nonreentrancy Object General noreentrant a nore fora function Default reentrant regconserve a rc Controls whether non register file Object Primary noregconserve norc level and automatic variables are allocated to registers Default noregconserve registers a rg Specifies the number of bytes of Object Primary register memory available to the module Default registers 220 relocatabletemps rt Tells the compiler to produce external Object Primary norelocatabletemps nort references to temporary registers symbols Default norelocatabletemps searchinclude a si Specifies the search path for include Source General nosearchinclude nosi files Default nosearchinclude signedchar sc Causes a char to be treated as a Object Primary nosignedchar nosc signed char or an unsigned char Default signedchar Compiling and Linking Control Abbr Description and Default Effect Usage speed a sp Tells the compiler to choose between
75. pushes the rightmost argument in the function call first and the leftmost argument last Therefore the first argument in the function call occupies the lowest memory location of all the arguments on the stack The cleanup code of the calling function pops all the arguments off the processor stack after the called function returns control In the FPL PL M 96 convention the calling function pushes the leftmost argument in the function call first and the rightmost argument last Therefore the first argument in the list occupies the highest memory location of all the arguments on the stack for this function call The epilog of the called function pops all the arguments off the processor stack before returning control to the calling function Language Implementation 10 9 10 2 2 RETURNING A VALUE In both the VPL and FPL calling conventions the epilog of the called function returns a scalar value in the global double word register TMPREGO For aggregate return values TMPREGO contains a pointer to a temporary aggregate variable 10 2 3 LOCAL VARIABLES The prolog allocates space on the stack for local variables This space is commonly called a frame The FRAMEO1 variable is a relocatable word register that points to the beginning of the frame and is commonly called the frame pointer A module named FRAMO1 in the c96 1ib library defines FRAMEO1 and allocates a word register for it The pseudo assembly language listing in t
76. segment If you specify registers all the compiler uses the on chip registers only and allocates all variables in the module to register memory The registers all control is not the same as the registers 220 control The predefined macro REGISTERS has the value specified for the registers control The C196 compiler does not use the additional register space of the 80C196KC or the 80C196KR even if you compile with the registers all control The compiler only allows a module to use up to 220 bytes of register space So in order to use the additional register space you must have multiple modules and your modules must have enough register variables to occupy the additional register space The compiler then accesses the additional register space through the use of vertical windowing qo See Section 6 4 3 for additional information on vertical windows If you declare more register variables than available registers the compiler issues a diagnostic message as follows error if too many file scope registers are requested or if registers all is specified and the number of program variables is greater than the size of the register file warning if too many block scope registers are requested This error or warning condition can occur for example if you specify registers all and your module contains more than 220 register variables The registers control affects the entire object module You can specify this control
77. the Near Const radio button in the EDE CPU Model menu item E nearconst Abbreviation nk Class Primary control Default nearconst Description Use this control to place constant data in the lowest 64K of the address space of 24 bit processors This control causes the compiler to place switch table constants in the const segment of the object module as well as any user defined constant data that is not qualified with the ar keyword The generated code will use normal data addressing to access these constants When you link your program module s with RL196 you must provide sufficient ROM for the const segment somewhere within the lowest 64K of the address space The nearconst control can only be used with 24 bit models NT CNF or NT ENF qe farcode farconst fardata model nearcod neardata 4 66 Chapter 4 neardata Function Specifies that the default placement of variable data is the data segment Syntax Select the Near Data radio button in the EDE CPU Model menu item E neardata Abbreviation nd Class Primary control Default neardata Description Use this control to place non register non constant data in the lowest 64K of the address space of 24 bit processors This control causes the compiler to place in the data segment of the object module all user defined variable data that has not been assigned to registers and that you have not qualified with t
78. the compiler invocation specification takes precedence A duplicate control is a fatal error if it occurs in the compiler invocation but the preprocessor only issues a warning if it occurs in a pragma directive duplicate argument argument for control control An argument for control was specified more than once for example specifying more than one handler for one interrupt number expression too complex A complex expression exhausted an internal structure in the compiler Break the expression down into simpler components FARCODE conflicts with NEARCODE These two controls determine the segment into which all code is generated They are mutually exclusive but both controls were explicitly specified Eliminate the one you don t want Messages and Error Recovery 9 7 FARCODE control invalid for tbe component The farcode control is valid only for 24 bit models Add a 24 bit model control or remove the offending control FARDATA conflicts with NEARDATA These two controls determine the default location of non constant non register data They are are mutually exclusive but both controls were explicitly specified Eliminate the one you don t want FARDATA control invalid for tbe component The fardata control is valid only for 24 bit models Add a 24 bit model control or remove the offending control function call nesting limit exceeded The nesting of function calls within an expression exceeded 32 HOLD is not effect
79. to select the 8096 61 90 to select the 8096 90 Compiler Controls 4 61 196 bh ca cb ea ec kb KC kd kl Kq to select the 80C196KB This argument to model is available for backward compatibility and is equivalent to specifying kb For future compatibility use the model kb control specification instead of model 196 to select the 8096BH to select the 80C196CA Specifying ca is equivalent to specifying kr to select the 80C196CB This argument can have an extra suffix as described in the note below to select the 80C196EA This argument can have an extra suffix as described in the note below to select the 80C196EC This argument can have an extra suffix as described in the note below to select the 80C196JQ Specifying jq is equivalent to specifying kr to select the 80C196JR Specifying jr is equivalent to specifying kr to select the 80C196JS Specifying js is equivalent to specifying kr to select the 80C196JT Specifying jt is equivalent to specifying kr to select the 80C196JV Specifying jv is equivalent to specifying kr to select the 80C196KB Specifying kb is equivalent to specifying 196 to select the 80C196KC to select the 80C196KD to select the 80C196KL Specifying k1 is equivalent to specifying kr to select the 80C196KQ Specifying kq is equivalent to specifying kr 4 62 kr ks kt lb mc md mh np nt nu Chapt
80. usr local license opt A daemon options file consists of lines in the following format RESERVE INCLUDE EXCLUDE GROUP TIMEOUT NOLOG REPORTLOG number feature USER HOST DISPLAY GROUP name feature USER HOST DISPLAY GROUP name feature USER HOST DISPLAY GROUP name name list of users feature timeout in seconds IN OUT DENIED QUEUED file A 7 Appendix A Lines beginning with the sharp character 4 are ignored and can be used as comments For example the following options file would reserve one copy of feature SWxxxxxx xx for user pat three copies for user lee and one copy for anyone on a computer with the hostname of terry and would cause QUEUED messages to be omitted from the log file In addition user joe and group pinheads would not be allowed to use the feature SWXXXXXX XX GROUP pinheads moe larry curley RESERVE SWxxxxxx xx USER pat mn RESERVE 3 SWxxxXXXX XX USER lee RESERVE 1 SWxxxxxx xx HOST terry EXCLUDE SWxxxxxx xx USER joe EXCLUDE SWxxxxxx xx GROUP pinheads NOLOG QUEUED 2 4 LICENSE ADMINISTRATION TOOLS The following utilities are provided to facilitate license management by your system administrator In certain cases execution access to a utility is restricted to users with root privileges Complete descriptions of these utilities are provided at the end of this section Imstat License administration is simplified by the Imstat utility
81. valid with the default OMF version 3 2 If you use omf 0 or om 1 the following examples are invalid int si 1 struct const int i rnt 3 s2 13H static register int sri 1 const register int cri 1 The following code is an example of block scope initialization void foo void int ai 0 automatic object int aip ai char ach 2 ab j const long al 1 const struct int il 12 asl 1 2 struct const int ai int aj as2 2 3 static const register int cri 1 valid constant object static int si 2 invalid non const object with static storage duration cannot be initialized static register int sri 1 Language Implementation 10 17 Character string initializers within a character array are null terminated unless the array is shorter than the initializing string For example strl test value is test 0 null terminated str2 5 test value is test 0 null terminated str3 4 test value is test not null terminated The compiler produces additional register overlay data and far data segments for the initialized variables along with corresponding const segments which provide the initial values In addition to the new segments the compiler also produces table entries that the linker then combines to build an initialization table in the final absolute module At startup reset
82. value can never be less than zero Here is the generated body of main S Statement 10 0009 EFOOOO E call uns func 7 Statement 12 000C EF0000 E call uns_func 000F 0100 R clr i 4 74 Chapter 4 i Optimizing Sbort Jumps and Moves at All Levels The compiler saves space in the object code by using shorter forms for identical machine instructions Reducing Operator Strengtb at All Levels The compiler substitutes quick operations for slower ones such as shifting left by one instead of multiplying by 2 The substituted instruction requires less space and executes faster Eliminating Common Subexpressions at Levels 1 2 and 5 If an expression reappears in the same basic block of source text the compiler generates object code to reuse rather than recompute the value of the expression The generated code saves the intermediate results during expression evaluation in registers and on the stack for later use The compiler also recognizes commutative forms of subexpressions For example in the following block of code the compiler generates code to compute the value of c d 3 for the first expression and to save and retrieve it for the second expression a b c d 3 c e d c 3 Eliminating Superfluous Brancbes at Levels 2 and 5 The compiler combines consecutive or multiple branches into a single branch Reusing Duplicate Code at Levels 2 and 5 Duplicate code can be identical code at the ends of two converging path
83. void ptsdst unsigned char ptsblock int 8 unused BTran ptscb A D Mode PTS Control Block a typedef struct AD ptscb t unsigned char ptscount struct unsigned int constl 3 updt 1 const2 ly mode 3 ptscon unsigned int s_d unsigned int reg int 16 unused AD ptscb HSI Mode PTS Control Block xf typedef struct HSI ptscb t unsigned char ptscount struct unsigned int constl 3 updt T const2 15 mode 3 ptscon unsigned int 16 unsigned int ptsdst unsigned char ptsblock int 8 unused HSI ptscb Figure 5 15 Digital signal filter preprint file continued Compiling and Linking 3 37 HSO Mode PTS Control Block is typedef struct HSO ptscb t unsigned char ptscount struct unsigned int constl updt const2 LO P pP WwW mode ptscon unsigned int ptssrc unsigned int 16 unsigned char ptsblock int 8 unused HSO ptscb PTS A D Table is typedef struct AD tab t unsigned char AD command unsigned int AD result AD tab PTS HSI Table typedef struct HSI tab t unsigned char HSI status lo unsigned char HSI status hi unsigned int HSI time HSI tab PTS HSO Table v typedef struct HSO tab t unsigned char HSO command unsigned int HSO time HSO tab BRR kk ok kk Ck kk ek Ck kk ke IIR e e e k e e e k e ke k ke k ko kk kk ke kk kk kk ko k k ke kk kk ke kk A ke kk kk kkk f f k Ad
84. 0C196NP 80C196NT 80C196NU 80C196MC 80C196MD and more multiply aliased Having more than one name Not a Number Value in floating point format that does not represent any real number null terminated string Character string ending with a null 0 value B 6 Appendix B OH196 80C196 object code to hexadecimal conversion utility old style Function declaration format that is not a prototype that is with the parameter data types not specified in the function declaration s parameter list overlaying registers Allocating the same registers to more than one function padding User defined gaps parameter Variable defined in a function or macro to receive an argument peephole optimization Compiler process that examines generated code and attempts to combine or eliminate instruction sequences to reduce overall code size portable Not dependent on the target environment powerdown mode Power saving processor mode in which RAM is preserved but all other features are disabled or turned off primary source file Source text file named in the compiler invocation outside of any control as the file to be compiled program modules Separately compiled sections of an application program prolog Code in the called function that the processor executes first when control has transferred from the calling function PROM Programmable read only memory promoting Casting a data type to a longer data type pseudo ass
85. 10 9 34 Data types 6 6 Examples 6 7 6 9 Header files 8 9 Interrupt 10 12 Keyword 6 3 Locations 6 3 Memory 4 94 Optimization 6 7 Overlaying 3 22 4 90 6 7 PLMREG 6 3 6 6 Index 14 x Reentrancy 4 90 6 8 10 12 Scope 4 95 Special function registers 6 5 Variables 4 23 4 92 6 3 6 5 6 6 6 7 8 9 Register allocation 4 36 4 123 Overlay segment 4 56 4 123 6 11 Register segment 4 30 4 123 6 11 Register memory 6 3 Register segments 6 13 register storage class 4 23 registers control 4 94 6 7 6 13 10 7 relocatabletemps control 4 97 Remainder operator 10 19 Remarks 4 19 9 36 Return values 10 9 Returning values 6 6 Reverse branch optimization 4 75 RL196 Example 10 10 10 12 Examples 3 25 Link maps 4 14 Map file 10 9 10 10 10 12 Type checking 4 14 RL196 linker and locator 2 5 3 25 S sample session 2 7 Scalars Alignment 10 5 10 6 Argument 10 6 Data types 10 3 10 4 Examples 10 6 Return values 10 9 scanf function 8 25 Scope Include files 4 38 Initialization 9 13 Macros 4 16 4 38 Register variables 4 23 4 92 Index Variables 6 7 scripts 3 25 Search path 4 99 searchinclude control 4 99 Setting the environment UNIX 1 9 Windows 1 4 Setup 10 7 signedchar control 4 102 Software development Compiling source file 2 4 Creating source text 2 4 Debugging code 2 4 Software development process 2 3 ASM196 assembler 2 3 C196 compiler 2
86. 17 3 4 2 3 Compilation Heading s sees 3 18 3 4 2 4 Source Text Listing RR R E ees 3 18 3 4 2 5 Remarks Warnings and Errors 000 3 20 VI Table of Contents 3 4 2 6 Symbol Table and Cross reference 0 00 3 20 3 4 2 7 Pseudo assembly Listing ssssssseeessss 3 21 3 4 2 8 Compilation Summary oo seiis erie a sese 3 22 3 4 3 Object File piira etae eet eee dle Crane d ele 3 25 3 5 Automatically Invoking the C196 Compiler 3 24 3 5 1 Using Make Utility mk196 sss 3 24 3 5 2 Using Batch Files poe canes mine maa aiie aaa 3 24 3 5 9 Using UNIX Scripts 2 0 ce Hn 9 25 3 6 Developing a C196 Application Program 3 25 3 7 Combining Different OMF96 Formats 3 28 3 7 1 Global Initialization 0 2 eee 3 28 3 7 2 OMF96 Version 3 0 Limitations sss 3 29 3 8 Examples csadcceniiceavd echt CR TEA bead eens 3 29 3 8 1 Source lextaxcs sey exa wes eERT EN PER YR 3 29 3 8 2 Setting the Windows Environment 3 32 3 8 3 PreproOCESSIDIB o oorp 149 are OTRA R acho DR 5 32 3 8 4 Checking Syntax and Semantics 00005 3 39 3 8 5 Symbolic Debugging y esist ent upet sees pe KENS 3 41 3 8 6 OPC ZI ryan EEE a N es 3 43 COMPILER CONTROLS 4 1 STARTUP CODE 5 1 5 1 Contents of cstarLa96 lt isses 5 3 5 2 Contents of main C aegagi T ra TEE s 5 4 5 3 Writing Your Own Startup Code 5 5 5 5 4 Writing
87. 1ist control as follows pragma list The following lines are listed int f1 int f return f Compiling and Linking 3 5 pragma nolist The following lines are not listed long 2 long i return i Invocation only You can specify this type of control as often as necessary in the invocation An invocation only control applies to the entire module or to the arguments of the control Each specification of an invocation only control adds to or overrides previous specifications of the control An example of an invocation only control is the define control which defines a macro To save effort you can put any controls that you use in the compiler invocation into a file named c96init h The compiler automatically includes this file before the primary source file and before any include file specified in the invocation See the Software Installation chapter under environment variables for more information on the c96init h file Table 3 1 lists the controls with descriptions defaults precedences effects and usage classes Some controls optionally use one or more arguments indicated by a where a represents the argument list Some controls require one or more arguments also indicated by a Case is not significant in the controls but can be significant in arguments to the controls Certain controls override other controls even if you explicitly state the overridden controls Table 3 1 summar
88. 2 varl addr regvar1 pragma winl_64 varl addr regvar1 where vari is a valid symbol name addr is a valid absolute address regvari is a valid register symbol name Abbreviation v3 v6 Class General control Description Use this pragma control to locate one or more register symbols to absolute addresses and mark them as overlayable Use this control only if WSRI is present in the selected processor otherwise use the win32 win64 or win128 control The winl 32 and win1_64 control must follow the declaration of the symbols For example the following pragma control line locates varl to address 220H and regvar1 at address 060H int varl register int regvarl pragma winl 64 varl1 20x220 regvarl qo locate overlay windows 4 120 Chapter 4 win32 win64 win128 Function Combination of a pragma 1ocate and pragma overlay Syntax pragma pragma pragma where varl addr regvarl Abbreviation WwW Ww Ww in32 vari addr regvarl in64 vari addr regvarl in128 varl addr regvar1 is a valid symbol name is a valid absolute address is a valid register symbol name w3 w6 wl Class General control Description Use this pragma control to locate one or more register symbols to absolute addresses and mark them as overlayable This control must follow the declaration of the symbols For example the following pragma control line locates varl to address 220H and regvar1 at
89. 3 LIB196 library manager 2 3 OH196 converter 2 3 PL M 96 compiler 2 3 RL196 linker 2 3 Source processing controls 3 3 Source text FILE macro 3 15 Conditional compilation 3 15 4 12 4 51 Diagnostics 4 55 Include files 5 15 4 38 4 55 Macro definition 4 16 Macros expanded 4 55 Preprint file 5 15 3 15 Preprocessor directives 3 13 Primary source file 4 38 Print file 35 16 4 12 4 38 4 51 4 53 4 55 4 59 Scope 4 38 Source text listing Line numbers 3 18 Special function registers SFRs 6 3 _SFR_H_ macro 3 15 Accessing 6 5 Header files 6 5 8 9 sprintf function 8 23 Square brackets 4 3 Index Index 15 sscanf function 8 25 Stack Allocation 10 8 Arguments 10 6 Calling convention 10 8 Example 10 10 Local variables 10 9 10 10 Variable allocation 4 93 Stack allocation 10 8 Stack frame 10 9 Stack pointer 6 3 Stack size 10 13 Startup code 5 1 5 3 8 3 Writing your own 5 5 static storage class 4 23 Status word 8 20 Storage classes 6 7 reg 6 15 string h header file 8 13 Strings Conversion 8 13 8 15 8 27 Floating point 8 23 8 25 Initialization 10 15 Representation 8 15 8 27 strlen function 8 27 Structures 6 15 Suffix rules 3 10 Suppressing keywords 4 17 switch statement 10 22 switch statements 1 Symbol table 3 17 3 20 4 113 4 126 Examples 3 20 Generation 4 105 Symbolic information 3 17 Controls 3 20 Cross reference 4 105 4 126 Exam
90. 3 29 asm ld wreg a 5 Loads the fifth element of a into wreg 7 6 Chapter 7 7 7 3 CONSTANT TABLE DECLARATION When building word aligned tables using the dcw directive you must ensure that any label to be associated with the start of the table is also aligned To do this precede the label with a dew directive as shown below asm dcw 0 force word alignment tbi asm dcw lbl1 asm dcw 1b12 asm dcw 1b13 If you omit the dcw directive preceding the tb1 label the compiler assigns the label to the current location counter value which might not be word aligned The dew directive following tbl forces the location counter to a word boundary possibly incrementing the location counter Thus a one byte gap can be placed between the tb1 label and the word constant Placing the dcw on the same line as the label does not alleviate this problem because the compiler processes the label separately from any in line assembly instructions See example 2 in Section 7 6 for an application of this process 7 4 ASSEMBLY INSTRUCTIONS The following assembly instructions are supported by the C196 compiler Arithmetic Logical and Memory Transfer Instructions add eldb pop addb est push addc estb st addcb ld stb and ldb sub andb ldbse subb cmp ldbze subc cmpb mul subcb div mulb xch divb mulu xchb divu mulub xor divub or xorb eld orb Assembly Code Instructions 7 7 Special Register Instruct
91. 4 117 Fixed parameter list 4 32 4 33 fixedparams control 2 5 4 32 FPL 4 32 Function names 10 14 Interrupt function 4 31 4 32 4 43 4 44 4 49 10 13 Keywords 4 32 PL M 96 4 32 Processor differences 4 43 4 44 Reentrancy 4 32 4 90 4 115 6 8 Registers 4 90 6 8 Variable parameter list 4 32 4 33 4 115 VPL 4 115 case control 4 6 Case sensitivity 4 6 ccb control 4 8 char data type See also Cbaracter bandling _SIGNEDCHAR_ macro 4 102 signedchar control 4 102 Character handling SIGNEDCHAR macro 3 15 Constants 9 15 9 26 10 4 Header file 8 10 Characters 10 14 Chip Configuration Byte 4 8 Initializing 4 8 Cleanup 10 7 10 8 code control 3 21 4 10 Index Index 5 Code listing 3 17 3 21 4 10 Controls 4 10 Code optimization 3 43 Comment lines 7 3 Common subexpression optimization 4 74 Compatibility ANSI 10 3 ASM196 10 9 C196 language implementation 10 3 Calling convention 10 7 Data types 10 3 Implementation dependent features 10 14 PL M 96 4 32 10 8 Processors 4 43 4 60 10 12 10 13 Stack size calculation 10 13 Stack use 10 9 Versions of C196 4 24 4 60 4 90 4 91 4 92 Compiler limitation 10 22 Completion message 9 3 Controls 4 19 Diagnostics 4 19 cond control 4 12 Conditional compilation 3 15 Controls 4 12 Limits 10 22 Preprint file 3 13 Print file 4 51 Print file content 4 12 Console Diagnostics 4 20 Constant folding optimization
92. 6 nozero control 4 128 np start a96 5 4 nt start a96 5 4 null attribute 6 6 Oo Object code Controls 4 71 Optimization 4 71 object control 4 67 Object file 3 11 Content controls 3 4 Controls 4 67 Creation 4 67 Filename 4 67 Object module Compilation summary 3 22 Size 3 22 OH196 converter 2 5 oldobject control 4 69 omf OMF96 VERSION macro 3 14 omf control 3 28 4 70 4 104 OMF96 combining formats 3 28 global initialization 3 28 version 3 0 limitations 3 29 Operator strength optimization 4 74 Optimization OPTIMIZE macro 3 14 4 71 Aliasing 4 75 Alignment 10 6 Branch conditions 4 74 Calling convention 6 8 Common subexpressions 4 74 Constant expressions 4 72 Controls 4 71 Debugging 4 15 4 71 Duplicate code 4 74 Examples 4 74 4 75 10 6 Memory 10 6 Operator strength 4 74 Reentrancy 6 8 Registers 0 3 0 7 Short jumps and moves 4 74 Summary 4 72 Superfluous branches 4 74 Unreachable code 4 74 Variables 4 75 optimize control 3 43 4 71 Overlapping ROM and RAM memory 4 41 overlay 4 77 Index 12 x Overlay segments 4 96 6 13 10 7 Alignment 4 96 10 7 Size 10 7 Overlaying registers 6 7 Reentrancy 6 8 Overriding controls 3 4 3 5 overview 2 1 P Page break Inserting 4 22 Page header 3 17 Page number 3 17 pagelength control 4 79 pagewidth control 4 81 Parameter passing 10 8 PATH 1 4 1 9 Path prefixes 4 99 Peephole optimization B 6
93. 6 program without requiring a separately written and translated assembly language routine 7 1 IN LINE ASSEMBLY CODE SYNTAX An additional reserved word asm is provided to identify in line assembly instructions To insert an in line assembly statement begin the statement with the asm keyword and terminate the statement with a semicolon To indicate a block of statements insert an open curly brace 1 after the asm keyword and a close curly brace after the last statement The syntax is as follows asm pseudo asm inst Single line Or asm In line assembly block pseudo asm inst Where asm is the keyword indicating an assembly instruction follows pseudo asm inst is assembly instruction followed by a semicolon You can place an in line assembly statement anywhere a valid C statement can be placed C style comments can be included as desired enclosed with a slash asterisk and an asterisk slash Assembler style comments beginning with a semicolon are not allowed The extend control must be in effect in order to use the in line assembly feature The control allows the compiler to recognize the asm keyword and the in line assembly instruction following it 7 4 Chapter 7 i 7 2 PSEUDO ASSEMBLY INSTRUCTION INTERPRETATION The pseudo assembly instruction statement follows the same format as any regular ASM196 instruction The syntax is operation operand Where operati
94. AND CROSS REFERENCE The symbol table lists all objects and their attributes from the compiled code The table includes the name type size and address of each object The table can optionally include source text cross reference information The compiler generates the table in alphabetical order by identifier A source module may declare a particular identifier more than once but each object even if named by a duplicate identifier appears as a separate entry in the symbol table The symbol table shown in Figure 3 6 contains cross reference information in the ATTRIBUTES column The cross reference numbers for each symbol are line numbers containing references to the symbol The line number marked with an asterisk declares the symbol Use the no symbols control to generate or suppress the symbol table Use the xref control to add cross reference information to the symbol table Compiling and Linking 3 21 C196 Compiler CTYPE 01 29 99 14 26 30 Page 3 Symbol Table Name Size Class Address Attributes input 1 Auto 0 overlayable register unsigned char in function upcx 3 5b 5 5 6 8 upcx Public reentrant VPL function returning unsigned char 3 Figure 5 6 Print file cross referenced symbol table 3 4 2 7 PSEUDO ASSEMBLY LISTING The pseudo assembly listing shown in Figure 3 7 is an assembly language equivalent to the object code produced in compilation The listing shows the object code produced by the compiler and
95. GISTERS 3 14 4 94 SFR H 3 15 4 63 8 9 SIGNEDCHAR 3 15 4 102 Examples 8 10 8 11 Function like 8 11 Header files 8 11 Library functions 8 7 8 10 8 11 Scope 4 58 Make Utility mk196 3 24 makefile automatic creation of 2 13 updating 2 15 Messages 9 1 Diagnostics 9 1 Error 9 12 Fatal error 9 5 Remarks 9 36 Sign off 9 3 Signon 9 3 Warning 9 28 mixedsource control 4 59 model 24 bit 10 20 model control 4 5 4 60 Move optimization 4 74 near 10 20 nearcode 4 64 10 21 nearconst 4 65 neardata 4 66 10 21 noabszero control 4 4 nocase control 4 6 nocode control 4 10 Index Index 11 nocond control 4 12 nodebug control 4 14 noextend control 4 23 noextratmp control 4 26 nofastinterrupt control 4 31 nogeneratevectors control 4 35 nohold 4 36 nohold control 6 12 6 15 noinit control 4 40 noinst control 1 nolist control 4 51 nolistexpand control 4 53 nolistinclude control 4 55 nomixedsource control 4 59 Non register variables 4 92 nonreentrant keyword 4 23 4 24 4 90 4 91 6 8 noobject control 3 23 4 67 noprint control 3 16 4 85 noreentrant control 4 90 noregconserve control 4 92 norelocatabletemps control 4 97 nosearchinclude control 4 99 nosignedchar control 4 102 nosymbols control 4 105 notranslate control 3 13 3 23 4 112 notype control 4 113 nowarning true false control 4 118 nowindows 4 123 noxref control 4 12
96. IX systems it is case sensitive Extension Description C C file c is preferred no extension is forced or assumed by c96 the compiler h Include files for C h is preferred the compiler does not look h96 for h96 by itself a96 Assembly source files mk196 uses a96 asm SIC inc Include file for assembly cmd Command file for asm196 or c196 obj OMFS996 object file produced by c196 or asm196 Compiling and Linking Extension Description st LIST files from c196 or asm196 Ink Linker command control file out File containing linked object with unresolved externals abs File containing absolute object of application no remaining unresolved externals m96 MAP file mak For Makefiles other than Makefile or makefile hex Hexadecimal output file by oh196 Table 3 2 Filename extensions Programmers who at present work on MS DOS but are thinking of future migration to other platforms UNIX Windows NT etc are advised to use lower case characters and forward slashes where possible This will smoothen the future transition and it will not hurt right now All the tools are able to find files if forward slashes are used Note however that MS DOS still does not like you to say c c196 bin c196 3 4 OUTPUT FILES The compiler creates and deletes temporary work files during the compilation process and can produce an objec
97. NSI functions cstr converts a length prefixed string to a null terminated string udistr converts a null terminated string to a length prefixed string 8 14 Chapter 8 i 8 3 FUNCTIONS This section provides descriptions of the C196 library functions that are not covered in C A Reference Manual Each entry in this section is organized as follows Function contains a short description of the function Prototype Declaration lists the prototype provided in the header file Header File indicates which header file contains the prototypes macros and type definitions relevant to the function Description explains the operation and use of the function Returns describes the values returned by the function on successful completion or where relevant on error Libraries 8 15 cstr Function Converts a UDI string to a C type string Prototype Declaration char cstr char c_ptr const char udi_ptr where c_ptr points to a buffer large enough to contain the converted string udi ptr points to a length prefixed string Header File string h Description Use this function to convert the length prefixed string UDI string to a null terminated string C type string The c ptr argument must point to a buffer large enough to contain the C type string The length of a C type string is one byte more than the number of characters in the string The two pointer arguments normally point to separate string buffers
98. OK The Project dialog box appears Overview 2 13 3 is Add all source files and any other files you want associated with your application by locating the appropriate directory and selecting the files and clicking the Add button When all the files you want associated with your application appear in the Project Files field click OK If you do not have any source files yet close the Project dialog and create the source files You can create a new file by selecting File New Write your source code and select File Save As to save your source code Select Project Properties from the menu and select the tab Files Now go back to step 3 The new project is now open Click Project Load Files to open files you want on your EDE desktop EDE automatically creates a makefile for the project EDE updates the makefile every time you modify your project 2 3 2 USING THE MAKEFILE The subdirectories in the examples directory each contain a makefile which can be processed by mk196 The examples directory contains a readme txt file with a short description of each example To build an example follow the steps below This procedure is outlined as a guide for you to build your own executables for debugging Make the subdirectory ea examp of the examples directory the current working directory This directory contains a makefile for building the LED light example It uses the default mk196 rules Be sure that the di
99. The four sections of code for a function call 10 8 Chapter 10 The C196 compiler supports two calling conventions fixed parameter list FPL and variable parameter list VPL The object code for the calling function and for the called function must use the same convention otherwise incorrect execution can occur The C196 compiler uses VPL as its default calling convention To specify FPL for a function you can use either the fixedparams control or the alien keyword Use FPL for external functions defined in a PL M 96 module 10 2 1 PASSING ARGUMENTS The calling convention determines the order in which arguments occupy the stack In both VPL and FPL the setup code of the calling function pushes all arguments onto the stack using pass by value Each argument on the processor stack occupies a multiple of two bytes and is pushed from the higher address to the lower address If the size of the argument is less than two bytes the compiler zero extends or sign extends to two bytes depending on the data type of the argument The compiler allocates space on the stack as follows e A floating point value occupies two words 32 bits e A non floating point 32 bit scalar value occupies two words e A 16 bit scalar value occupies one word e An aggregate value occupies the same number and sequence of words on the stack that it does in memory extended to the next higher whole word if necessary In the VPL convention the calling function
100. Your Own main Routine 5 6 PROCESSOR REGISTERS 6 1 6 1 Register Memory see 6 3 6 2 Accessing Special Function Registers 6 5 6 3 IMPREGO picid sce AR Sian ep eh Rev a HEAR Rr 6 6 Table of Contents VII 6 4 Register Variables ceret p ERE EX Rh 6 6 6 4 1 Using the extend Control xag a eR KR R 6 7 6 4 2 Allocating and Overlaying Registers isses 6 7 6 4 3 Support for Vertical Windows ss esses 6 10 6 4 3 1 Using The windows Control 6 12 6 4 3 2 Using Windowed Parameters 0 0 0000005 6 15 ASSEMBLY CODE INSTRUCTIONS 7 1 7 1 In line Assembly Code Syntax 000 00 7 3 7 2 Pseudo assembly Instruction Interpretation 7 4 7 3 Constant Table Declaration susie 9 E 0 0 T 0 E 7 9 7 6 7 4 Assembly Instructions 00000 eee 7 6 TO Unsupported Instructions 0 0 0 cece 7 8 7 6 Examples ede ticae e oe E nde c re dns 7 9 LIBRARIES 8 1 8 1 Library Files a ad XR Perte ee b 8 3 8 1 1 Library Differences and Header File Correlations 8 4 8 1 2 Linking Library Files suetan baes eee 8 6 8 2 Header Files creer a leak Fae A dE RH 8 7 8 3 FUNCHODS 4 0464 ong Menke Keen eG ORE Dex ye esf 8 14 8 4 Dynamic Memory Allocation 0 00 eee eee 8 28 MESSAGES AND ERROR RECOVERY 9 1 91 TAtrodUCHOR PP 9 9 9 2 Sign on and Sign off Messages 0 00 00 eee 9 3 9 3 Fatal Error Messages sees 9 5 9 4 Error Messages uses Rege EGRE E Rape Ups 9
101. a few new keywords extensions to the language into the declarations of certain structures and into the function declarations in which a pointer to one of these structures is passed The compiler will then handle the setup and restoration of the vertical windowing register s The storage class keywords used in the structure declarations assure proper placement of the structures for use with this feature and the qualifier keywords used in the formal parameter lists of functions activate the special handling of these parameters pointers to these structures To specify the area s of memory from which to allocate windowed variables use the windowram control abbreviation wr Any number of ranges can be specified and the windowram control and or pragma may be specified any number of times The ranges specified must not overlap and must be within the range of mappable memory for the selected model When the compiler allocates an object from these ranges it first tries to select an area from the beginning of a properly aligned range If it cannot find a properly aligned range it will take an area from within the first range with enough space remaining Use the hold or nohold control to specify whether the windowing code needs to preserve the HOLD HOLDA bit in the WSR You can use the reg storage class keyword in variable declarations to indicate that the object should be allocated from the memory identified by a windowram range 6 16
102. ad write and execute permissions in the installation directory Otherwise login as root Step 2 If you are a first time user decide where you want to install the product By default it will be installed in usr local Step 3 For CD ROM install insert the CD ROM into the CD ROM drive Mount the CD ROM on a directory for example cdrom Be sure to use a ISO 9660 file system with Rock Ridge extensions enabled See the manual page for mount on your UNIX platform for details Or For tape install insert the tape into the tape unit and create a directory where the contents of the tape can be copied to Consider the created directory as a temporary workspace that can be deleted after installation has succeeded For example mkdir tmp instdir Step 4 is For CD ROM install go to the directory on which the CD ROM is mounted cd cdrom For tape install copy the contents of the tape to the temporary workspace using the following commands cd tmp instdir tar xvf dev tape where tape is the name of your tape device If you have received a tape with more than one product use the non rewinding device for installing the products Software Installation 1 7 For HP tape is usually the name update src Step 5 For tape install remove the installation tape from the device Step 6 Run the installation script sh install and follow the instructions appearing on your screen First a question appears about w
103. address OEOH int varl register int regvarl pragma win64 varl 0x220 regvarl qo locate overlay windows Compiler Controls 4 121 windowram Function Specifies the area s of memory from which to allocate windowed variables Syntax Select the EDE C Compiler Options Options file menu item Enter one or more memory areas in the Specify the memory area s of windowed variables for this module field in the Code tab sss windowram startaddr endaddr where startaddr is a valid absolute address endaddr is a valid absolute address Abbreviation WI Class General control Description Use this control to specify the area s of memory from which to allocate windowed variables Any number of ranges can be specified within the parentheses and the windowram control and or pragma may be specified any number of times The ranges specified must not overlap and must be within the range of mappable memory for the selected model When the compiler allocates an object from these ranges it first tries to select an area from the beginning of a properly aligned range If it cannot find a properly aligned range it will take an area from within the first range with enough space remaining Example pragma windowram 0x100 0x17F 4 122 Chapter 4 i qe See Section 6 4 3 for more information on vertical windows and the use of the special keywords reg win and winl hold model
104. al flexlm licenses license dat If you have more than one product using the FLEXIm license manager you can specify multiple license files to the LM LICENSE FILE environment variable by separating each pathname fpatb witha setenv LM LICENSE FILE fpath lfpath If the license file is not available on these hosts you must set LM LICENSE FILE to port host where host is the host name of the system which runs the FLEXIm license manager and port is the TCP IP port number on which the license manager listens To obtain the port number look in the license file at Host for a line starting with SERVER The fourth field on this line specifies the TCP IP port number on which the license server listens For example setenv LM LICENSE FILE 7594 elliot See the Flexible License Manager FLEXIm appendix for detailed information Step 9 Logout License Manager on some hosts If your product has the FLEXIm License Manager the following two files are present c196 flexlm license dat Tasking The file License dat is a template license file for this product The file Tasking is the license daemon for TASKING products Refer to the Flexible License Manager FLEXIm appendix for detailed information regarding license management Software Installation 1 9 1 3 4 SETTING THE ENVIRONMENT UNIX and the C196 compiler recognize several environment variables that you can use to reduce the amount of typing required for a compil
105. al90 lib floating point library 8 3 Order of linkage 8 6 Library function idle 8 21 Library functions 8 14 cstr 8 15 disable 8 16 disable pts 8 17 enable 8 18 enable pls 8 19 Spinit 8 20 power_down 8 22 printf 8 23 scanf 8 25 sprintf 8 23 sscanf 8 25 udistr 8 27 Line number LINE _ macro 3 13 Linking Header files 8 7 Register use 0 7 Sequence 8 3 list control 4 51 listexpand control 4 53 listinclude control 4 55 Index 10 x Listing See Preprint file Print file Listing controls 3 4 LM LICENSE FILE 1 8 A 6 Imdown A 11 Imgrd A 12 Imhostid A 13 Imremove A 14 Imreread A 15 Imstat A 16 Local register variables 6 12 Local variables 10 9 10 10 locate control 4 57 4 87 4 89 Locating the temporary registers 4 109 Locating variables 4 57 Macro definition Controls 3 13 4 16 4 17 Examples 4 17 Function like 4 16 Limits 10 22 Object like 4 16 Preprocessor directives 3 13 4 16 4 17 Redefinition 9 18 9 34 Scope 4 16 Macro expansion Preprint file 5 15 Print file 4 51 4 53 Macro expansion control 4 53 Macros DATE 3 13 J FILE 3 13 J LINE 3 13 SIDE 3 13 __TIME_ 3 13 _16_BITS_ 3 13 24 BITS 3 13 ARCHITECTURE 3 14 4 63 C196 3 14 DEBUG 3 14 4 15 Index DIAGNOSTIC 3 14 4 20 FAR CODE 3 14 FAR CONST 3 14 FAR DATA 3 14 FUNCS H 3 14 4 63 8 8 HAS PTS 3 14 OMF96 VERSION 3 14 OPTIMIZE 3 14 4 71 RE
106. anual listed in Related Publications 8 1 LIBRARY FILES You can link your application with any of the C196 libraries as well as with any libraries that you define This section explains how to select and use the libraries and header files for your application The C196 Compiler includes the following library files c96 1ib Defines all standard functions and extensions One version present in each processor dependent subdirectory of lib c96fp lib Defines all math functions that require floating point arithmetic Examples are sin cos fabs strtod Also contains a version of printf and scanf that recognize the f g and e format One version present in each processor dependent subdirectory of lib fpal96 1ibDefines all floating point operations One version present in each processor dependent subdirectory of lib Special Function Registers SFRs are defined in the following object files in the lib directory xx sfrs obj Defines the SFRS where xx represents a processor model The C196 product also includes the following object file in each subdirectory of the 1ib directory cstart ob jDefines the startup code 8 4 Chapter 8 7 8 1 1 LIBRARY DIFFERENCES AND HEADER FILE CORRELATIONS In the subdirectory 1ib you will find subdirectories with all the libraries supplied with the C196 compiler You choose one of the library files to link library code from according to the model and the execution mode if the
107. as a problem with its lock file usually because of an attempt to run more than one copy of the daemon on a single node Locate the other daemon that is running via a ps command and kill it with kill 9 NO DAEMON line for daemon The license file does not contain a DAEMON line for daemon No license service found The TCP license service did not exist in etc services No license data for feat feature unsupported There is no feature line for feat in the license file A 22 Appendix A No features to serve A vendor daemon found no features to serve This could be caused by bad data in the license file UNSUPPORTED FEATURE request feature by user The zser has requested a feature that this vendor daemon does not support This can happen for a number of reasons the license file is bad the feature has expired or the daemon is accessing the wrong license file Unknown bost bostname The hostname specified on a SERVER line in the license file does not exist in the network database probably etc hosts Im server lost all connections This message is logged when all the connections to a server are lost This probably indicates a network problem NO DAEMON lines exiting The license daemon logs this message if there are no DAEMON lines in the license file Since there are no vendor daemons to start there is nothing to do NO DAEMON line for name A vendor daemon logs this error if it ca
108. at this message comes from a forked daemon message The text of the message The log files can be used to e Inform you when it may be necessary to update your application software licensing arrangement e Diagnose configuration problems e Diagnose daemon software errors The messages are grouped below into the above three categories with each message followed by a brief description of its meaning A 18 Appendix A 4 1 INFORMATIONAL MESSAGES Connected to node This daemon is connected to its peer on node node CONNECTED master is name The license daemons log this message when a quorum is up and everyone has selected a master DEMO mode supports only one SERVER bost An attempt was made to configure a demo version of the software for more than one server host DENIED N feature to user mm dd yy hh mm user was denied access to N licenses of feature This message may indicate a need to purchase more licenses EXITING DUE TO SIGNAL nnn EXITING with code nnn All daemons list the reason that the daemon has exited EXPIRED feature feature has passed its expiration date IN feature by user N licenses used d hh mm ss mm dd yy bb mm user has checked back in N licenses of feature at mm dd yy bb mm IN server died feature by user number licenses used ad hbh mm ss mm dd yy bh mm user has checked in N licenses by virtue of the fact that his server died License Manager server started The license
109. ata neardata interrupt registers 4 64 Chapter 4 nearcode Function Specifies that the whole application uses the compatibility addressing mode of 24 bit processors for all functions Syntax Select the Near Code radio button in the EDE CPU Model menu item mgl nearcode Abbreviation nc Class Primary control Default nearcode Description Use this control to use the compatibility addressing mode of 24 bit processors This control causes the compiler to generate 16 bit calls between modules and make all function pointers two bytes long In addition to user defined function pointers the compiler allows two bytes for switch table entries and return addresses All executable code will be placed in the highcode segment of the object module The 24 bit processors are configured by the CCB at reset One of the settings controlled by the CCB is whether to run in the extended mode or the compatibility mode Once the CCB is loaded into the chip configuration register the mode is locked and all of your code will run in the chosen mode Therefore if you use the nearcode control for one module you must use it for all modules The nearcode control can only be used with 24 bit models qo farcode farconst fardata model nearconst neardata Compiler Controls 4 65 nearconst Function Specifies that the default placement of constant data is the constant segment Syntax Select
110. ated when a variable at an inner block has the same name as a variable at an outer block In this case the inner block variable hides the other variable NEAR qualifier requires 2 bit model The near qualifier was used in a declaration but a 24 bit model control was not specified Precision lost in cast A cast expression long to pointer non 24 bit or pointer to int loses precision Messages and Error Recovery 9 37 return statement bas no expression A return statement with no return expression is encountered in a function definition which returns an expression other than void reuse of interrupt function func name for interrupt dec value The same interrupt handler had been assigned to handle another interrupt represented by dec value tag scope ends in current block A tag is defined either in a formal parameter list or at block scope and will go out of scope at the end of the block containing the definition tbe cbaracters are found in a comment A comment start delimiter occurs within a comment value overflows field The specified initial value is too large to be contained in the corresponding bit field One or more high order bits of the value have been truncated 9 38 MESSAGES Chapter 9 LANGUAGE IMPLEMENTATION al TASKING uality Development Tools Worldwide Language Implementation 10 3 This chapter describes compatibility issues regarding data types a
111. bers and diagnostic messages You must include symbolic information and line numbers to use symbolic debuggers and emulators qe See Chapter 4 for a detailed description of each compiler control Chapter 9 describes each diagnostic generated by the compiler Overview 2 5 Use RL196 to link object modules from C196 PL M 96 and ASM196 and to assign absolute addresses to a module If you are linking to an object module from PL M 96 you must ensure the calling sequence generated by the C196 compiler for the function call matches the fixed parameter list calling sequence generated by the PL M 96 translator for the called function You can declare a fixed parameter list function in either of the following ways e By using the fixedparams control or the pragma fixedparams directive e By declaring the function with the alien keyword To enable the compiler to recognize this keyword you must use the extend control Your application can also call functions from the libraries included in the C196 package or from your own library You can create your own libraries using the LIB196 utility Use LIB196 to organize frequently used 80C196 object modules into libraries Use OH196 to convert 80C196 object code into hexadecimal format for PROM programming You can use an Intel ICE in circuit emulator to debug either object module format code or hexadecimal format code The C196 implementation of C conforms to the ANSI standard for the C
112. bit models the extratmp control can be used to let the compiler use more than 8 TMPREG bytes for example when the program is too complex For 24 bit models you can also use noextratmp only recommended for nearcode neardata qo tmpreg Compiler Controls 4 27 farcode Function Specifies that the whole application uses the extended addressing mode of 24 bit processors for all functions Syntax Select the Far Code radio button in the EDE CPU Model menu item E farcode Abbreviation fc Class Primary control Default nearcode Description Use this control to use the extended addressing mode of 24 bit processors This control causes the compiler to generate extended calls between modules and make all function pointers four bytes long In addition to user defined function pointers the compiler allows four bytes for switch table entries and return addresses All executable code will be placed in the farcode segment of the object module The 24 bit processors are configured by the CCB at reset One of the settings controlled by the CCB is whether to run in the extended mode or the compatibility mode Once the CCB is loaded into the chip configuration register the mode is locked and all of your code will run in the chosen mode Therefore if you use the farcode control for one module you must use it for all modules The compiler does not generate extended calls within a module since such local
113. ble License Manager FLEXIm A 5 2 2 PROVIDING FOR UNINTERRUPTED FLEXLM OPERATION TASKING products licensed through FLEXIm contain a number of utilities for managing licenses These utilities are bundled in the form of an extra product under the name SW000098 TASKING products themselves contain two additional files for FLEXIm in a flex m subdirectory Tasking The Tasking daemon vendor daemon license dat A template license file If you have already installed FLEXIm e g as part of another product then it is not needed to install the bundled SW000098 After installing SW000098 the directory usr local flexlm will contain two subdirectories bin and licenses The exact location may differ if FLEXIm has already been installed as part of a non TASKING product but in general there will be a directory for executables such as bin That directory must contain a copy of the Tasking daemon shipped with every TASKING product It also contains the files lmgrd The FLEXlm daemon license daemon lm A group of FLEXIm license administration utilities Next to it a licenses directory must contain a file with all licenses If you did install SW000098 then the 1icenses directory will be empty In that case the license dat file from the product should be copied to the licenses directory after filling in the data from your license data sheet Be very careful not to overwrite an existing 1icense dat file because it contains valuable data Exam
114. c196 dsf c noobject listexpand listinclude xref The 1istexpand and listinclude controls expand macros and list include files respectively in the source text listing The xref control generates the cross referenced symbol table C196 Compiler DSF 01 29 99 15 14 37 Page 6 Symbol Table Name Size Class Address Attributes ad command 1 Extern register volatile unsigned char 13 17 ad_result_hi i Extern register volatile unsigned char 15 33 34 ad result lo 1 Extern register volatile unsigned char 14 34 analog_conversion_done Public interrupt function returning void 9 enable Extern VPL function returning void 193 63 hso command 1 Extern register volatile unsigned char 19 18 60 hso time 2 Extern register volatile unsigned short wi Re 19 GI input 1 Public 2 register unsigned char 23 33 35 37 40 Symbol Table int mask L Extern register volatile unsigned char 22 57 int_pending 1 Extern register volatile unsigned char 23 59 ioport0 1 Extern register volatile unsigned char 28 36 ioportl 1 Extern register volatile unsigned char 29 37 40 41 56 main Public reentrant VPL function returning void 54 software_timer Public interrupt function returning void timerl 2 Extern register volatile unsigned short 25 I9 61 word value 2 Public 0 register unsigned int 24 40 41 Figure 3 14 Digital signal filter symbol table Compiling and Linking 3 41 3 8 5 SYMBOLIC DEBUGGING You can co
115. c96 1ib fpal96 1ib to newmod out Compiling and Linking START v v Program Object Modules v nt Pri Yes Floating point Format v c96fp lib Read Floating point 1o Format c96fp lib c96 lib v Any Floating point ves Operation v fpal96 lib STOP OSD241 Figure 3 9 Choosing libraries and object files for linking 3 27 3 28 Chapter 3 7 3 7 COMBINING DIFFERENT OMF96 FORMATS As of version 5 0 you can specify three different OMF96 formats for the 196 tools See the om control on how to specify a specific OMF96 format By default our tools use the OMF96 version 3 2 format This format contains extra debugging info and support for using initialized global variables We recommend that you use this default OMF96 format You can specify the different OMF96 formats with the om control omf 2 OMF96 version 3 2 omf 1 OMF96 version 3 0 omf 0 OMF96 version 2 0 3 7 4 GLOBAL INITIALIZATION It is necessary to use OMF96 version 3 2 if you want to use global initialization However it is possible to create an abs file which is OMF 3 0 compatible but still contains global initialization This might be necessary for certain third party tools which do not yet recognize the new OMF96 format To do so you have to use the default omf 2 for both the compiler and the assembler and use om 1 for the linker The resulting abs fil
116. case of doubt specify the license file pathname with the c option when starting the license server daemon For example lmgrd c usr local flexlm licenses license dat 1 usr local flexlm licenses license log amp and set the LM LICENSE FILE environment variable to the license dat pathname mentioned with the c option of Imgrd before running any license based program including Imreread Imstat Imdown If Imgrd and the program run on different hosts transparent access to the license file is assumed in the situation described above e g NFS If this is not the case make a local copy of the license file not recommended or set LM LICENSE FILE to the form number host as described earlier If none of the above seems to apply i e Imgrd was already running and LM LICENSE FILE has been set correctly then it is very likely that there is a TCP port mismatch The fourth field of a SERVER line in the license file specifies a TCP port number That number can be changed without affecting any license However it must never be changed while the license server daemon is running If it has been changed change it back to the original value If you do not know the original number anymore restart the license server daemon after typing the following command on the license server host kill PID where PID is the process id of Imgrd GLOSSARY al TASKING uality Deve
117. ccurred nn is the source line number where the error is detected message is the explanation Following is an alphabetic list of warnings a endif directive is missing At least one endif preprocessor directive is missing at the end of an input source file The if and endif preprocessor directives are not balanced argument not allowed for control control This message indicates an attempt to pass arguments to a control that accepts none Improper argument passing is a fatal error if it occurs in the compiler invocation but the preprocessor only issues a warning if the improper argument occurs in a pragma directive argument not allowed for negated control control Negated controls except for the noreentrant control do not accept arguments An improper argument for a negated control is a fatal error if it occurs in the compiler invocation but the preprocessor only issues a warning if the improper argument occurs in a pragma directive line argument out of range for control control arg This message indicates an attempt to use an argument value that is out of the valid range An out of range argument is a fatal error if it occurs in the compiler invocation but the preprocessor only issues a warning if the improper argument occurs in a pragma directive Messages and Error Recovery 9 29 argument required for control control A missing required argument is a fatal error if it occurs in the compiler invocation but th
118. ck pointer with the address of the stack Initialize any other registers you need call any initialization routines you need then do a long call 1ca11 to your main C function Your ASM196 main module must contain at least the following lines 5 6 Chapter 5 cstart module cmain sp equ 18H word cseg at 2080H extrn main ld sp stack lcall main st reset the processor if program returns to cstart end Assemble the file and then link it with your C object files Note that this example startup code does not use the _main routine 5 4 WRITING YOUR OWN MAIN ROUTINE You can also write your own main routine This routine must contain at least a call to main anda call to__exit extern void main void extern void exit int void _main void main exit 0 Compile this file and either link it with your C object files or use the 1ib196 tool to replace the main obj in the library files with your own _main obj PROCESSOR REGISTERS al TASKING uality Development Tools Worldwide Processor Registers 6 3 The 80C196 family of microcontrollers contains special function registers SFRs for processor hardware manipulation and a register file for faster operand access This chapter describes the variables declared in the xx sfrs h header files where xx represents the processor as specified with the model xx control for using the SFRs and explains how to use
119. compilation in the source file ex c The macro SYS expands to the value 1 since its definition is in the compiler invocation so PATHLENGTH gets the value 128 and 80C196 is defined with an empty value Since 80C196 is defined NUMINTR gets the value 16 The invocation is as follows c196 ex c define SYS The ex c source text contains the following lines if SYS define PATHLENGTH 128 define 80C196 else define PATHLENGTH 45 endif ifdef 80C196 define NUMINTR 16 else define NUMINTR 8 endif 4 18 Chapter 4 i 2 The following compiler invocation suppresses the alien keyword by defining it as a macro that expands to nothing c196 ex c define alienz preprint The ex c source text contains alien int f After preprocessing the ex i preprint file contains int Compiler Controls 4 19 diagnostic Function Specifies level of diagnostic messages Select the EDE C Compiler Options Project Options menu item Select one of the Diagnostics message level 0 2 options in the Listing tab E diagnostic level where level is the value 0 1 or 2 The values correspond to remarks warnings and errors respectively Abbreviation dn Class Primary control Default diagnostic 1 Description Use this control to specify the level of diagnostic messages that the compiler produces A remark points out a questionable construct such as using an undec
120. contains descriptions of the Flexible License Manager license administration tools that are included with the package the daemon log file and its contents and the use of daemon options files to customize your use of the TASKING toolchain 2 LICENSE ADMINISTRATION 2 1 OVERVIEW The Flexible License Manager FLEXIm is a set of utilities that when incorporated into software such as the TASKING toolchain provides for managing access to the software The following terms are used to describe FLEXIm concepts and software components feature A feature could be any of the following A TASKING software product Asoftware product from another vendor license The right to use a feature FLEXIm restricts licenses for features by counting the number of licenses for features in use when new requests are made by the application software client A TASKING application program daemon A process that serves clients Sometimes referred to as a server vendor daemon The daemon that dispenses licenses for the requested features This daemon is built by an application s vendor and contains the vendor s personal encryption code Tasking is the vendor daemon for the TASKING software S Appendix A license daemon server node license file The daemon process that sends client processes to the correct vendor daemon on the correct machine The same license daemon is used by all applications from all vendors as this daemon neith
121. ction on the additional registers and generates a warning stating that there are too many registers When linking modules together specify the range of the registers available to the application with the RLI96 registers control and the desired window size through the RLI96 windowsize control See the 80C196 Utilities User s Guide listed in Related Publications for more information on these controls To efficiently use VWindows your program must meet the following requirements The size of all but one of the overlay segments must be smaller than or equal to the window size The one overlay segment can be bigger than the window size providing the register segment does not reach the window base address 80H 0COH 0EOH The RL196 linker locates this overlay segment below OFFH Your program must have enough overlay segments to occupy the additional registers The total number of global registers must fit at most below the 32 byte window base 0EOH Otherwise the linker issues a warning and your overlay segment must fit below OFFH vertical windowing is not used See the 80C196 Utilities User s Guide listed in Related Publications for a complete list of warning messages the linker generates and explanations of their causes Specify nonreentrant and static storage class to functions whenever appropriate 6 14 Chapter 6 If you are linking ASM196 modules together with C196 modules and you want the overlay segment from your
122. cut on your desktop 15 The EDE screen provides you with a menu bar a ribbon bar command buttons and one or more windows for example for source files a status bar and numerous dialog boxes TASKING EDE oO x File Edi Search Project Text Document Tools Window Help EDE Bisig US al eal TAN SIBER Compile Build Rebuild Debug On line Manuals 2 8 Chapter 2 How to Select a Toolcbain EDE supports all the TASKING toolchains When you first start EDE the correct toolchain of the product you purchased is selected and displayed in the title of the EDE desktop window If you selected the wrong toolchain or if you want to change toolchains do the following Access the EDE menu and select the Select Toolchain menu item This opens the Select Toolchain dialog Select the toolchain you want You can do this by clicking on a toolchain in the Toolchains list box and press OK Select Toolchain B Product Folder c target Toolchains Cancel TASKING lt toolchain gt version If no toolchains are present use the Browse or Scan Disk button to search for a toolchain directory Use the Browse button if you know the installation directory of another TASKING product Use the Scan Disk button to search for all TASKING products present on a specific drive Then return to step 2 How to Open an Existing Project 1 2 Follow these steps to open an existing project
123. d c working kal4 h when the include stdio h kal4 h control is specified set C196INC c c196 include c working C9OINIT C96INIT is recognized by the compiler as a prefix string used to form the pathname of a file named c96init h For example setting C96INIT as follows causes the compiler to use the c96init h file in the c Working directory set C96INIT c NworkingN Software Installation 1 5 If C96INIT is not defined or is empty the compiler searches your current working directory for c96init h The compiler always processes c96init h if it exists as the first source text to be compiled You need not specify c96init h in the compiler invocation or in a preprocessor directive TMPDIR The compiler creates temporary work files which it normally deletes when compilation is complete If the compilation is interrupted for example by your host system losing power the work files remain If you see a file with a name that looks like cnuma dat then you can simply remove it The TMPDIR environment variable specifies the directory where the compiler is to put these temporary files If TMPDIR is not defined or is empty the compiler uses your current working directory for the temporary files For example setting TMPDIR as follows causes the compiler to use the c tmp directory for temporary work files set TMPDIR c tmp 1 6 Chapter 1 1 3 INSTALLATION FOR UNIX HOSTS Step 1 Login as a user Be sure you have re
124. d not connect to the license server daemon This can have a number of causes If the program did not immediately print the error message but waited for about 30 seconds this can vary then probably the license server host is down or unreachable If the program responded immediately with the error message then check the following if the LM LICENSE FILE variable has been set to the format number bhost is the number correct It should match the fourth field of a SERVER line in the license file on the license server host Also the host name on that SERVER line should be the same as the host name set in the LM_LICENSE_FILE variable Correct LM_LICENSE_FILE if necessary In any case one should verify if the license server daemon is running Type the following command on the host where the license server daemon Imgrd is supposed to run On SunOS 4 x ps wwax grep lmgrd grep v grep On HP UX or SunOS 5 x Solaris 2 x ps ef grep lmgrd grep v grep If the command does not produce any output then the license server daemon is not running See below for an example how to start Imgrd A 28 Appendix A Make sure that both license server daemon Imgrd and the program are using the same license data All TASKING products use the license file usr local flexlm licenses license dat unless overruled by the environment variable LM_LICENSE_FILE However not all existing Imgrd daemons may use the same default In
125. d notranslate controls suppress the entire print file even if list is specified The nolist control suppresses the source text listing even if cond listexpand and listinclude are specified The list and nolist controls affect only the subsequent source text and remain in effect until the compiler encounters the opposite control or the end of the source text You can specify these controls in the compiler invocation and in pragma preprocessor directives throughout the source text 4 52 Chapter 4 q cond pagelength tabwidth listexpand pagewidth title listinclude print translate Compiler Controls 4 53 listexpand Function Includes or suppresses macro expansion in listing Select the EDE C Compiler Options Project Options menu item Enable or disable the Include macro expansion check box in the Listing tab esse listexpand nolistexpand Abbreviation le nole Class General control Default nolistexpand Description Use this control to include the results of macro expansion in the source text listing in the print file Use the nolistexpand control default to suppress the results of macro expansion The compiler marks the macro expansion lines with a plus in the Line column of the source text listing Macro expansions only appear in the source text listing of compiled code and do not appear in the source text listing of uncompiled code even when you use the cond control t
126. d zr 10 18 Chapter 10 z Use the nozero control pragma to prevent the generation of zeroing entries in the initialization tables for relocatable segments ordinary variables abszero noabszero tells the compiler to zero uninitialized variables in absolute segments The default setting is noabszero noinit forces noabszero abszero can be abbreviated az Use the abszero control pragma to enable the generation of zeroing entries in the initialization tables for absolute segments variables positioned by either pragma locate or the _reg storage class modifier 10 4 5 DATA TYPE CONVERSION An unsigned integer is sufficient to hold the maximum size of an array and can hold the difference between two pointers to members of the same array The result of casting a pointer to an integer data type is as follows e Casting a near pointer to an int or short preserves the bit representation If cast to a signed integer the result can be negative e Casting a near pointer to a long or char is not supported e Casting a far pointer 24 bit model to a long preserves the bit representation e Casting a far pointer 24 bit model to an int or char is not supported The result of casting an integer data type to a pointer is as follows e Casting a signed char to a pointer sign extends e Casting an unsigned char to a pointer zero extends e Casting a char to a pointer sign extends or zero extends depending on whether signedc
127. daemon was started Flexible License Manager FLEXIm A 19 Lost connection to bost A daemon can no longer communicate with its peer on node Post which can cause the clients to have to reconnect or cause the number of daemons to go below the minimum number in which case clients may start exiting If the license daemons lose the connection to the master they will kill all the vendor daemons vendor daemons will shut themselves down Lost quorum The daemon lost quorum so will process only connection requests from other daemons MASTER SERVER died due to signal nun The license daemon received fatal signal nnn MULTIPLE xxx servers running Please kill and restart license daemon The license daemon has detected that multiple copies of vendor daemon xxx are running The user should kill all xxx daemon processes and re start the license daemon OUT feature by user N licenses mm dd yy bb zmm user has checked out N licenses of feature at mm dd yy hh mm Removing clients of cbildren The top level daemon logs this message when one of the child daemons dies RESERVE feature for HOST name RESERVE feature for USER name A license of feature is reserved for either user name or host name REStarted xxx internet port nnn Vendor daemon xxx was restarted at internet port nnn Retrying socket bind address in use The license servers try to bind their sockets for approximately 6 minutes if they detect address in use er
128. death In trying to restart the chain of sub daemons it was unable to get the file descriptors to set up the pipes to communicate This is a fatal error and the daemons must be re started read error mes sage An error in a read system call was detected recycle control BUT WE DIDN T HAVE CONTROL The hierarchy of vendor daemons has become confused over who holds the control token This is an internal error return reserved can t find feature listbead When a daemon is returning a reservation to the free reservation list it could not find the 1isthead of features select message An error in a select system call was detected Server exiting The server is exiting This is normally due to an error SHELLO for wrong DAEMON This vendor daemon was sent a server hello message that was destined for a different DAEMON Unsolicited msg from parent Normally the top level vendor daemon sends no unsolicited messages If one arrives this message is logged This is a bug WARNING CORRUPTED options list o next 0 Options list TERMINATED at bad entry An internal inconsistency was detected in the daemon s option list Flexible License Manager FLEXIm A 25 5 FLEXLM LICENSE ERRORS FLEXIm license error encryption code in license file is inconsistent Check the contents of the license file using the license data sheet for the product Correct the license file and run the Imreread command However do not
129. ditional C96 LIB functions supported by the 80C196 only Ry ps ur BR RR kk Ck ok Ck ko kk Ck kk kk ko kk kk kk ko kk I IR OR RR kk kk k kk kk kk ko kk kk kk ke OR ek e ke f void enable void void disable void Figure 3 13 Digital signal filter preprint file continued 3 38 Chapter 3 void power down void void idle void void enable pts void void disable pts void line 12 dsfinit h access analog to digital A D channel high speed output HSO software timer 0 input output I O ports and interrupt flags This header file also declares enable to enable interrupts ba register unsigned char input register unsigned int word_value byte_value is the high order bit of word_value BRR IK IK RRR RI IR IRR ke e e k ko k koc IIR k k kk k IO k k kk k k kk kk kk kk kk kk kk f line 2 c96init h pragma pagelength 30 pragma pagewidth 72 line 1 dsf c BRK kk ck ek kk ko kk kk ke k ke k ko kk khe kk kk kk ke RIOR kk kk kk kk ke ke ke ke kk kk kk ke kk kk ke k ke I ke ke ke f y This program implements a digital signal filter with the following ay equation V new K input M V old zf BRR e e KR kk e e e k e e ke IR IR e e e k e e e k ke e e k ok e k ke e Ck ke k kk k k ko IO k k kk kk kk kk kk kk ek kk kk BRR e e ok ck kk e e e k e e ke IR IR kk kk kk e k ke e ke k ok IR kk ke k k k k kk k k kk k k kk kk kk kk kk kk kk kk kk f xA
130. ds then the compiler removes or combines them to save memory space or execution time Addition of 0 multiplication by 1 or 0 and operations on two or more constants fall into this category For example the expression a 2 3 becomes at5 Compiler Controls 4 73 The following constant operations are detected and reduced for all integral values except unsigned longs including signed and unsigned bit fields and in case you were wondering a one bit signed field has the range 1 40 Comparisons involving constants Comma operators involving constants Multiplication by zero There may be some surprises that come from code being eliminated and also from the warning messages telling you that a comparison always returns TRUE or it always returns FALSE However if the part of the expression being eliminated contains a function call the function will be called but its result will not be used a constant will be used instead of the operation involving the function For example in the following program 1 extern unsigned uns func void 2 3 void main void 4 5 int ds 6 unsigned u 7 8 if i gt 84000 u lt 0 9 i 6 10 if uns_func lt 0 11 i 7 12 i uns_func 0 13 the only code generated for the body of main will be the two calls to uns_func needed because the function might have useful side effects and the clearing of i This is because an integer can never be greater than 84000 and an unsigned
131. e 2 3 DAEMON OPTIONS FILE It is possible to customize the use of TASKING software using a daemon options file This options file allows you to reserve licenses for specified users or groups of users to restrict access to the TASKING toolchain and to set software timeouts The following table lists the keywords that are recognized at the start of a line of a daemon options file Flexible License Manager FLEXIm Keywords Function RESERVE Ensures that TASKING software will always be available to one or more users or on one or more host computer systems INCLUDE Allows you to specify a list of users who are allowed exclusive access to the TASKING software EXCLUDE Allows you to disallow certain people use of the TASKING software GROUP Allows the specification of a group of users for use in the other commands TIMEOUT Allows licenses that are idle to be returned to the free pool for use by someone else NOLOG Causes messages of the specified type to be filtered out of the daemon s log output Table A 1 Daemon options file keywords In order to use the daemon options capability you must create a daemon options file and list its pathname as the fourth field on the DAEMON line for the Tasking daemon in the license file For example if the daemon options were in file usr local license opt then you would modify the license file DAEMON line as follows DAEMON Tasking usr local Tasking
132. e and unmask interrupts within the interrupt using int mask and imask1 See the processor specific manual for a list of interrupts with their corresponding interrupt numbers You can specify the interrupt control in the compiler invocation and in pragma preprocessor directives In certain cases it is useful to have indirect interrupt vectors Compiler Controls 4 45 Two examples The first example uses an interrupt vector table in register memory It can be updated at run time The second example can be used if the 196 vector table and some basic code is in some permanent ROM at address 2000h and the interrupt handler and other code is in an EPROM which can be replaced in the target First the example with a table in register memory JMPVEC MODULE RSEG vectoro DSW vectorl DSW vector2 DSW vector3 DSW KA KA KA LA KSEG at 2000n DCW IntHandO DCW IntHandl DCW IntHand2 DCW IntHand3 CSEG IntHand0 PUSHA PUSH 5 BR vector0 POPA IntHandl PUSHA PUSH 545 vectorl W 0 POPA IntHand2 PUSHA PUSH 5 vector2 LU 0 POPA IntHand3 PUSHA PUSH 5 BR vector3 POPA 4 46 Chapter 4 Of course now you must fill in the table before the first interrupt occurs If functions in C are called you need to determine if it is necessary to still declare them as interrupt The example above does not take any precaution to save and restore the TMPREG registers
133. e as unsigned int short same as signed int unsigned long 4 integer 0 to 4 294 967 295 long 4 two s complement integer 2 147 483 648 to 2 147 483 647 10 4 Chapter 10 Data Type Sizein Format Range Bytes float 4 single precision 8 43 x 10 87 to 3 37 x 1038 floating point approximate absolute value double same as float long double same as float bit field 1to16 integer or two s depends on number of bits bits complement integer near pointer 2 address 64 kilobytes far pointer 4 address 16 megabytes enum 2 two s complement 32768 to 32 767 1 unsigned char if the nosigned char control is in effect or signed char if the signedchar control is in effect 2 occurs only as a member of a structure or union aggregate data type Table 10 1 80C196 processor scalar data types A character constant can contain up to two characters and is stored in character format one byte per character The rightmost character in the constant occupies the low order byte A character constant operates as an unsigned char data type 10 1 2 CONTIGUITY Variables reside in memory from low order to high order bytes within a word and from low address to high address across multiple bytes The address of a variable is the location of the low order byte of the variable Scalar variables longer than one byte and aggregate variables that contain word aligned members are word aligned starting on
134. e file There should be a line starting with FEATURE SWiiiiii j A 26 Appendix A for identifying a compatible host architecture During product installations the product code is shown e g SW008002 SW019002 The number in the software code is the same as the number in the product code except that the first number may contain an extra leading zero it must be six digits long The line after the license error message describes the expected feature format and includes the host code Correct the license file using the license data sheet for the product and run the Imreread command There is one catch do not add extra SERVER lines or change existing SERVER lines in the license file FLEXIm license error license server does not support tbis feature If the LM LICENSE FILE variable has been set to the format number bost then see first the solution for the message FLEX1m license error no such feature exists Run the Imreread program to inform the license server about a changed license data file If Imreread succeeds informing the license server but the error message persists there are basically three possibilities The license password is incorrect If this is the case then there must be an error message in the log file of Imgrd Correct the password using the license data sheet for the product Finally rerun Imreread The log file of Imgrd is usually specified to Imgrd at startup with the 1 option o
135. e has the OMF96 version 3 0 format but contains all necessary code for global initialization The same is true for using the libraries The libraries provided with our tools are compiled with the default om 2 control If you want to get an OMF96 version 3 0 compatible abs file just specify omf 1 in the linker controls and you can use our default libraries A word of caution if you specify omf 1 in your linker controls and if you have any unresolved externals in your application it is possible that the linker will give a fatal OMF96 error This is caused by the fact that you have specified OMF96 version 3 0 but the linker needs to write information about the unresolved externals in OMF96 version 3 2 format You will see a warning about the unresolved externals before you get the fatal omf error So do not have any unresolved externals when you convert from OMF96 3 2 format to OMF96 3 0 format Compiling and Linking 3 29 3 7 2 OMF96 VERSION 3 0 LIMITATIONS OMF96 version 3 0 has the following limitations compared to OMF96 version 3 2 Limited support for functions Limited support for structures Limited support for unions Limited support for bit fields No support for vertical windowing Restricted line number information 3 8 EXAMPLES This section contains an example C196 program showing how to use compiler controls and environment variables for compiling interrupt functions finding include and head
136. e only on the 80C196 processor See the Embedded Microcontrollers and Processors Handbook listed in Related Publications for more information on the idle mode of the 80C196 processors The processor enters the following state during idle mode The CPU stops executing All internal clocks assume logic state zero Peripheral clocks and the CLKOUT pin remain active All peripherals and the interrupt controller continue to function If the watchdog timer was enabled after a reset it continues to operate All RAM is preserved You can release the CPU from idle mode with an interrupt or a hardware reset Returns The idle function does not return a value 8 21 8 22 Chapter 8 power down Function Enters a power saving mode Prototype Declaration void power down void Header File xXx funcs h xx represents a processor model Description Use this function to place the 80C196 processor in powerdown mode The power down function is available only on the 80C196 processor See the Embedded Microcontrollers and Processors Handbook listed in Related Publications for more information on the powerdown mode of the 80C196 processors All peripherals must be idle before the program calls the power down function In powerdown mode the state of the processor has the following characteristics The CPU stops executing All internal clocks assume logic state zero The oscillator is turned off The 80C196
137. e preprocessor only issues a warning if the missing argument occurs in a pragma directive argument too long for control control The length of the argument to the control exceeds the maximum number of characters allowed by the compiler bad octal digit bex value bex An octal number contains a non octal character The hex value is the ASCII value of the illegal character comment extends across tbe end of a file A comment started in a file is not closed before the end of the file comparison of signed and unsigned value This warning is generated when one of the operands in an lt gt lt or gt operation has a signed type and the other operand has an unsigned type but only if the unsigned value is at least as wide as the signed value The usual conversions are done before the comparison if needed const declaration made non register The const qualifier was specified in an initialized data declaration in file scope that otherwise would have placed the declared object in the register segment The constant object will instead be placed in the constant segment control control cannot be negated You cannot use the no prefix with this compiler control Improper negating is a fatal error if it occurs in the compiler invocation but the preprocessor only issues a warning if it occurs in a pragma directive control control not allowed in pragma The compiler encountered either a de ine or an include control in a pra
138. e specified in a pragma content directive extend ex Recognizes or suppresses Intel Source Primary noextend noex extensions to proposed ANSI C Default extend extratmp et Allows usage of extra temporary Object Primary noextratmp noet registers TMPREG8 to TMPREG16 Default noextratmp for non 24 bit models extratmp for 24 bit models farcode fc Tells the compiler to generate code for Object Primary nearcode nc the extended fc or compatibility nc mode of 24 bit processors Default nearcode farconst fk Tells the compiler to place constant Object Primary nearconst nk objects in either the farconst or const segment Only valid with 24 bit processors Default nearconst fardata fd Tells the compiler to place non Object Primary neardata nd constant non register data in either the fardata or data segment Only valid with 24 bit processors Default neardata fastinterrupt fi Specifies the compiler not to save Object General nofastinterrupt nofi temporary results on entering the interrupt routine Default nofastinterrupt fixedparams a fp Specifies the FPL or VPL Object General varparams a vp function calling convention Default varparams for non alien functions Compiling and Linking Control Abbr Description and Default Effect Usage generatevectors gv Generate interrupt vectors Default Object Primary nogeneratevectors nogv
139. e type of s is not complete if the program contains no previous declaration defining the tag S int f struct S s oj incorrect void usage The void attribute was specified in conflict with another attribute For example imt fCvorxd x invalid mnemonic The assembly mnemonic specified after the asm keyword is not valid See Section 7 3 for a list of supported assembler instructions Also see the 80C196 Assembler User s Guide for a complete list of assembler instructions invalid instruction for model specified The instruction is not valid for the model specified by the model control See the 80C196 Assembler User s Guide for a detailed explanation of each instruction invalid addressing mode The indexed addressing mode is not valid in the first operand position of a two or three operand instruction or in the second position of a three operand instruction See 80C196 Assembler User s Guide for descriptions of valid operands for each instruction 9 20 Chapter 9 7 invalid attribute for function The source program attempted to set multiple and conflicting attributes for a function For example a varparams or fixedparams control appears for a function whose calling convention has already been established by use definition declaration or a previous calling convention control For another example a function identifier appears as an argument to an interrupt control which appeared in a previous varparams fixedparams
140. e used to hold the serial port status This function sets the TI bit in the static variable thereby initializing the mechanism used by the put ch function The putch function then waits for the TI bit to be set indicating that the previous character has been transmitted before writing the character argument to the serial port If you do not call init serio before calling putch the putch function can wait indefinitely for the TI bit to be set 8 24 Chapter 8 The sp stat and sbuf variables are defined in the xx sfrs h header files If you redefine putch to write to a different destination you can use printf to write formatted output to locations other than the serial port The program must then ensure the new destination is enabled as appropriate Before using printf or sprintf with floating point numbers you must call the fpinit function to initialize floating point capability You must also specify one of the c96fp 1ib libraries and one of the FPAL96 libraries when you link your program to provide floating point support Returns The printf function returns the number of characters actually transmitted If an I O error occurs the return value is negative The sprintf function returns the number of characters written into the memory buffer This return value does not include the terminating null character Libraries 8 25 scanf sscanf Function Formats input Prototype Declaration int scanf const signed char fo
141. ectory setenv C96INIT proj working 1 10 Chapter 1 If C96INIT is not defined or is empty the compiler searches your current working directory for c96init h The compiler always processes c96init h if it exists as the first source text to be compiled You need not specify c96init h in the compiler invocation or in a preprocessor directive TMPDIR The compiler creates temporary work files which it normally deletes when compilation is complete If the compilation is interrupted for example by your host system losing power the work files remain If you see a file with a name that looks like cnuma dat then you can simply remove it The TMPDIR environment variable specifies the directory where the compiler is to put these temporary files If TMPDIR is not defined or is empty the compiler uses the tmp directory for the temporary files For example setting TMPDIR as follows causes the compiler to use the tmp directory for temporary work files setenv TMPDIR tmp OVERVIEW al TASKING uality Development Tools Worldwide Overview 2 3 This chapter introduces you to the C196 compiler and to the related 80C196 utilities Intended for the new user this overview helps you understand the general function of the compilation system and directs you to sources of detailed and supplemental information At the end of this chapter is a sample session 2 1 C196 AND THE SOFTWARE DEVELOPMENT PROCESS F
142. ed c196 ifile c rl1196 f projfile ltx The files file and projfile may vary from one call to the next To reduce the number of calls you can make a batch file for example pro j bat Note that whatever the batch file is called it must end with the file extension bat The file should contain c196 1 c r1196 f 2 1tx On invocation 1 and 2 will be replaced by the first and second parameters after the batch file name Using the name mentioned above proj note that the file extension bat is not needed for invocation the call becomes proj ifile projfile DOS will return on the screen the actual command line executed with all the parameters expanded to the values used Compiling and Linking 3 25 3 5 3 USING UNIX SCRIPTS Scripts are a facility within UNIX whereby one or more commands can be executed from within a file Assume that the following sequence of calls is frequently used c196 ifile c rl1196 f projfile ltx The files file and projfile may vary from one call to the next To reduce the number of calls you can make a script for example proj The file should contain c196 1 c rl1196 f 2 1tx On invocation 1 and 2 will be replaced by the first and second parameters after the script file name Using the name mentioned above proj the call becomes sh proj ifile projfile 3 6 DEVELOPING A C196 APPLICATION PROGRAM The C196 compiler supports modular structured development of applicati
143. ed Publications 7 6 EXAMPLES 1 The following example shows how you can add in line assembly code to C196 source text include lt stdio h gt register int ri main int i init_serio asm ld ri 10 st ri i add ri i printf ri dNrWMn ri 2 The following is an example of the use of the tijmp instruction pragma model kc int func unsigned char k unsigned char ip amp k goto around lbl1 return 1 1bl2 return 2 7 10 Chapter 7 lbl3 return 3 l1b14 return 4 asm dcw 0 force word alignment tbl asm dcw lbll dcw 1b12 dcw 1b13 dcw 1b14 around asm id 0x22 ip ld 0x20 tbl tijmp 0x20 0x22 3 return 0 main unsigned char i j for i 0 i lt 3 i j func i return LIBRARIES al TASKING uality Development Tools Worldwide Libraries 8 3 This chapter describes ways to include assembly language instructions inside your C196 program without requiring a separately written and translated assembly language routine The C196 libraries provide the ANSI standard C library functionality and some additional functionality specific to 80C196 architecture This chapter describes C196 functions and macros that are implementation specific or that do not conform to the 1989 ANSI standard for C Functions and macros that do conform to ANSI C are described in C A Reference M
144. ee where the compiler found the error unbalanced conditional compilation directive Conditional compilation directives are improperly formed For example the program contains too many endif preprocessor directives or an else preprocessor directive without a matching if preprocessor directive undefined identifier name The program contains a reference to an identifier that has not been previously declared undefined label label A label has been referenced in the function but has never been defined undefined or not a label An identifier following a goto must be a label the identifier was declared otherwise or the label was not defined undefined parameter The argument being defined did not appear in the formal parameter list of the function unexpected EOF The input source file or files ended in the middle of a token such as a character constant string literal or comment unit string literal too long truncated The maximum length of a string is 1024 characters variable reinitialization An initializer for this variable was already processed void function cannot return value A return with an expression is encountered in a function that is declared as type void In void functions all returns must be without a value 9 28 Chapter 9 7 9 5 WARNINGS Warnings have the following syntax Warning at line nn of filename message where filename is the name of the file in which the error o
145. embly A language similar to assembly language used to represent object code in a humanly readable format Glossary B 7 RAM Random access memory reentrant A function that calls itself or gets called again in a call loop register file 80C196 on chip memory used for high speed data access and for hardware control also called register memory registers Bytes in the register file 11196 80C196 relocation and linking utility ROM Read only memory run time During execution scalar data type Block of memory containing a single value search path The list of directories that the compiler or the host system can search to find a filename setup Code in the calling function that the processor executes just before control transfers to the called function SFRs Special function registers part of the register file used for hardware control sign extend In promoting a data type filling the bits of the unused high order part of the longer data type with the value of the shorter data type s sign bit startup code Instructions that initialize the processor target System on which the application program executes B 8 Appendix B UDI string Length prefixed string V vector table table containing addresses pointing to code VPL variable parameter list calling convention W word 16 bits 2 bytes zero extend In promoting a data type filling the bits of the unused high order part of the longer data t
146. er invocation These environment variables are as follows PATH PATH is recognized by UNIX as a list of pathnames of directories containing executable or scripts If one of the pathnames in this list specifies the directory containing the C196 compiler you need not retype the full pathname each time you invoke the compiler Your UNIX literature explains how to define the PATH environment variable C196INC C196INC is recognized by the compiler as a list of prefix strings separated with colons that the compiler can use to locate include files If you specify a filename or partial pathname with the include control or the include preprocessor directive the compiler prepends each string in C196INC in turn and uses each resulting pathname as the name of the include file The compiler uses the pathnames formed from the list in C196INC in addition to any you specify with the searchinclude control For example the following definition of C196INC locates the files include stdio h and proj working kal4 h when the include stdio h kal4 h control is specified if using the Bourne shell sh C196INC include proj working export C196INC or if using the C shell csh setenv C196INC include proj working C9GINIT C96INIT is recognized by the compiler as a prefix string used to form the pathname of a file named c96init h For example setting CO6INIT as follows causes the compiler to use the c96init h file in the proj working dir
147. er 4 to select the 80C196KR to select the 80C196KS Specifying ks is equivalent to specifying kr to select the 80C196KT Specifying kt is equivalent to specifying kr to select the 80C196LB to select the 80C196MC to select the 80C196MD to select the 80C196MH to select the 80C196NP This argument can have an extra suffix as described in the note below to select the 80C196NT This argument can have an extra suffix as described in the note below to select the 80C196NU This argument can have an extra suffix as described in the note below The cb ea ec np nt and nu arguments of the model control can have an additional suffix Without a suffix specifying xx is the same as specifying xx c where xx is one of cb ea ec np nt or nu The following six suffixes are possible XX C xx cnf xx cf XxXx e xx enf xx ef to select the compatible mode and to use near code addressing and near data near const addressing to select the compatible mode and to use near code addressing and near data far const addressing to select the compatible mode and to use near code addressing and far data far const addressing to select the extended mode and to use far code addressing and near data near const addressing to select the extended mode and to use far code addressing and near data far const addressing to select the extended mode and to use far code addressing and far data far const addressing Compile
148. er files in directories other than the current directory debugging the preprocessor directives specifying print file content preparing the object code for symbolic debugging optimizing the object code This example also demonstrates the use of the 80C196 processor s special function registers SFRs and header file 3 8 1 SOURCE TEXT The program used in this example is a digital filter application designed to run on the 80C196KB processor This program demonstrates the use of the following variables defined in the kb s rs h header file for accessing the special function registers SFRs ad commandis the command register for the analog to digital converter hso command is the command register for the high speed output hso time is the timer for the high speed output 3 30 Chapter 3 timerl is one of the hardware timers ad_result_hi is the high order byte of the analog to digital converter output ad_result_lo is the low order byte of the analog to digital converter output ioport0 is one of the input output I O ports ioportl is one of the input output I O ports Figures 3 10 through 3 12 list the contents of the primary source text file including comments explaining how the program works In this example the initialization routine is in dsfinit h and the interrupt and main routines are in dsf c both in the directory project working The material contained in this chapter on the Digital Fil
149. er performs encryption nor dispenses licenses The license daemon processes no user requests on its own but forwards these requests to other daemons the vendor daemons A computer system that is running both the license and vendor daemon software The server node will contain all the dynamic information regarding the usage of all the features An end user specific file that contains descriptions of the server nodes that can run the license daemons the various vendor daemons and the restrictions for all the licensed features The TASKING software is granted permission to run by FLEXIm daemons the daemons are started when the TASKING toolchain is installed and run continuously thereafter Information needed by the FLEXIm daemons to perform access management is contained in a license data file that is created during the toolchain installation process As part of their normal operation the daemons log their actions in a daemon log file which can be used to monitor usage of the TASKING toolchain The following sections discuss e Installation of the FLEXIm daemons to provide for access to the TASKING toolchain e Customizing your use of the toolchain through the use of a daemon options file e Utilities that are provided to assist you in performing license administration functions e The daemon log file and its contents For additional information regarding the use of FLEXIm refer to the chapter Software Installation Flexi
150. er subdirectories of the 1ib directory are suitable for use with a processor specific model respectively The header files supplied with the C196 compiler are sensitive where necessary to the model and mode you select Function prototypes involving pointers declare far pointers when the selected model is 24 bit otherwise the prototypes declare near pointers The resulting function prototype declarations match the actual functions that you will link from the appropriate library file 8 6 E Chapter 8 8 1 2 LINKING LIBRARY FILES The RL196 linker searches through the library files to resolve external references to library functions It uses the first instance of a function that it encounters and skips any function with the same name in any subsequent library The linker only makes one pass through each library file and tries to resolve as many external references as it can The linker does not reopen previously searched library files if it encounters more external references later on in the process For this reason you must link all library files last to ensure that all external references are known before the linker searches through each library RL196 searches through a list of files to find an input file The contents of the list depends on the model control Specify the libraries and object files for linking in the following order startup code choose the object file according to the model and the execution mode cstart
151. ero control pragma to prevent the generation of zeroing entries in the initialization tables for relocatable segments ordinary variables noinit forces nozero abszero init Tv STARTUP CODE al TASKING uality Development Tools Worldwide Startup Code 5 3 This chapter describes the startup files cstart a96 and _main c which are supplied with your C196 compiler 5 1 CONTENTS OF CSTART A96 When you link your program you need to include the file cstart ob j as one of your input files For each model the corresponding cstart obj is provided in each subdirectory of the lib directory If you like you can customize the source file cstart a96 nt start 196 for model NT np start 196 for model NP which is provided in the src subdirectory of the 1ib directory It looks something like this STARTUP MODULE CMAIN RSEG SP EQU 018H WORD CSEG AT 2080H EXTRN _main NULL cstart PUBLIC cstart LD SP STACK LJMP main main calls the others exit PUBLIC exit BR exit END The C language treats each routine as an ordinary function including main For that reason you can use the startup code as the main module for your C196 modules When you link the cstart ob j file with your modules the linker creates an absolute code segment which becomes the main module segment containing a long jump to the _main see 5 2 routine You can tailor the cstart a96 file accord
152. es of register memory for the C function Since A calls C C cannot use register locations allocated for A However since C is never active at the same time as function B C can reuse locations used by B The C function uses locations 26H through 2BH The compiler allocates nine bytes of register memory for the D function Since both A and B call D D cannot use register locations allocated for A or B The D function uses locations 2AH through 32H 6 10 Chapter 6 e The compiler allocates three bytes of register memory for the E function Since B calls E E cannot use register locations allocated for B Since E is not active at the same time as either C or D E can reuse locations used by these functions The E function uses locations 2AH through 2CH The compiler allocates four bytes of register memory for the F function Since A calls C and C calls F F cannot use register locations allocated to either C or A Also since A and B call D and D calls F F cannot use register locations allocated to either D B or again A The F function uses locations 33H through 36H e The compiler allocates three bytes of register memory for the G function Since B calls E and E calls G G cannot use register locations allocated to B or E The G function uses locations 2DH through 2FH If the module represented in Figure 6 2 is the only code running in the processor the module uses locations 24H through 36H
153. es to a project 2 13 Aggregate variables Alignment 10 5 10 6 Argument 10 8 Bit fields 10 6 Examples 10 6 Gaps 10 6 Initialization 10 15 Return values 10 9 Aliasing 4 75 alien keyword 4 23 4 24 4 32 10 8 Alignment 10 5 Alignment of variables 10 4 ANSI conformance 2 5 STDC macro 3 13 Data types 10 3 Libraries 8 3 TASKING extensions 4 23 4 24 4 90 Type checking 4 24 Application development 2 3 Index 4 Application techniques 2 3 Arguments Limits 10 22 Representation 10 8 Stack allocation 10 8 Stack use 10 8 asm keyword 7 3 ASM196 assembler 10 3 10 9 ASM196 instruction set 7 1 Supported 7 6 Unsupported 7 8 Assigning absolute addresses 4 57 Assigning interrupt handlers 4 31 4 43 4 48 4 49 Attributes Examples 3 20 Print file 5 20 batch files 3 24 Bit fields 10 19 Alignment 10 6 Block nesting 3 18 bmov control 4 5 bmov instruction 4 5 bmovi instruction 4 5 Branch optimization 4 74 Byte gaps 10 6 C C196 features Implementation dependent 10 14 C196 invocation syntax 3 3 C196 startup code 5 1 C196INC environment variable 1 4 1 9 4 100 10 22 c96 lib library 8 3 c96fp lib library 8 3 Index C96INIT environment variable 1 4 1 9 c96init h include file 1 4 1 9 3 5 10 22 Calling convention 2 5 alien keyword 2 5 Code 10 7 Compatibility 10 7 Controls 4 32 4 33 4 115 Default 4 33 4 115 10 7 Examples 4 33 4 115
154. eviation ic Class Invocation control Description Use this control to insert and compile text from files other than the primary source file These files are called include files The compiler processes include files in the order specified in the filename list before processing the primary source file Files included by the include control on the invocation line can use all macros defined by the define control on the invocation line regardless of the order of the controls Files included by the include control on the invocation line precede the scope of macros defined by the define preprocessor directive in source text from the primary source file and from all subsequent include files Files included by the include preprocessor directive in source text are within the scope of previously defined macros and precede the scope of subsequently defined macros Compiler Controls 4 39 You can use the listinclude control to include the contents of the include files in the print file The compiler lists the files specified with the include control in the order specified before the first line of source listing To specify a search path for include files use the searchinclude control To view names of include files and the order of their inclusion without compilation use the preprint and notranslate controls You can use the include control on the invocation line but not in a pragma preprocessor directive To include a file from within
155. explicit registers attribute register variables The regconserve control specifies that the compiler is to conserve registers placing only register variables and optionally a subset of the non register variables in registers The compiler cannot resolve these conflicting directions This error is fatal if both controls are specified in the compiler invocation but the preprocessor only issues a warning if the conflict occurs in pragma directives register declaration too large The number of register variables declared with block scope is greater than the number of registers available to the module The register storage class is ignored for some variables remainder of pragma ignored This message indicates that a pragma preprocessor directive is partially ignored as a result of an error Whenever an error is found in a pragma preprocessor directive the message is followed by either this message or pragma ignored whichever is appropriate shift count out of range The number of shifts you specified exceeds the number of bits in the register operand for example asm shl wreg 17 This example issues a warning because a word operand only contains 16 bits Messages and Error Recovery 9 35 token too long ignored from cbaracter bex value bex The length of a character sequence such as an identifier or a macro argument has exceeded the compiler limit too many register variables The number of variables explicitly decla
156. ey are converted to a data type that occupies more memory than the char data type Use the nosignedchar control to specify that objects declared as the char data type are treated as if they were declared as the unsigned char data type The compiler zero extends these objects when they are converted to a data type that occupies more memory than the char data type The signedchar and nosignedchar controls do not affect the interpretation of objects specifically declared as either signed char or unsigned char data types The predefined macro SIGNEDCHAR has the value 1 if signedchar is specified and 0 if nosignedchar is specified Compiler Controls 4 103 If notranslate or noobject is in effect the compiler does not generate an object module so signedchar and nosignedchar have no effect However specifying signedchar or nosignedchar with noobject and code can still affect the pseudo assembly listing in the print file The signedchar and nosignedchar controls affect the entire object module You can specify either of these controls in the compiler invocation or in a pragma preprocessor directive preceding the first line of data definition or executable source text To override a pragma signedchar or pragma nosignedchar preprocessor directive specify the opposite control nosignedchar or signedchar respectively in the compiler invocation qo object translate 4 104 Chapter 4 speed Function Choose between faste
157. f a program Use level 0 when debugging with a symbolic debugger to ensure the closest match between a line of source text and the object code generated for that line Each optimization level performs all the optimizations of all lower levels Figure 4 1 summarizes the optimizations performed at each level The predefined macro OPTIMIZE has the value specified for the optimize control 4 72 Chapter 4 The optimize control affects the entire object module You can specify this control in the compiler invocation or in a pragma preprocessor directive preceding the first line of data definition or executable source text To override a pragma optimize level preprocessor directive specified in the source text specify optimize with a different level in the compiler invocation Optimization Level 3 optimizing indeterminate storage operations Optimization Level 2 more peephole optimization reversing branch conditions removing unreachable code re using duplicate code eliminating superfluous branches Optimization Level 1 peephole optimization eliminating common subexpressions register history Optimization Level 0 strength reduction folding constant expressions short long jump resolution OSD244 Figure 4 1 Summary of optimization levels Folding of Constant Expressions at All Levels The compiler recognizes the operations involving constant operan
158. f characters that the compiler prepends to an include file s filename This string must include any special characters that the operating system expects in a path prefix Abbreviation si nosi Class General control Default nosearchinclude Description Use this control to specify a list of possible path prefixes for include files Each pathprefix argument is a string that when concatenated to a filename specifies the relative or absolute path of a file including a device name and directory name if necessary The compiler tries each prefix in the order in which they are specified until a legal filename is found If a legal filename is not found the compiler issues an error An include file is a source text file specified with the include control in the compiler invocation or with the include preprocessor directive in the source text The contents of each include file are inserted into the source text during preprocessing 4 100 Chapter 4 The order in which the compiler uses the searchinclude and default path prefixes depends on how the include file is specified When searching for a file specified with the include filename control or with the include filename preprocessor directive the compiler tests the prefixes in the following order The source directory The directories specified by the searchinclude list The directories in the C196INC environment variable if defined The include directory one di
159. f the compilation summary in the print file is identical to the sign off message displayed on the screen when the compilation is complete Before this final line the compiler lists information about the compiled object module Figure 3 8 shows a compilation summary from a successful compilation If the compilation ends with a fatal error the following line replaces the normal compilation summary COMPILATION TERMINATED Compiling and Linking 3 23 Module Information Code Area Size 0027H 39D Constant Area Size 0000H OD Data Area Size 0000H OD Static Regs Area Size 0000H OD Overlayable Regs Area Size 0002H 2D Maximum Stack Size 0002H 2D C196 Compilation Complete 0 Warnings 0 Errors Figure 5 8 Print file compilation summary 3 4 3 OBJECT FILE The compiler produces an object file by default as shown in Table 3 3 The object file contains the relocatable code and data generated by the compiler as a result of a successful compilation To suppress the object file you must specify one of the following controls notranslate notranslate stops compilation after preprocessing The compiler can produce a preprint file but no print file Use notranslate to find the effects on the source text of macro expansion conditional compilation and file inclusion without a full compilation noobject noobject suppresses the object file although compilation completes The compiler can produce both a preprint file and
160. fficient register allocation 7 Assembly Code Instructions Describes ways to include assembly language instructions inside your C196 program without requiring a separately written and translated assembly language routine 8 Libraries Contains the library functions supported by the compiler and describes their interface and header files 9 Messages and Error Recovery Describes the error warning messages of the compiler Manual Purpose and Structure XIII 10 Language Implementation Concentrates on the approach of the 80C196 architecture and describes the language implementation The C language itself is not described in this document We recommend The C Programming Language second edition by B Kernighan and D Ritchie 1988 Prentice Hall APPENDICES A Flexible License Manager FLEXIm Contains a description of the Flexible License Manager B Glossary Contains an explanation of terms INDEX RELEASE NOTE XIV Manual Purpose and Structure 7 RELATED PUBLICATIONS C A Reference Manual by Harbison and Steele The C Programming Language second edition by B Kernighan and D Ritchie 1988 Prentice Hall e ANSI X3 159 1989 standard ANSI s JEEE Standard for Floating point Arithmetic 754 1985 TASKING publications e 80C196 C Compiler User s Guide TASKING MA006022 e 80C196 Assembler User s Guide TASKING MA006020 e 80C196 Utilities User s Guide TASKING MA006009 Intel publications
161. fier was used in the declaration of a component of a structure or union Only the entire aggregate object may be so qualified Remove or relocate the far qualifier floating point operand not allowed An operand is non integral but the operator requires integral operands That is amp and all require integral operands function body for non function A function body was supplied for an identifier that does not have function type for example int i This error message can also appear when mismatched braces appear in the source code preceding the identified line function declaration in bad context A function is defined i e appears with a formal argument list but not at module level Or a function declarator with an identifier list which is legal only for function definitions was encountered within a function as in this example int main void int f a Junction level error This internal error can be caused by an earlier syntax error function redefinition More than one function body has been found for a single function as in this example int fO int f Messages and Error Recovery 9 17 illegal array element reference In line code assembly statements cannot access stack based array variables These variables are declared as auto variables You can only access arrays when they are declared globally or declared as static within the function block illegal ass
162. fined in the compiler invocation The body of an object like macro contains no formal parameters Use the define preprocessor directive in the source text instead of the define control for function like macros C A Reference Manual listed in Related Publications describes the define preprocessor directive Compiler Controls 4 17 If the definition contains no body the macro expands to the value 1 The default value of a macro defined with the define control differs from that of a macro defined with the define preprocessor directive A macro defined without a body using define has no value and expands to nothing although a test for existence of the macro returns a true value If you remove the macro definition with a undef preprocessor directive the macro is no longer defined for source text subsequent to the undef preprocessor directive You must remove a macro definition before redefining the macro name unless the body of the redefinition exactly matches the body of the original definition An attempt to redefine a macro without first removing it causes an error You can use the define control on the invocation line but not in a pragma preprocessor directive To define a macro within the source text use the define preprocessor directive You can abbreviate the define control but not the define preprocessor directive Examples 1 In this example using the define control in the invocation determines the result of conditional
163. fined macro _DEBUG_ indicates which of type notype debug or nodebug have been specified as in Table 4 1 Debug and Type Controls Value of _DEBUG_ notype nodebug 0 type nodebug 1 notype debug 2 type debug 3 Table 4 1 Values for the DEBUG macro The debug and nodebug controls affect the entire object module You can specify either of these controls in the compiler invocation or in a pragma preprocessor directive preceding the first line of data definition or executable source text To override a pragma debug or pragma nodebug specified in the source text specify the opposite control nodebug or debug respectively in the compiler invocation object translate optimize type 4 16 Chapter 4 define Function Defines a macro Select the EDE C Compiler Options Project Options menu item Define a macro syntax macro def in the Define user macros field in the Misc tab You can define more macros by separating them with commas GB etine name body 1 where name is the name of a macro body is the text that is value of the macro If the body contains spaces or punctuation surround the entire body with quotation marks Abbreviation df Class Invocation Default body 1 Description Use this control to create object like macros in the compiler invocation The entire module primary source file and all include files is within the scope of a macro de
164. formation used by symbolic debuggers in the object module Use the default nodebug control to suppress symbolic debug information Suppressing symbolic debug information reduces the size of the object module If you specify the noobject or notranslate control the compiler does not generate an object module and debug has no effect Choose one of the following combinations of controls to aid debugging type debug for both type checking by RL196 and symbolic debugging RL196 also uses the debug information to produce link maps This combination of controls includes all possible debug and type information in the object code Compiler Controls 4 15 type nodebug for type checking by the linker This combination of controls includes type definition information for external and public symbols only You can use this combination to reduce the size of the object module when you are not using a symbolic debugger notype nodebug to suppress all debug and type information This combination reduces the size of the object module by omitting information not necessary for execution Use optimize 0 with debug when you use a symbolic debugger Since higher levels of optimization can result in rearranged or eliminated object code optimizing can reduce the ability of most symbolic debuggers to accurately correlate debug information to the source text Even with optimize 0 however some source statements may generate no code The prede
165. from the original path If you need to change the path to the license file read by the license daemon then you must shut down the daemon and restart it with that new license file path You can not use Imreread if the SERVER node names or port numbers have been changed in the license file In this case you must shut down the daemon and restart it in order for those changes to take effect Imreread does not change any option information specified in an options file If the new license file specifies a different options file that information is ignored If you need to reread the options file you must shut down the daemon and restart it Options c license file Use the specified icense_file If no c option is specified Imreread looks for the environment variable LM LICENSE FILE in order to find the license file to use If that environment variable is not set Imreread looks for the file usr local flexlm licenses license dat qo Imdown 1 A 16 Appendix A Imstat 1 Name Imstat report status on license manager daemons and feature usage Synopsis Imstat a A c icense_file f feature 1 regular expression s server S daemon t timeout Description Imstat provides information about the status of the server nodes vendor daemons vendor features and users of each feature Information can be qualified optionally by specific server nodes vendor daemons
166. g control in the compiler invocation specifies the default variable parameter list convention VPL for all functions in the source text except the plm_fen function fixedparams plm_fcn 4 34 Chapter 4 2 The following pragma preprocessor directive has the same effect as the control in the first example pragma fixedparams plm fcn 3 The following combination of controls in the compiler invocation specifies the fixed parameter list convention FPL for all functions in the source text except the native function fixedparams varparams native 4 The following pragma preprocessor directives have the same effect as the controls in the above example pragma fixedparams pragma varparams native q code translate extend varparams object Compiler Controls 4 35 generatevectors Function Generates or suppresses the generation of interrupt vectors Syntax 2 Select the EDE C Compiler Options Project Options menu item Enable or disable the Generate code for interrupt vector check box in the Object tab E generatevectors nogeneratevectors Abbreviation gv nogv Class Primary control Default generatevectors Description Use the nogeneratevectors control to specify that the compiler must not generate the interrupt vectors for the interrupt functions By default the compiler generates interrupt vectors You can specify the generatevectors and nogeneratevectors con
167. gma preprocessor directive different enum types An attempt was made to assign one enum type to a different enum type 9 30 Chapter 9 i directive line too long The line length limit for pragma preprocessor directives was exceeded division by 0 Evaluation of an expression resulted in division by a 0 value duplicate control control A primary control that must not be specified more than once was specified more than once Only the following controls can be specified more than once define reentrant fixedparams regconserve include searchinclude interrupt varparams If you specify a compiler control both in the compiler invocation and in a pragma preprocessor directive the compiler invocation specification takes precedence A duplicate control is a fatal error if it occurs in the compiler invocation but the preprocessor only issues a warning if it occurs in a pragma directive duplicate argument argument for control control An argument for control was specified more than once for example specifying more than one handler for one interrupt number escape sequence value overflow The value of an octal or hexadecimal escape sequence does not fit in one byte extra characters in pragma ignored string The string represents characters that the compiler cannot process as part of the current pragma FAR qualifier requires 24 bit model The far qualifier was used in a declaration but a 24 bit model control was n
168. har or nosignedchar is in effect e Casting an int or short to a near pointer preserves the bit representation e Casting a long to a near pointer is not supported e Casting a signed int or short to a far pointer 2 bit model sign extends Language Implementation 10 19 e Casting an unsigned int or short to a far pointer 24 bit model zero extends e Casting a long to a far pointer 24 bit model preserves the bit representation The result of casting one size pointer to the other size pointer 24 bit model is as follows e Casting a near pointer to a far pointer zero extends e Casting a far pointer to a near pointer is not supported The compiler represents enumeration types as int The no signedchar control determines whether the compiler considers a char that is declared without the signed or unsigned keywords to be signed or unsigned 10 4 6 BIT FIELDS You must declare bit fields as signed int unsigned int or just int otherwise the compiler issues an error The allocation of bit fields in a word is from low address to high address Bit fields are not necessarily allocated on word boundaries if a bit field is short enough it occupies the space between the end of the previous bit field and the beginning of the next word 10 4 7 DIVISION REMAINDER OPERATORS The binary operator indicates division Operands may be of any arithmetic type The type of the result is that of the converted operands
169. haracter has been transmitted before reading the character argument from the serial port If you do not call init ungetc before calling ungetc the ungetc function can wait indefinitely for the TI bit to be set Before using scanf or sscanf with floating point numbers you must call the fpinit function to initialize floating point capability To provide floating point support You must also specify one of the c96 p 1ib libraries and one of the FPAL96 libraries when you link your program Returns The scanf and sscanf functions return the number of successfully read input values Libraries 8 27 udistr Function Converts a C type string to UDI form Prototype Declaration char udistr char udi ptr const char c ptr where udi ptr points to a buffer large enough to contain the converted string c ptr points to a null terminated string Header File string h Description Use this function to convert a null terminated string C type string to a length prefixed string UDI type string The udi ptr argument must point to a buffer large enough to contain the UDI type string You can use the strlen function on the C type string to determine the required length of the buffer C A Reference Manual listed in Related Publications describes how to use strlen The length of the buffer must be one byte longer than the value returned by the strlen function The behavior of the udistr function for strings longer than 255 bytes
170. hat points to the beginning of the frame gap In memory one or more bits located between aligned variables and containing undefined values global variable Variable that exists independently of any block or function header file Source text file containing variable declarations function prototypes in line assembly language functions and macro definitions idle mode Power saving processor mode in which all peripherals and the watchdog timer can continue to operate but all other features are disabled or turned off Glossary B 5 include file Source text files named in an include compiler control or in a include preprocessor directive in line assembly code Source text embedded in a c196 program that is assembled as ASM196 source text rather than compiled as C196 source text instruction set The set of machine codes recognized by the 80C196 processor integral types Types that include all forms of integers characters and enumerations length prefixed string Character string beginning with a value that indicates how many characters long it is lib196 80C196 library utility local variable Variable that exists only while the block or function in which it is defined is executing and that is redefined every time the block or function is re executed longword 232 bits 4 bytes MCS 96 8096 microcontroller system 8096 90 8096 BH 80C196CA 80C196CB 80C196EA 80C196KB 80C196KC 80C196KD 80C196KR 8
171. he far keyword The generated code will use normal data addressing to access these objects When you link your program module s with RL196 you must provide sufficient RAM for the data segment somewhere within the lowest 64K of the address space The neardata control can only be used with 24 bit models qe farcode farconst fardata model nearcod nearconst Compiler Controls 4 67 object Function Generates and names or suppresses object file Select the EDE C Compiler Options Project Options menu item Add the control to the Additional options field in the Misc tab E object filename noobject where filename is the file including the path if necessary in which the compiler places the object code Abbreviation oj nooj Class Primary control Default object Description Use this control to specify a non default filename or directory for the object file By default the compiler places the object file in the directory containing the primary source file If you do not provide a filename the compiler composes the default object filename from the primary source filename For example the compiler creates an object file named main ob for the primary source file main c Use the noob ject control to suppress creation of an object file The notranslate control suppresses all translation of source text to object code and suppresses the object file and the print file The noobject con
172. he print file produced by the compiler shows how the compiler uses FRAMEO1 To find the address of the FRAMEO1 variable examine the map file produced by RL196 If your C196 function calls or is called by an ASM196 you must know the possible differences in stack usage for local variables For example since the C196 compiler does not support nested function definitions it uses only one frame pointer The following example demonstrates the pseudo assembly listing generated by compiling a function that has three local variables declared as integers Since each integer occupies a word the frame size is 3 words or 6 bytes long The prolog of the called function uses a frame and frame pointer as follows sub SP f6 Allocates space for local variables of the called function push FRAMEO1 Saves the frame pointer of the calling function to allow for reentrancy ld FRAMEO1 SP Loads the stack pointer of the called function into the frame pointer Figure 10 5 contains the print file of a compiled program named exfrm in this example that uses a frame and frame pointer In this program the variables a b and c are represented as follows FRAMEO1 The old frame pointer saved on the stack 2 FRAMEO1 The local variable a 4 FRAMEO1 The local variable b 6 FRAMEO1 The local variable c 10 10 Chapter 10 The compiled program uses the frame pointer as follows sub SP 6H These first three
173. he tmpreg control 6 4 Chapter 6 7 Hexadecimal Address OFFH Register Variables 24H PLMREG Tempory Registers 1CH Frame Pointer 1AH Stack Pointer 18H Special Function Registers 00H SFRs OSD1054 Figure 6 1 SOC190KB register memory The 80C196 processors contain on chip peripherals listed in Table 6 1 controlled by the special function registers SFRs located in the first 24 18H bytes of the register file The C196 header files and libraries define symbols macros and functions to read and write the SFRs UO Function Description high speed input HSI Automatically records events records the line that had an event and the time when the event occurred high speed output HSO Automatically triggers events and real time interrupts sends messages to turn on turn off start processing or reset devices pulse width modulation PWM Outputs signals to drive motors or analog circuits replaces an analog output signal A to D converter Provides a 10 bit analog to digital converter that can use any one of eight input channels watchdog timer Resets the processor if not written to within the designated time Processor Registers 6 5 UO Function Description serial port Provides one synchronous mode with rates up to 1 5M baud or three asynchronous modes with rates up to 187 5K baud standard I O lines Provide interfaces to the external world w
174. he volatile modifier to prevent the compiler from optimizing any reference to a variable qo volatile a is aliasing x put a value in x x now has value 2 TROUBLI E at level 3 K b K R Compiler Controls 4 77 overlay Function Locates register symbols to absolute addresses in the overlay register segment Syntax pragma overlay vari addr value where vari is a valid symbol name addr is a valid absolute address value is a valid offset value Abbreviation OV Class General control Description Use this pragma control to locate one or more register symbols to absolute addresses and mark them as overlayable This control must follow the declaration of the symbols For example the following pragma control line locates both inti and long1 to address COH int inti long longl pragma overlay int1 0xC0 long1 0xC0 You can also use the define preprocessor directive to define the absolute address Then you can use the macro symbol as a base address and the and signs to indicate the offset For example assume the previous example but with a macro definition define WIN BASE 0xC0 int intl long longl pragma overlay int1 WIN_BASE long1 WIN_BASE 4 78 Chapter 4 This example has the same effect as the previous example If you are handling the WSR yourself you can use this control to arrange your data in a vertical window you should not use the windows contr
175. hen other special features are not needed Table 6 1 Major I O functions 6 2 ACCESSING SPECIAL FUNCTION REGISTERS The xx sfrs h header files declare variables that you can use to access the SFRs To manipulate the program status word PSW you must write an assembly language routine to get the value of the PSW In this example the register variable flags is the destination of the value Define flags as a register integer variable register int flags Using in line assembly code the assembly language source text must include the following instructions asm pushf push contents of PSW onto stack asm ld flags sp load PSW value from stack into flags asm popf and restore all flags Six functions in c96 1ib in the processor specific 1ib directory with their function prototypes in xx funcs h directly manipulate the processor hardware as follows enable enables interrupts disable disables interrupts enable ptsenables PTS interrupts disable pts disables PTS interrupts idle puts the processor into idle state 80C196 processor only powerdown puts the processor into power down state 80C196 processor only 7 Chapter 6 The Embedded Microcontrollers and Processors Handbook listed in Related Publications describes the processor idle and powerdown modes 6 3 TMPREGO The TMPREGO variable defined as a two long word variable in the c96 1ib library is used to hold the fo
176. here to install the software The default answer is usr local On certain sites you may want to select another location On some hosts the installation script asks if you want to install SW000098 the Flexible License Manager FLEXIm If you do not already have FLEXIm on your system you must install it otherwise the product will not work on those hosts See the Flexible License Manager FLEXIm appendix for more information If the script detects that the software has been installed before the following messages appear on the screen WARNING SWO06022 xxxx xxxx already installed Do you want to REINSTALL y n Answering n no to this question causes installation to abort and the following message being displayed Installation stopped on user request Answering y yes to this question causes installation to continue And the final message will be Installation of SW006022 xxxx xxxx completed Step 7 For tape install remove the temporary installation directory with the following commands cd tmp rm rf instdir 1 8 Chapter 1 7 Step 8 For hosts that need the FLEXIm license manager each user must define an environment variable LM LICENSE FILE to identify the location of the license data file If the license file is present on the hosts on which the installed product will be used you must set LM LICENSE FILE to the pathname of the license file if it differs from the default usr loc
177. ignment to const object Constants cannot be modified illegal break A break statement appears outside of any switch for do or while statement illegal character in header name hex_value hex An illegal character was found in the header name of an include lt gt preprocessor directive illegal constant expression The expression within an if or e1if is not built correctly illegal constant suffix The suffix of a number is not L or U in either uppercase or lowercase or a legal combination of the two illegal continue A continue statement appears but not within any for do or while statement illegal elif directive An elif directive is encountered after an else directive illegal else directive An else directive is encountered after an initial tel se directive illegal field size Legal field size is 1 to 16 bits for a named field illegal floating point constant in exponent A floating point exponent must be an integer 9 18 Chapter 9 illegal function declaration Internal error can be caused by an earlier syntax error illegal bex constant A hexadecimal constant contains non hexadecimal characters or is without a Ox or OX prefix illegal macro redefinition A macro can be redefined only if the body of the redefined macro is exactly the same as the body of the originally defined macro illegal syntax left parentbesis is expected The name of a macro that accepts argument
178. ignored for function This function has been specified in a ixedparams control or in a pragma directive line but its parameter list ends with comma and ellipsis for example func a b c The function uses the varparams calling convention function exits without returning a value Be sure to use a return statement when a function requires one 9 32 Chapter 9 illegal cbaracter bex value bex The character with the ASCII value hex value is not part of the C196 character set illegal escape sequence The sequence following the backslash is not a legal escape sequence The compiler ignores the backslash and prints the sequence illegal macro definition macro name An invalid macro was defined on the command line with the define control illegal syntax in a directive line newline expected A preprocessor directive line is not terminated with a new line character incomplete definition of name one element assumed No completing definition of name was found in the module For example somewhere in the program the following declaration exists int xyz l No size was declared inside the s or void xyz void Same The compiler issues the warning at the end of the file when it does not find another declaration of the array declaring its true size indirection to different types A pointer to one data type was used to reference a different data type invalid argument for control
179. igure 2 1 shows a development chart using the C196 compiler and other tools With the C196 compiler you can develop an application using the following techniques e Compile and test the application as separate modules specifying only one or some of the source files in each compilation Use the appropriate compiler controls and preprocessor directives to include source text from several files or from a set of alternative files in a single compilation e Call functions written in 80C196 assembly language or include in line source assembly language in your C program See Chapter 7 for further information on including assembly language code in a C program 2 4 Chapter 2 Create and Maintain Libraries with LIB196 Q Link Modules C il Together np Pre l and Assign ith Wie ud Absolute Source File Address with RL196 Text Editor Q Source o Code Convert to Hexadecimal with PROM loadable Code OSD238 Figure 2 1 80C196 application development process To create the source text use any editor that generates ASCII files Invoke the compiler to translate the source text into object code as shown in Chapter 3 You can also use several compiler controls to manipulate the output object file and the output print file These controls can help you debug your application by including information such as pseudo assembly language listings symbolic information line num
180. ile also provides both function like macros and function prototypes for some non ANSI character query and conversion functions Include ctype h if your program calls any of the following functions isascii tolower _toupper If you do not want to use the function like macros use the undef control to remove the macro definition and the compiler calls the actual function Examples The ctype h header file contains a function prototype for toupper and both a function prototype and a macro definition for isxdigit The following examples show the differences in the code generated by the compiler when you use the function prototype or the macro definition of isxdigit 1 The following source text uses the macro definition of isxdigit and is compiled with the 1istexpand control Libraries 8 11 pragma listexpand include ctype h int upcx unsigned char input Use the prototypes and macros in the if isxdigit input ctype h header return toupper input file return input The compiler generates the source file listing shown in Figure 8 1 C196 Compiler CYTPE X 01 29 99 11 29 19 Page 1 80C196 Compiler Vx y Rz SN C 1993 Tasking BV Compilation of module CTYPE X C 1980 1990 1992 1993 Intel Corporation Object module placed in CTYPE X obj Compiler invoked by c c196 bin C196 EXE CTYPE X c code Line Level Incl 1 pragma listexpand 2 include lt ctype h gt 3 int upcx unsigned char i
181. in the compiler invocation or in a pragma preprocessor directive preceding the first line of data definition or executable source text To override a pragma registers num specified in the source text specify registers with a different argument in the compiler invocation 4 96 7 is is Chapter 4 The overlay segment the compiler generates for the module is word aligned at least The compiler adds one more byte to the size of the overlay segment if it has an odd number of bytes If you specified a limit to the number of registers the module can use the compiler can use one more byte than what you have specified because of the additional byte The registers all control conflicts with the regconserve control The use of these two controls results in a fatal error because the compiler cannot both conserve registers and allocate all program variables to registers In conserving registers the compiler does not allocate non register variables to registers reentrant regconserve windows Compiler Controls 4 97 relocatabletemps Function Tells the compiler to produce external references to temporary register symbols Syntax relocatabletemps norelocatabletemps Abbreviation rt nort Class Primary control Default norelocatabletemps Description Use this control to tell the compiler to produce external references to temporary register symbols instead of absolute addresses Use the relocatab
182. include directive Included files can themselves include files The nesting level of the included file appears in the Level column of the source text listing When nolistinclude is in effect diagnostic messages for include files appear in the print file as follows e For files included with the include control diagnostic messages precede the first line of source text 4 55 4 56 Chapter 4 e For files included with the include preprocessor directive diagnostic messages appear on the lines immediately after the include directive If nolist notranslate or noprint is specified the print file is suppressed and listinclude has no effect The 1istinclude and nolistinclude controls affect only the subsequent source text and remain in effect until the compiler encounters the opposite control or the end of the source text You can specify these controls in the compiler invocation and in pragma preprocessor directives throughout the source text include print list translate Compiler Controls locate Function Locates symbols to absolute addresses Syntax pragma locate vari addr value where vari is a valid symbol name addr is a valid absolute address value is a valid offset value Abbreviation lo Class General control Description Use this pragma control to locate one or more symbols to absolute addresses Use this control only in a pragma preprocessor directive This control must foll
183. indow size This allocation scheme allows access to these variables without swapping the wsr 4 124 E Chapter 4 qo See Section 6 4 3 for more information on vertical windows If you specify the hold parameter the compiler produces the following WSR management code in the prolog ldbze Tmp0 WSR push TmpO andb WSR 80H to retain hlden in wsr orb WSR WSR Otherwise with the nohold parameter the following code is produced ldbze Tmp0 WSR push TmpO ldb WSR WSR The compiler produces the following code in the epilog with or without the hold parameter ldb WSR SP pop RO Your application must consist of several modules to take advantage of the vertical windowing feature You can then determine the register windowing requirement by adding the sum of the overlayable register bytes from the end of every print file See Section 6 4 2 for more information on how to calculate the number of register bytes needed by a module If your application only consists of one module your application does not use the extra register space since a module at most only uses 220 register bytes The windows control can only be used with processors that support vertical windows Otherwise the compiler generates a fatal error model reentrant regconserve registers Vertical Windowing in Section 6 4 3 Compiler Controls 4 125 wordalign Function Specifies that no longword alignment be done
184. ing See the book C A Reference Manual listed in Related Publications for more information on preprocessor directives 3 4 2 PRINT FILE The print file can contain source text and pseudo assembly code listings messages symbolic information and summary information about the compilation The compiler generates the print file by default Use the noprint control to suppress the print file The default name for the print file is the same as the primary source filename with the 1st extension substituted for the original extension as shown in Table 3 3 The compiler places the print file by default in the directory that contains the source file If a file with the same name already exists the compiler writes over it To override the defaults use the print control The following sections describe the print file generated by the compiling phase of the compiler The print file contains information about the source text read into the compiler and the object code generated by the compiler 3 4 2 1 PRINT FILE CONTENTS The print file contains the following sections Page header identifies the compiler shows the title of the print listing and gives the date and time of compilation Compilation heading identifies the host operating system the compiler version the object module name and the controls used in the invocation Source text listing lists the C program Remarks warnings and error messages generated by the compiler
185. ing a term The number of push statements depends upon the number of overlayable registers local register variables defined inside the function The compiler uses the symbol OVRBASE to keep track of the offset into the relocatable overlay segment created during compilation The RL196 linker locates this overlay segment during linkage The compiler pushes the 0VRBASE values onto the stack to preserve the overlayable registers so the function can use the same locations in the register memory even if the functions are active simultaneously The compiler includes the 0VRBASE variable in your output object file for example for the following code fool register char a b c a b cC The compiler produces the following code fool push OVRBASE push OVRBASE 2H ldb b c ldb a b pop 2OVRBASE 2H pop OVRBASE ret Language Implementation 10 13 10 2 5 INTERRUPT FUNCTIONS e A call to an interrupt function always results in more object code than a call to an equivalent non interrupt function First the compiler generates code to preserve the Program Status Word PSW Since all interrupt functions are assumed to be reentrant the compiler also generates code to save and restore registers used by the interrupt function In the prolog of the interrupt function the first instruction pushes the PSW onto the stack and clears the PSW This action sets the interrupt mask to zero and disables interrupts Code
186. ing to your specific needs and the environment under which your application executes For example if you do not need the initializations done in main you can substitute the long jump to _main with a long jump to main This will directly call your main routine 5 4 Chapter 5 The models NT and NP have their own specific startup files called nt_start 196 and np_start a96 respectively The comments in these files explain how to create the cstart ob3 file 5 2 CONTENTS OF MAIN C The module _main c contains the routine main This routine is used to initialize different variables before their first use The _main obj is included in both c96 1ib and c96fp lib The module _main c is provided in the src subdirectory of the 1ib directory Depending on your application the routine _main calls the following subroutines init serio Initialization routine to initialize the serial port This routine is only necessary if you use putch to write to the serial port or getch to read from the serial port If you use any third party vendors which include their own putch which do not use the serial port you will not need this call _imainQ Initialization routine for initialization of global variables This routine is not needed if you do not have any initialized global variables main The main routine from your application exit The ANSI C compatible exit routine This includes the support of atexit and closes
187. instructions set up the push FRAMEO1 Stack frame FRAMEO 1 is set up as ld FRAMEO1 SP ja pointer to local variables a b and c ld Tmp0 4 FRAMEO1 Load the contents of the variable b into a temporary register add Tmp0 6 2FRAMEO1 Add the variable c to the variable b which was stored in TMPO then store the sum in TMPO st Tmp0 2 FRAMEO1 Store the result of the addition into the variable a pop FRAMEO1 Restore the old frame pointer add SP 6H Free the local variable space on the stack ret Return to the calling procedure The epilog restores the previous value of the frame pointer and deallocates the space allocated for the frame on the stack Control then returns to the calling function with the stack as it was when the called function began execution The map file produced by RL196 lists the address of FRAMEO1 For example linking the exfrm obj object file with the following RL196 invocation produces the exfrm m96 map file rl196 cstart obj exfrm obj c96 lib to exfrm abs print exfrm m96 Figure 10 6 contains a section of the exfrm m96 map file The address of FRAMEO1 1AH in this example appears in the VALU E column beside the FRAMEO1 entry in the NAME column The local variables reside on the stack immediately following the top of the frame Language Implementation 10 11 C196 Compiler EXFRM 01 29 99 17 56 19 Page 1 80C196 Compiler Vx y
188. ion Object Primary nowindows nowd uses the vertical windows of the 80C196KC 80C196KR or 80C196NT Default nowindows wordalign wa Tells the compiler to align long Object Primary nowordalign nowa register objects on word boundaries rather than restricting them to longword boundaries Default nowordalign 3 9 3 10 Chapter 3 Control Abbr Description and Default Effect Usage xref xr Adds or suppresses the identifier Listing Primary noxref noxr cross reference listing in the print file content Default noxref The xref control overrides nosymbols zero zr Tells the compiler to zero uninitialized Object Primary nozero nozr variables in relocatable segments Default zero same as init Table 3 1 Compiler controls summary The following example compiles the primary source file serial c in the examples directory with the model kb optimize 0 and debug controls specified c196 examples serial c md kb ot 0 db You can eliminate repetitive typing of the invocation line by using mk196 batch files or command files See Section 3 5 for a complete explanation of automating compiler invocations 3 3 FILENAME CONVENTIONS We suggest to use the following filename extensions This naming convention is not required but it allows utilities like mk196 to execute so called suffix rules Note that all names and extensions are in lower case because on UN
189. ion in the preprint file The preprocessor substitutes the body of a macro everywhere a macro name appears in the subsequent source text To define a macro use the define control or the define preprocessor directive See the book C A Reference Manual listed in Related Publications for details on how to use the define preprocessor directive The C196 compiler provides several predefined macros for your convenience Table 3 4 shows these macros and their values Name Value LINE current source line number FILE current source filename DATE date of compilation TIME time of compilation STDC __ conformance to ANSI C 1 indicates conformance 16 BITS defined set to 1 when using a 16 bit model 24 BITS defined set to 1 when using a 24 bit model Chapter 3 Name Value ARCHITECTURE processor model compiler uses for object module See the model control C196 always set to 1 DEBUG level of debug and type information included in object code 0 if using the nodebug and notype controls 1 if using the nodebug and type controls 2 if using the debug and notype controls 3 if using the debug and type controls DIAGNOSTIC level of diagnostics reported 2 if only errors are reported 1 if warnings and errors are reported 0 if all diagnostics are reported FAR CODE operating mode for 24 bit model 1 if using the farcode con
190. ions clr clrb dec decb ext Shift Instructions norml shl shlb shll extb inc incb neg shr shra shrab Generic Brancb Instructions bbc bbs bit bnc bne bnh bnst bnv bnvt negb not notb Skip shral shrb shrl br bst bv bvt call dbnz dbnzw ebr The C196 compiler supports a pseudo instruction call register which implements the indirect call by means of a code sequence containing abr indirect instruction Zero operand Instructions clre clrvt di dpts ei Extended Instructions bmov bmovi epts nop popa popf pusha cmpl ebmovi pushf ret rst setc idlpd tijmp Chapter 7 7 5 UNSUPPORTED INSTRUCTIONS The following assembly instructions are not supported Non generic Branch Instructions djnz jgt jnvt djnzw jh jst ecall jle jv ejmp jit jvt jbc jnc lcall jbs jne l1jmp que jnh scall je jnst s jmp jge jnv Module level Directives end module public extrn Location Counter Control Directives cseg kseg oseg dseg org rseg Symbol Definition Directives equ set Code Definition Directives dcp der Storage Reservation Directives dsb dsl dsp dsr Conditional Assembly Directives if else dsw endif Assembly Code Instructions 7 9 Macro Support Directives endm irpc macro exitm local rept irp qb For more information on these instructions and directives see the 80C196 Assembler User s Guide listed in Relat
191. is unpredictable The two pointer arguments normally reference separate string buffers If the arguments point to the same location the udistr function overwrites the original C string with the new UDI string Returns The udistr function returns a pointer to the converted string This return value is the same as the value passed in via the udi ptr parameter 8 28 Chapter 8 7 8 4 DYNAMIC MEMORY ALLOCATION In order to use the library routines for dynamic memory allocation malloc realloc calloc and free it is necessary to reserve RAM space for the dynamic memory This RAM space called HEAP is reserved by the linker See the linker controls heap and ram on how to specify this HEAP space MESSAGES AND ERROR RECOVERY al TASKING uality Development Tools Worldwide Messages and Error Recovery 9 3 9 1 INTRODUCTION The C196 compiler can issue the following types of messages e Sign on and sign off messages discussed in Section 9 2 e Fatal errors discussed in Section 9 3 e Errors discussed in Section 9 4 e Warnings discussed in Section 9 5 e Remarks discussed in Section 9 6 All messages except fatal error messages are reported in the print file Fatal error messages appear on the screen the compiler aborts compilation and produces no object module Other errors do not abort compilation but no object module is produced Warnings and remarks usually provide informatio
192. isters registers Table 4 2 Allocation of non register variables to registers SN The registers all control conflicts with the regconserve control The use of these two controls results in a fatal error because the compiler cannot both conserve registers and allocate all program variables to registers In conserving registers the compiler does not allocate non register variables to registers d registers 4 94 Chapter 4 registers Function Allocates register space for variables Select the EDE C Compiler Options Options file menu item Enter the maximum number of bytes for registers in the Module limit for register memory field in the Object tab E registers num where num is a number from 0 to 220 or the keyword all Abbreviation rg Class Primary control Default registers 220 Description Use this control to limit the number of bytes of register memory the module can use 80C196 microcontrollers have 256 bytes of register space except for the 80C196KC that has an additional 256 bytes of registers and the 80C196KR and 80C196NT NP that have an additional 512 bytes of registers Compiler Controls 4 95 The argument to the registers control can be a number from 0 to 220 or the all keyword For example registers 145 limits the module being compiled to 145 bytes of register memory for register variables allocated in the register segment and the overlayable register
193. ive when WINDOWS is off The HOLD control can only be used when the compiler saves restores WSR in the function prolog epilog that is when the WINDOWS control is on illegal macro definition macro name An invalid macro was defined on the command line with the define control input pathname is missing A primary source file pathname was not specified in the compiler invocation insufficient memory for macro expansion An internal structure was exhausted during macro expansion Two causes of this error are the macro or the actual arguments are too complex or the macro s expansion is too deeply nested Also see the related error message macro expansion too nested internal limit exceeded block too large statement_number The block being processed exceeds the internal buffer size To resolve this error break the block into two functions or introduce a label 9 8 Chapter 9 internal limit exceeded call nesting too deep statement number Calls within an expression are nested more than the internal limit of 20 To resolve the problem split the expression such that call nesting does not exceed 20 internal limit exceeded expression too complex The compiler ran out of temporary working registers to allocate to a computation Use explicit variables to hold intermediate results internal limit exceeded program too complex The table of compiler generated labels was exhausted usually because the program flow is to
194. izes these precedences Control Abbr Description and Default Effect Usage abszero az Tells the compiler to zero uninitialized Object Primary noabszero noaz variables in absolute segments Default noabszero bmov bm Tells the compiler to use the bmov Object Primary nobmov nobm instruction to initialize or copy structures or array elements Default nobmov case cs Tells the compiler to work in a case Object Primary nocase nocs sensitive manner Default nocase ccb cc Specifies the initial CCB value Object Primary 3 6 Chapter 3 Control Abbr Description and Default Effect Usage code co Generates or suppresses pseudo Listing General nocode noco assembly code listing in the print file content Default nocode cond cd Includes or suppresses conditionally Listing General nocond nocd uncompiled source code in the print content file Default nocond debug db Includes or suppresses debug Object Primary nodebug nodb information in the object module Default nodebug define a df Defines an object like macro Source Invocation diagnostic a dn Specifies the level of diagnostic Listing Primary messages Default diagnostic level 1 content divmodopt dm Enables generation of efficient DIV Object Primary nodivmodopt nodm instruction Default nodivmodopt eject ej Inserts a form feed in the print file Listing General Can only b
195. k ko k o kk kk kk k k k kk kk ek ek ek ek f main initializes the system Ef and clears flags between interrupts KZ bZ DALL void main void ioportl 0 PA int mask 0x22 int pending 0 hso command 0x18 hso time timerl 64 enable while 1 Initialize A D convertor Enable software timer and A D conversion interrupt routine Clear any pending interrupts Give command to HSO Set HSO command to occur in 126 microsecs Enable interrupts Loop forever waiting for interrupt BRR IK IK Ck Ck kk ko kk kk kk ko ko kk kk ek o kk kk ke k ko kk kk kk ko kk kk kk ko IO k k kk k k k kk k I ek ek kk Figure 3 13 Digital signal filter preprint file continued 3 8 4 CHECKING SYNTAX AND SEMANTICS You can check your source text for syntax and semantic errors without generating an object file To generate a print file containing information about the compilation without generating any object code use the noobject control The same source text listed in the preprint file can be listed in the print file with additional diagnostic messages that result from the translation You can also generate a cross referenced symbol table to verify the symbols defined and referenced in the program 3 40 Chapter 3 To generate a print file containing a cross referenced symbol table such as the one shown in Figure 3 14 invoke the compiler as follows C
196. kk ke kk kk kk ko IO ek kk kk kk A ke IO kk kk f void analog conversion done void input ad_result_hi if ad_result_lo amp MSB amp amp ad result hi Full Scale input if ioport0 amp MSB Bypass filter if P0 7 is set ioportl input else word_value input K ioportl M ioportl byte_value BRR IK IK KKK RR IR IR RRR RI IO IR kk ke kk RI IO k k k k kk k k kk kk kk kk kk kkk f Figure 5 11 Digital filter source text interrupt routines in dsf c 3 32 Chapter 3 BRR kk Ck kk RK IK kk kk ke kk kk Ck kk kk kk ke IR OR RR kk kk o kk kk kk ko k k kk kk ek ek ek e ke f M main initializes the system and clears flags between interrupts j ey BRR kk ok ek Ck kk ke kk RI IIR RRR ke IIR IRI IO IR kk ke kk kk ke ke ke kk kk ek f main ioportl 0 Initialize A D converter int mask 0x22 Enable software timer and A D conversion gt interrupt routine ay int_pending 0 Clear any pending interrupts ez hso_command 0x18 Give command to HSO E hso time timerl 64 Set HSO command to occur in 126 microseconds enable Enable interrupts SI while 1 Loop forever waiting for interrupt ey BRR IK IK KK IK k e IR IR OR RIK RI IO IRR KI IO OR k k kk k k kk k ke k ek ek e ke f Figure 3 12 Digital filter source text main routine in dsf c 3 8 2 SETTING THE WINDOWS ENVIRONMENT The directory structure of this example is as follows
197. l t This is a note It gives you extra information XVI Manual Purpose and Structure A This is a warning Read the information carefully 92 This illustration indicates actions you can perform with the mouse g This illustration indicates keyboard input qo This illustration can be read as See also It contains a reference to another command option or section SOFTWARE INSTALLATION al TASKING uality Development Tools Worldwide Software Installation 1 3 1 1 INTRODUCTION This chapter describes how you can install the TASKING 80C196 C Compiler on Windows 95 NT and several UNIX hosts 1 2 INSTALLATION FOR WINDOWS Step 1 Start Windows 95 98 or NT if you have not already done so Step 2 Insert the CD ROM into the CD ROM drive If the Auto insert notification option is enabled for your CD ROM drive the TASKING Welcome dialog box appears Now skip to Step 5 Step 5 Select the Start button and select the Run menu item Step 4 On the command line type d setup substitute the correct drive letter if necessary and press the lt Return gt or lt Enter gt key or click on the OK button The TASKING Welcome dialog box appears Step 5 Select a product to install and click on Install a Product Step 6 Follow the instructions that appear on your screen AN You can find your serial number on the Certificate of Authenticity delivered with the product 1 4 7
198. lared function name A warning reports a suspicious condition that you might want to change A warning does not terminate the compilation process Warnings and remarks usually provide information and do not necessarily indicate a condition affecting the object module An error also does not terminate the compilation process but causes the compiler not to produce an object file A fatal error on the other hand terminates the compilation process immediately 4 20 Chapter 4 Use the different levels of the diagnostic control as follows dn 0 for the compiler to issue all remarks warnings and error messages dn 1 the default for the compiler to issue warnings and error messages but no remarks dn 2 for the compiler to issue only error messages The predefined macro DIAGNOSTIC has the value specified for the diagnostic control The compiler also reports the number of remark warning and error situations in the termination message according to the diagnostic level which also determines the compiler s exit status For example if the diagnostic level is 2 the compiler can issue only error messages and the exit status is zero if no errors occurred even if warning or remark situations occurred The diagnostic and termination messages usually appear in the print file If the print file is suppressed the messages appear on the console instead The diagnostic control affects the entire compilation You can specify this control
199. le register unsigned short timerl at OxOa r extern volatile register unsigned short timer2 at Ox0c r extern volatile register unsigned char baud rate at Ox0e w extern volatile register unsigned char ioport0 at 0Ox0e r extern volatile register unsigned char ioport1 at OxOf r w extern volatile register unsigned char ioport2 at Ox10 r w extern volatile register unsigned char sp con at Oxll w extern volatile register unsigned char sp stat at Oxllz x ey extern volatile register unsigned char ioc0 at 0x15 N extern volatile register unsigned char ios0 at Ox15 r xy extern volatile register unsigned char iocl at 0x16 w extern volatile register unsigned char losl at Oxl6 r y extern volatile register unsigned char pwm control at 0x17 w Figure 3 13 Digital signal filter preprint file Compiling and Linking 3 35 BRR kk ck kk RK IK kk kk ko kk kk oko kk kk ke IR ORR kk kk ke IO OR kk ko k k kk kk ke k kkk e ke f Additional SFRs of the 80C196KB ay BRR IR ok ek kk Ck IR k e e e IIR IRR RI IO IR k k kk k k kk k k kk IO kk kk kk kk kk I kk kk kkk f extern volatile register unsigned char ioc2 at Ox0b w extern volatile register unsigned char ipendl at Ox12 r w extern volatile register unsigned char imaskl at 0x13 r w extern volatile register unsigned char wsr at 0x14 r w extern volatile register unsigned char ios2
200. letemps control pragma to allow the placing of the temporary registers at a non standard location References to these registers will then be resolved by the linker The size of your object file can increase significantly when you use the control since there are a great many references to the temporary registers in the generated code Once resolved b the linker though your executable file should be the same size as it would be without this control If you use the tmpreg control in conjunction with the relocatabletemps control only the names of the temporary registers and frame pointer are changed and the names corresponding to the tmpreg argument will be generated as external references for resolution by the linker 4 98 Chapter 4 The argument to the tmpreg control must still give an address that is a multiple of four since the temporary registers must be longword aligned and the compiler will report an error if this requirement is not met in the tmpreg argument However when the relocatabletemps control is used the argument to the tmpreg control does not have to be accurate as it otherwise would qo tmpreg Compiler Controls 4 99 searchinclude Function Specifies or suppresses search paths for include files Select the EDE Directories menu item Add one or more directory paths to the Include Files Path field E searchinclude pathprefix nosearchinclude where pathprefixis a string o
201. llocated the same way previous versions of the compiler allocated data you may need to use the wordalign control The oldobject control is incompatible with 24 bit models qe inst model wordalign 4 70 Chapter 4 omf Function Specify OMF96 version Select the EDE C Compiler Options Project Options menu item Select an OMF96 Version radio button in the Object tab E omf num where num is a number representing the OMF96 version 0 OMF96 V2 0 1 OMF96 V3 0 2 OMF96 V3 2 default Abbreviation omf Class Primary control Default omf 2 Description Use this control to produce an object file compatible with a specific OMF96 version Specifying omf 0 is the same as specifying oldobject Example This invocation line tells the compiler to use the old OMF96 version V2 0 c196 filel c omf 0 qo oldobject model Compiler Controls 4 71 optimize Function Specifies the level of optimization Select the EDE C Compiler Options Project Options menu item Choose an Optimization level in the Optimization tab E optimize leve where level is 0 1 2 or 3 The values correspond to the levels of optimization 0 causes the least amount of optimization and 3 causes the most optimization Abbreviation ot Class Primary control Default optimize 1 Description Use this control to improve the space usage and execution efficiency o
202. llowing e Intermediate results during computation e Return values of typed non void functions The compiler assigns the name TMPREGO to the address 1CH in the register segment by default and gives TMPREGO a null attribute You can change the location of TMPREGO by using the tmpreg control as described in Chapter 4 The nu11 attribute allows any function to use TMPREGO without having to specify a data type as described in the 80C196 Assembler User s Guide listed in Related Publications If the compiler needs more than eight bytes of work registers this can only happen with 24 bit models it will use the next eight bytes normally at address 24H and assign the name TMPREG8 to them TMPREGO is declared in assembly language as follows public TMPREGO rseg at 1CH TMPREGO EQU dsl 2 end 6 4 REGISTER VARIABLES You can use the register attribute in a variable declaration to allocate a variable in register memory The compiler allocates automatic register variables in the overlayable register segment and allocates register variables with static duration in the register segment If the windows control is in effect the compiler also allocates static register variables in the overlayable register segment A register variable can be any data type and is read or written using 8 bit addressing instead of 16 bit addressing Processor Registers 6 7 6 4 4 USING THE EXTEND CONTROL If you
203. lopment Tools Worldwide Glossary B 3 aggregate data type Block of memory containing a group of values ANSI American National Standards Institute application The entire system designed by the user application program Software for the user s application argument Value or location passed to a function or macro asm196 80C196 assembler branch optimization Compiler process to combine consecutive or multiple branches into a single branch buffer Contiguous block of memory treated as a simple array or character string byte 8 bits calling convention Object code inserted by the compiler to handle function calls cleanup Code in the calling function that the processor executes just after control returns from the called function console The user s workstation C type string Null terminated string c196 80C196 C compiler dead code optimization Compile process that eliminates code that can never be executed B 4 Appendix B environment variable A variable set by the user to configure the host operating system epilog Code in the called function that the processor executes just before control returns to the calling function file level variable A variable defined outside of any function FPALO9G Floating point arithmetic library FPL Fixed parameter list calling convention frame A space in the stack allocated for a local variable frame pointer A relocatable word register t
204. m Assembly Code Instructions 7 5 See Section 7 4 for a complete list of supported assembly instructions and the 80C196 Assembler User s Guide listed in Related Publications for more information on labels and directives The following restrictions apply to the interpretation of the in line assembly instructions e You cannot define new symbols with in line assembly code e You must use C notation for non decimal numbers For example C notation for the hexadecimal value 10H is 0x10 or 0X10 Assembly notation equivalents 10H and 10h are invalid You can enter instruction mnemonics in uppercase or lowercase e You must specify the model control to allow the use of the processor specific instruction sets You cannot use numeric expressions Expressions must consist of simple numbers e For dcb dew and dc1 directives you can only specify one operand for each instruction e For generic conditional branch unconditional branch bit branch and iterative branch instructions the code address you specify for the branch must be a C label e For the generic call instruction the code address you specify for the call must be a C function name e To access a specific element of an array enclose the constant index in parentheses The compiler scales the index to produce the equivalent offset For example the following code shows how to load the fifth element of an array into a register const int a 10 2 3 5 7 11 13 17 19 2
205. me including host target processor and release number The exact command line that you used to invoke our tools when you encountered the problem Please include all switches The exact error message that was printed A screen dump will often make this easy to record and can provide very useful information Any additional information that may be useful in helping to define the problem Overview 27 2 3 SAMPLE SESSION The subdirectories of the examples directory contain demo programs for the 80C196 toolchain In order to debug your programs you will have to compile assemble link and locate them for debugging using the TASKING 80C196 tools You can do this with EDE the Embedded Development Environment which uses a project file and a makefile or you can call the makefile from the command line 2 3 1 USING EDE EDE stands for Embedded Development Environment and is the Windows oriented Integrated Development Environment you can use with your TASKING toolchain to design your application To use EDE on one of the demo programs in one of the subdirectories in the examples subdirectory of the 80C196 product tree follow the steps below This procedure is outlined as a guide for you to build your own executables for debugging How to Start EDE You can launch EDE by double clicking on the appropriate icon in the program group created by the installation program Or you can launch EDE by double clicking on the EDE short
206. mp control locate control relocatabletemps control TMPREGO 4 112 Chapter 4 translate Function Compiles or suppresses compilation after preprocessing Syntax translate notranslate Abbreviation t1 notl Class Invocation control Default translate Description Use this control to cause compilation to continue after preprocessing Use the notranslate control to cause compilation to cease after preprocessing Translation includes parsing the input checking for errors generating code and producing an object module The notranslate control suppresses the print and object files causing all object controls and all listing controls except for preprint to have no effect If notranslate is in effect preprocessing diagnostic messages appear at the console The translate and notranslate controls affect the entire compilation You can specify either of these controls in the compiler invocation object preprint Compiler Controls 4 113 type Function Generates or suppresses type information in the object module Select the EDE C Compiler Options Project Options menu item Enable or disable the Generate type information check box in the Debug tab mgl type notype Abbreviation ty noty Class Primary control Default type Description Use this control to include type information for public and external symbols in the object module Type informa
207. n and do not necessarily indicate a condition affecting the object module Messages relating to syntax and most messages relating to semantics are interspersed in the listing at the point of error Some messages relating to semantics appear at the end of the source text listing and refer to the statement number on which the error occurred 9 2 SIGN ON AND SIGN OFF MESSAGES The compiler writes information to the screen at the beginning and the end of compilation On invocation the compiler displays the following message 80C196 C compiler vx y rz SN00000000 004 c years TASKING Inc C years Intel Corporation where VX y identifies the version of the compiler rz identifies the revision of the compiler years identifies the copyright years On normal completion the compiler displays a message similar to the following C196 Compilation Complete x Remark s y Warning s z Error s 9 4 Chapter 9 where x indicates the number of remarks that the compiler generated y indicates the number of warning messages that the compiler generated z indicates the number of non fatal errors that the compiler generated You can use compiler controls to specify the contents of this message as follows diagnostic 0 displays the entire message diagnostic 1 suppresses the number of remarks diagnostic 2 suppresses the numbers of remarks and warnings notranslate suppresses the Compilation Complete The defaults of these cont
208. nd calling conventions when linking modules written in other languages for the 80C196 processor with C196 modules It also describes C196 conformance to ANSI C and explains how C196 implements some characteristics of the C language 10 1 DATA REPRESENTATION A large application can consist of many separate modules Linking combines the modules before execution to satisfy references to external symbols Although other modules can be written in PL M 96 ASM196 or an older version of Intel C Compiler for the MCS 96 processor variables referenced by external symbols must be represented in memory in a format compatible with C196 data type representations as described in this chapter 10 1 1 DATA TYPES The C196 compiler supports all ANSI data types except wide characters C A Reference Manual listed in Related Publications describes the ANSI data types Floating point data types in C196 are always 32 bits Table 10 1 shows the scalar data types for the 80C196 processor the amount of memory occupied by the data type the arithmetic format and the range of accepted values Data Type Sizein Format Range Bytes char 1 integer or two s 0 to 255 unsigned char or complement integer 128 to 127 signed char unsigned char 1 integer 0 to 255 signed char 1 two s complement integer 128 to 127 unsigned int 2 integer 0 to 65 535 int 2 two s complement integer 32 768 to 32 767 unsigned short sam
209. ne of data definition or executable source text To override a pragma symbols or pragma nosymbols specified in the source text specify the opposite control nosymbols or symbols respectively in the compiler invocation qo print translate xref 4 106 Chapter 4 tabwidth Function Specifies the number of characters per tab stop in the print file Syntax tabwidth width where width is a value from 1 to 80 This value is the number of characters from tab stop to tab stop in the print file Abbreviation tw Class Primary control Default tabwidth 4 Description Use this control to specify the number of characters between tab stops in the print file The noprint and notranslate controls suppress the print file causing the tabwidth control to have no effect The tabwidth control affects the entire source text You can specify this control in the compiler invocation or in a pragma preprocessor directive preceding the first line of data definition or executable source text To override a pragma tabwidth width specified in the source text specify tabwidth with a different width in the compiler invocation pagelength title pagewidth translate print Compiler Controls 4 107 title Function Specifies the print file title Select the EDE C Compiler Options Project Options menu item Enter the title in the Title of listing file field in the Listing tab mgl title string
210. nfigure the object code for type checking and symbolic debugging and you can list the generated code in a format similar to ASM196 source text in the print file By default the compiler puts symbolic information for type checking in the object code The debug control generates additional symbolic information for symbolic debugging by in circuit emulators A useful feature of symbolic debuggers is the ability to list the line of source text corresponding to the instruction being executed However the optimization that occurs at optimization levels 2 and 3 can rearrange or eliminate code resulting from specific source statements To ensure that the debugger correctly matches the source text and object code use the optimize 0 control The code control generates the pseudo assembly language code listing Figure 3 15 contains the code listing generated by the following compiler invocation C c196 dsf c debug code optimize 0 C196 Compiler DSF 01 29 99 15 14 37 Page 13 Assembly Listing of Object Code cseg Statement 16 0000 software timer 0000 F4 pusha Statement 17 0001 B10800 E ldb ad command 8 Statement 18 0004 B11800 E ldb hso command 18H Statement 19 0007 4540000000 E add hso time timerl 440H Statement 20 000C F5 popa 000D FO ret Statement 32 000E analog_conversion_done 000E F4 pusha 000F C81C push TmpO 0011 C81E push Tmp2 Statement 33 0013 BO0002 E ldb input ad result hi Statement 34 0016 5180001C
211. ng xref to have no effect If the print file is produced specifying xref generates a cross referenced symbol table even if nosymbols is specified Compiler Controls 4 127 The xref and noxref controls affect the entire source text You can specify either of these controls in the compiler invocation or in a pragma preprocessor directive preceding the first line of data definition or executable source text To override a pragma xref or pragma noxref specified in the source text specify the opposite control noxref or xref respectively in the compiler invocation qo print symbols translate 4 128 Chapter 4 S zero Function Specifies whether the compiler zeroes uninitialized variables in relocatable data segments Select the EDE C Compiler Options Project Options menu item Enable or disable the Clear unititialized RAM variables in relocatable segments check box in the Code tab ess zero nozero Abbreviation zr nozr Class Primary control Default zero Description Use the zero control to allow the compiler to zero uninitialized variables in relocatable segments The default setting matches the setting of the init control This control is only valid for the default OMF version 3 2 At startup reset library module cstart processes the initialization table it copies the initial constant data to the corresponding variables and zeroes the uninitialized variables Use the noz
212. nnot find its own DAEMON name in the license file Flexible License Manager FLEXIm A 23 4 3 DAEMON SOFTWARE ERROR MESSAGES accept message An error was detected in the accept system call ATTEMPT TO START VENDOR DAEMON xxx witb NO MASTER A vendor daemon was started with no master selected This is an internal consistency error in the daemons BAD PID message from nm pid xxx msg A top level vendor daemon received an invalid PID message from one of its children daemon number xxx BAD SCONNECT message message An invalid server connect message was received Cannot create pipes for server communication The pipe call failed Can t allocate server table space A malloc error Check swap space Connection to node TIMED OUT The daemon could not connect to node Error sending PID to master server The vendor server could not send its PID to the top level server in the hierarchy Illegal connection request to DAEMON A connection request was made to DAEMON but this vendor daemon is not DAEMON Illegal server connection request A connection request came in from another server without a DAEMON name KILL of child failed errno nnn A daemon could not kill its child A 24 Appendix A No internet port number specified A vendor daemon was started without an internet port Not enough descriptors to re create pipes The top level daemon detected one of its sub daemon s
213. nput 4 5 1 if isxdigit input if unsigned input lt 0x80 _ctype_ input amp 0x40 0 6 1 return toupper input 7 1 return input 8 1 Figure 8 1 Example using the macro definition 2 The following source text undefines the macro definition of isxdigit and is compiled with the 1istexpand control pragma listexpand include ctype h fundef isxdigit Undefine the XI macro definition Use the function definition int upcx unsigned char input if isxdigit input return toupper input return input 8 12 Chapter 8 The compiler generates a source text listing shown in Figure 8 2 C196 Compiler CTYPE XU 01 29 99 12 41 49 Page 1 80C196 Compiler Vx y Rz SN C 1993 Tasking BV Compilation of module CTYPE XU C 1980 1990 1992 1993 Intel Corporation Object module placed in CTYPE XU obj Compiler invoked by c c196 bin C196 EXE CTYPE XU c code Line Level Incl d pragma listexpand 2 include lt ctype h gt 3 undef isxdigit 4 5 6 7 int upcx unsigned char input 8 9 T if isxdigit input 10 1 return toupper input 1 11 1 return input 12 1 Figure 8 2 Example using the function prototype Libraries 8 13 string h Function Character array manipulation ANSI Description The ANSI contents of string h are described in C A Reference Manual listed in Related Publications In addition string h defines the following non A
214. ns e expands macros by substituting the body or textual value of each macro for each occurrence of its name e inserts source text from files specified with the include compiler invocation control or the include preprocessor directive and inserts the 1ine preprocessor directive to bracket sections of included source text in the preprint file Compiling and Linking 3 13 e eliminates parts of the source text based on the if ifdef fifndef telse elif and tendit conditional compilation directives e propagates the preprocessor directives line terror and pragma from the source text to the preprocessed source text The preprint file contains the preprocessed source text after all of these operations are completed The preprint file is especially useful for observing the results of these operations Compiling the preprint file produces the same results as compiling the source file The compiler generates a preprint file only when the preprint or notranslate control is in effect The default name for the preprint file is the same as the primary source filename with the i extension substituted for the original extension as shown in Table 3 3 The compiler places the preprint file by default in the same directory that contains the source file To override the defaults use the preprint control Ifa file with the same name already exists the compiler writes over it 3 4 1 1 MACROS You can see the results of macro expans
215. nt file C196 Compiler CTYPE Figure 5 2 Print file page beader 01 29 99 14 26 30 Page 1 3 18 Chapter 3 7 3 4 2 3 COMPILATION HEADING The compilation heading is on the first page of the print file The compilation heading gives the name of the object module the pathname of the object module file and the compiler controls specified in the compiler invocation The heading also identifies the compiler version and host system Figure 3 3 shows a compilation heading produced by the C196 compiler running on Windows 95 80C196 C compiler vx y rz SN00000000 004 c year TASKING Inc Object module placed in ctype obj Compiler invoked by c c196 bin cl196 exe ctype c sb co le lc xr Figure 5 3 Print file compilation beading 3 4 2 4 SOURCE TEXT LISTING The source text listing contains a formatted image of the source text as shown in Figure 3 4 This listing also gives the line number block nesting level and include nesting level of each statement in the source text If a source line is too long to fit on one line it continues on as many following lines as are needed Continued lines start with a hyphen Line Level Incl return input 1 include lt ctype h gt 1 ctype h 58 59 endif _ctypeh 2 3 unsigned char upcx unsigned char input 4 L 5 if isascii input amp amp input a amp amp input f if unsigned input lt 0x80 amp amp input gt a amp amp input l
216. nter e A left operand of a compound assignment operator for example counter 100 The compiler does not perform any optimization on objects declared as volatile 10 4 9 EXTENDED ADDRESSING The compiler treats alike all processor models that provide more than 16 address bits This family of processors is known as 24 bit models Code compiled for 2 bit model processors allows for the extra address bits by means of a 32 bit pointer Language Implementation 10 21 When both the extend control and a 24 bit model control for example model nt are in effect the language is extended by the far and near type qualifier keywords You use far and near just like the const and volatile type qualifiers 10 4 9 1 FAR AND NEAR DATA Far data can be located anywhere within the entire extended address space of the processor Near data must reside in the lower 64K because it is accessed with 16 bit addressing You may use a fardata ora neardata control to set the default for non constant non register data You can override the default by using the far or near type qualifiers in your declarations Any pointer that points to a far data object will be 32 bits wide An example of a declaration for such a pointer is far int near_ptr_to_far_int The pointer itself can be a far object It can even point to a near object Assuming the neardata control the default is in effect here are some other ways you could declare a poin
217. nterval Use the specified license Hie If no c option is specified Imgrd looks for the environment variable LM LICENSE FILE in order to find the license file to use If that environment variable is not set Imgrd looks for the file usr local flexlm licenses license dat Specifies the output log file to use Instead of using the 1 option you can use output redirection gt or gt gt to specify the name of the output log file Specifies the timeout interval in seconds during which the license daemon must complete its connection to other daemons if operating in multi server mode The default value is 10 seconds A larger value may be desirable if the daemons are being run on busy systems or a very heavily loaded network Specifies the log file timestamp interval in minutes The default is 360 minutes This means that every six hours Imgrd logs the time in the log file Imdown 1 Imstat 1 Flexible License Manager FLEXIm A 13 Imhostid 1 Name Imhostid report the hostid of a system Synopsis Imhostid Description Imhostid calls the FLEXIm version of gethostid and displays the results The output of Imhostid looks like this lmhostid Copyright C 1989 1990 Highland Software Inc The FLEX1m host ID of this machine is 1200abcd Options Imhostid has no command line options A 14 Appendix A Imremover 1 Name Imremove remove specific licenses and return them to license p
218. o complex Reduce the complexity or break down the module internal limit exceeded stack too deep statement number The stack requirement of the function exceeded the internal limit of 128 bytes This error can be caused by an expression that is too complex or a large structure or union that appears as an argument to a call internal limit exceeded statement too complex statement number The statement being processed is too complex and exceeded the internal buffer size Split the statement into less complex statements invalid argument for control control The argument specified for control is not valid for example the argument specified for model is invalid invalid control control A control not supported by the compiler was specified Check the spelling of the control An invalid control is a fatal error if it occurs in the compiler invocation but the preprocessor only issues a warning if the invalid control occurs in a pragma directive invalid decimal argument value Non decimal characters were found in an argument that must be a decimal value An improper argument is a fatal error if it occurs in the compiler invocation but the preprocessor only issues a warning if the improper argument occurs in a pragma directive line Messages and Error Recovery 9 9 invalid identifier identifier An identifier does not follow the rules for forming identifiers in C An invalid identifier is a fatal error if it occurs in the
219. o list uncompiled conditional code If nolist notranslate or noprint is specified the print file is suppressed and 1istexpand has no effect If nolistinclude is in effect listing of include files is suppressed and listexpand has no effect on the included source text 4 54 Chapter 4 The 1istexpand and nolistexpand controls affect only the subsequent source text and remain in effect until the compiler encounters the opposite control or the end of the source text You can specify these controls in the compiler invocation and in pragma preprocessor directives throughout the source text q cond print list translate listinclude Compiler Controls listinclude Function Includes or suppresses text from include files in listing Select the EDE C Compiler Options Project Options menu item Enable or disable the Add text from include files check box in the Listing tab ss listinclude nolistinclude Abbreviation lc nole Class General control Default nolistinclude Description Use this control to list the text of include files in the source text listing in the print file Use the default nolistinclude control to suppress the listing of include files The compiler lists files included with the include control in the order they are specified before the first line of source listing and lists the text of files included with the include preprocessor directive after the line with the f
220. obj program modules user defined libraries if any the floating point C library file containg math functions and floating point versions of printf and scanf if you are performing floating point formatted input and output c96fp lib the C library file choose the library file according to the model and the execution mode c96 1ib the FPAL96 floating point library if you are using floating point functions choose the library files according to the model and the execution mode fpal96 1ib If an object file or library is specified with a relative pathname or without any path then RL196 will search through a list of directories to find the file See the description of RL196 in the 80C196 Utilities User s Guide Libraries 8 7 8 2 HEADER FILES You can write your own external declaration for any library function or variable but doing so does not guarantee an exact match The supplied header files contain C196 source text to declare the library function prototypes and macros The function declarations in the C196 header files are prototyped to ensure an appropriate match between definition and use of the functions Use the include preprocessor directive to include a header file Some functions declared with prototypes in the header files are also defined as macros in the same header files To use the library function rather than the macro simply use undef to remove the macro definition before specifying the f
221. of register memory that is 19 of the maximum 220 bytes allowed by the processor If a different module is already located in that part of register memory the module in Figure 6 2 occupies the same number of bytes 19 but in different locations The registers used by any given module are not necessarily contiguous 6 4 3 SUPPORT FOR VERTICAL WINDOWS Many of the 80C196 processors have 256 bytes of additional registers or more Register windowing enables the compiler to access the additional registers using the 8 bit direct addressing mode instead of the 16 bit addressing mode This 8 bit addressing mode results in faster and tighter code generation The available two types of windows are Horizontal Windows HWindows and Vertical Windows VWindows This section focuses on Vertical Windows See the Embedded Microcontrollers and Processors Handbook listed in Related Publications for more information on register windowing Processor Registers 6 11 The 80C196 processor family provides vertical windowing so that you can use the additional bytes of RAM as general purpose registers using the 8 bit direct addressing mode VWindows differ from HWindows in that you can still access these registers through 16 bit addressing using indexed or indirect addressing mode since VWindows reside in the same address space You can use VWindows to map sections of the register file as 32 64 or 128 byte windows onto the top 32 64 or 128 byte portion
222. ogram The string information attempts to identify the error more precisely too many parameters for one function The number of arguments specified for one function has exceeded the compiler limit too many parameters for one macro The number of arguments specified for one macro has exceeded the compiler limit too many characters in a character constant A character constant can include one to two characters The effect of this error on the object code is that the character constant value remains undefined too many functions The number of functions declared has exceeded the compiler limit too many initializers An array is initialized with more items than the number of elements specified in the array definition too many macro arguments The number of arguments specified for a macro has exceeded the compiler limit too many nested struct unions The lexical nesting of struct and union member lists has exceeded the compiler limit too many public register variables The number of public variables explicitly declared as register variables is greater than the number of register locations available to the module too many register variables The number of variables explicitly declared as register variables is greater than the number of register locations available to the module Messages and Error Recovery 9 27 unable to recover from syntax error An unrecoverable syntax error has occurred Check the list file to s
223. oj001 proj001 headers UNIX setenv C196INC proj001 proj001 headers The searchinclude control is specified in the compiler invocation as follows searchinclude proj001 test h generic stubs The source text contains the following preprocessor directive include t locate h The source file is in the directory proj001 src for PC proj001 src for UNIX The compiler is invoked in the root directory and executed from usr local ci96 bin The compiler searches for filenames in the following order UNIX notation is used The source directory proj001 src t locate h From the searchinclude control proj001 test h t locate h From the searchinclude control generic stubs t locate h From C196INC proj001 t locate h From C196INC proj001 headers t locate h From the relative path usr local cl196 include t_locate h The current directory t_locate h qe include 4 102 Chapter 4 signedchar Function Sign extends or zero extends promoted chars Select the EDE C Compiler Options Project Options menu item Enable or disable the Treat char variables as unsigned check box in the Language tab mgl signedchar nosignedchar Abbreviation sc nosc Class Primary control Default signedchar Description Use this control to specify that objects declared to be the char data type are treated as if declared to be the signed char data type The compiler sign extends these objects when th
224. ol Since the specified symbols are marked overlayable the linker will not issue warnings about more than one of these symbols overlapping You must still allocate space under a different name for the windowed data and locate it with the Locate control Only register variables can be located with this control locate windows Compiler Controls 4 79 pagelength Function Specifies lines per page in the print file EDE C Compiler Options Project Options menu item Enter the page length in the Page length lines per page field in the Listing tab mgl pagelength lines where lines is the length of a page in lines This value can range from 10 to 32767 Abbreviation pl Class Primary control Default pagelength 60 Description Use this control to specify the maximum number of lines printed on a page of the print file before a form feed is printed The number of lines on a page includes the page headings The noprint and notranslate controls suppress the print file causing the pagel ength control to have no effect The pagelength control affects the entire print file You can specify this control in preceding override a specify pa the compiler invocation or in a pragma preprocessor directive the first line of data definition or executable source text To pragma pagelength lines specified in the source text gelength with a different lines in the compile
225. ols Worldwide Table of Contents SOFTWARE INSTALLATION 1 1 1 1 Introduction 32er ERE Ret rbd 1 3 1 2 Installation for Windows 00 0020 cece 1 3 1 2 1 Setting the Environment sse eese 1 4 13 Installation for UNIX Hosts 00 00 0000 bees 1 6 1 3 1 Setting the Environment 00 00 0000 ariya 1 9 OVERVIEW 2 1 2 1 C196 and the Software Development Process 2 3 2 2 Customer SUDDOELU ci gna esa cse e EUER RR CR RC 2 5 2 2 1 If You Have a Problem Using the Software 2 6 2 3 Sample Session sepya RRR Geek Pe boa YER had RS 2 7 2 3 1 Using EDE i es eene dei ane dew eee e 2 7 2 3 2 Using the Makefile cse riirii ie eiie eiai ieia i 2 13 COMPILING AND LINKING 3 1 34 Introducti n i e Re pe ERR RP AER RE 2 5 3 2 Compiler Invocation Syntax isis eee eae 3 3 3 2 1 How Controls Affect the Compilation 3 3 3 2 2 Where to Specify Controls 3 4 3 3 Filename Conventions sisse seen 3 10 3 4 Output Piles 455p dia Re RA arene Yee s 3 11 3 41 Preprint Elles xo ae ROSE aes Gah a oe od APR 3 12 3 4 1 1 IMA CTOS PCT 3 13 3 4 1 2 Include BSR a ods TE R AE AN AE TATE NR RR APER 3 15 3 4 1 3 Conditional Compilation see s sera ea ARN EE eee 3 15 3 4 1 4 Propagated Directives casa sakean eiee ya i 3 16 3 4 2 Pint Pile 2 5 3 EASY eth eich y web e VEN 3 16 3 4 2 1 Print File Contents ir ersero carer irera aeiae 3 16 3 4 2 2 Page Headers xir RE Z bed bad Gus Rar a 3
226. on contains a machine instruction mnemonic code It names the instruction to be executed operand specifies a register or value on which the operation is to be performed See the 80C196 Assembler User s Guide listed in Related Publications for more information on assembly source program statement format The operand or operands of the operation can reference C variables constants and labels You can use register variables wherever a register is a legal operand The compiler interprets the pseudo assembly instruction replacing the C identifiers as necessary with assembly language equivalents and translates the instruction into object code The compiler also performs dead code elimination branch and peephole optimizations Only machine instructions and the dcb dew and del code definition directives are supported See Section 7 3 for information on defining constant tables The following types of instructions are not currently supported by the compiler Labels e Assembly directives Module level directives such as module and public Location counter control directives such as cseg and rseg Symbol definition directives such as set and equ Code definition directives other than dcb dcw and dc1 such as dcr and dcp Storage definition directives such as dsb dsw dsl and dsr Conditional assembly directives such as if else and endif Macro support directives such as macro local rept and exit
227. on in the EDE CPU Model menu item esse fardata Abbreviation fd Class Primary control Default neardata Description Use this control to allow non register non constant data to be placed anywhere in the 24 bit extended address space of the 24 bit processors This control causes the compiler to place in the fardata segment of the object module all user defined variable data that has not been assigned to registers and that you have not qualified with the near keyword The generated code will use extended addressing to access these objects When you link your program module s with RL196 you can locate the fardata segment anywhere you have RAM The fardata control can only be used with 24 bit models qe farcode farconst model nearcode nearconst neardata Compiler Controls 4 31 fastinterrupt Function Specifies whether the compiler saves temporary registers on entering the interrupt routine Select the EDE C Compiler Options Project Options menu item Enable or disable the Fast interrupt code do not save temporary registers check box in the Object tab ess fastinterrupt nofastinterrupt Abbreviation fi nofi Class Primary control Default nofastinterrupt Description Use this control to prevent the C196 compiler from saving temporary registers on entering the interrupt rountine This results in faster execution of the interrupt qe generatevector
228. ons You can compile and debug application modules separately then link them together to create an executable file Use the RL196 linker and locator utility to combine separately translated object modules into a single program and assign absolute addresses to all relocatable addresses Use the LIB196 utility to place an object module into a library for later combination using RL196 into a program Use the OH196 utility to convert an object module into the standard hexadecimal format that can be loaded into PROM Your C196 application programs can contain many separately translated modules The applications can call functions from a library The C196 product includes several libraries You can also create your own libraries using the LIB196 utility To create a complete program the RL196 utility must link all translated code and libraries together Selecting the correct libraries for linking depends on whether the program does any of the following e uses floating point numbers 3 26 Chapter 3 uses either the printf or the sprintf function to write floating point formatted output e uses either the scanf or the sscanf function to read floating point formatted input uses the model nt or farcode controls Figure 3 9 shows how to specify libraries and object files in the correct order for linking with C196 compiled modules The following is an example RL196 invocation r1196 cstart obj newmod obj my utils lib c96fp lib
229. ontrols are only available for those models which support the piha and pihb interrupt blocks Use these pragma controls combined with the 1ocate pragma control to load the peripheral transaction server PTS vectors with the addresses of the PTS control blocks You must use the 1ocate pragma control to locate the PTS control blocks in internal RAM space 1AH 1FFH at an address evenly divisible by eight 8 The xx funcs h header files where xx is one of the processor models for example kc funcs h contain type definitions for the various PTS control blocks qo interrupt locate pts 4 90 Chapter 4 reentrant Function Specifies attributes for called functions Syntax reentrant function noreentrant where function is the name of a function declared in the source text Abbreviation re nore Class General control Default reentrant Description Use this control to define functions in the module as reentrant A reentrant function can call itself or be called again through a call loop so the function is activated more than once simultaneously When the reentrant control is in effect the compiler generates additional code in a function s prolog and epilog to save and restore registers modified by the function Since registers are preserved functions can reuse the same locations in register memory even if multiple instances of the functions are active simultaneously Specifying the reentran
230. ontrols in the compiler invocation or in a pragma preprocessor directive preceding the first line of data definition or executable source text To override a pragma print or pragma noprint in the source text specify the opposite control noprint or print respectively in the compiler invocation code listinclude title cond pagelength translate diagnostic pagewidth xref list symbols listexpand tabwidth Compiler Controls 4 87 pts Function Loads a PTS vector with the address of a PTS control block Syntax pragma pts struct name vector where struct name is a name assigned to the control block vector is an interrupt vector number or an interrupt vector address Abbreviation pt Class General control Description Use this pragma control combined with the 1ocate pragma control to load the peripheral transaction server PTS vectors with the addresses of the PTS control blocks You must use the 1ocate pragma control to locate the PTS control blocks in internal RAM space 1AH 1FFH at an address evenly divisible by eight 8 The xx funcs h header files where xx is one of the processor models for example kc funcs h contain type definitions for the various PTS control blocks Example The following example demonstrates the use of the pts pragma control pragma model kc include stdio h include SFR H include _FUNCS_H_ STran_ptscb single pragma locate single 0x50 Address divisible by
231. ool Synopsis Imremove c icense_file feature user host display Description Imremove allows the system administrator to remove a single user s license for a specified feature This could be required in the case where the licensed user was running the software on a node that subsequently crashed This situation will sometimes cause the license to remain unusable Imremove will allow the license to return to the pool of available licenses Options c license file Use the specified license file If no c option is specified Imremove looks for the environment variable LM LICENSE FILE in order to find the license file to use If that environment variable is not set Imremove looks for the file usr local flexlm licenses license dat qb Imstat 1 Flexible License Manager FLEXIm A 15 Imreread 1 Name Imreread tells the license daemon to reread the license file Synopsis Imreread c icense file Description Imreread allows the system administrator to tell the license daemon to reread the license file This can be useful if the data in the license file has changed the new data can be loaded into the license daemon without shutting down and restarting it Imreread uses the license file from the command line or the default file if none specified only to find the license daemon to send it the command to reread the license file The license daemon will always reread the file that it loaded
232. or 80C196NP NU respecively running code compiled with the farcode control in effect They use only far code linkage and all data pointers are 16 bits wide and all const pointers are 32 bits wide The objects and libraries in the subdirectories nt cnf and np_cnf of the lib directory are suitable only for use with the 80C196NT CB EA EC or 80C196NP NU respecively running code compiled with the nearcode control in effect They use only near code linkage but all data pointers are 16 bits wide and all const pointers are 32 bits wide The objects and libraries in the subdirectory nt_enf and np enf of the lib directory are suitable only for use with the 80C196NT CB EA EC or 80C196NP NU respecively running code compiled with the farcode control in effect They use only far code linkage and all data pointers are 16 bits wide The objects and libraries in the subdirectory nt cf and np cf of the lib directory are suitable only for use with the 80C196NT CB EA EC or 80C196NP NU respecively running code compiled with the nearcode control in effect They use only near code linkage but all data pointers are 32 bits wide The objects and libraries in the subdirectory nt ef and np ef of the lib directory are suitable only for use with the 80C196NT CB EA EC or 80C196NP NU respecively running code compiled with the farcode control in effect They use only far code linkage and all data pointers are 32 bits wide The objects and libraries in the oth
233. or can also occur if you accessed the address of the register variable with the ampersand amp address operator in a C statement then used the variable as a register operand in an in line code assembly statement For example the following in line assembly code statement generates the error register int a int p p amp a asm ld a 0AH This statement generates the error invalid recursive call to nonreentrant function You cannot recall a nonreentrant function within itself or call it again through a call loop so that the function is activated more than once simultaneously Make sure that the reentrant control is in effect or precede the function name with the reentrant keyword invalid storage class The storage class is invalid for the object declared for example a module level object cannot be auto or register however the register storage class is valid if the extend compiler control is in effect invalid storage class combination You cannot have more than one storage class specifier in a declaration with noextend in effect With extend in effect you can specify extern register static register and in block scope auto register storage classes invalid structure reference The left operand of a operator is not a structure or a union or the left operand of a gt operator is not a pointer to a structure or a pointer to a union This error message also occurs if an assignment is made from one structure to an
234. or interrupt control or the function identifier has been previously used defined or declared invalid cast The following are examples of invalid casts e casting to or from struct or union e casting a void expression to any type other than void invalid dereference A dereference the operator is applied to an expression other than a pointer invalid field definition A field definition appears outside a structure definition or is attached to an invalid type invalid function reference address of assumed An expression that evaluates to a function reference was used in any context other than call For example b where b is a pointer to a function generates this error invalid index The identifier specified with an index register is not a file scope aggregate object array structure union invalid interrupt bandler Since interrupt handlers take no arguments and return no value they must be declared as void irf void where irf is the name of the interrupt function invalid label The destination code address of the instruction must be a C label Messages and Error Recovery 9 21 invalid member name The member name that is the right operand of a or gt operator is not a member of the corresponding structure or union invalid number of arguments The number of arguments passed to a function does not match the number of parameters defined in the prototype of that function invalid number of operands
235. ot specified The far qualifier is valid only for 24 bit models Add a 24 bit model control or remove the offending qualifier Messages and Error Recovery 9 31 FARCODE conflicts with NEARCODE These two controls determine the segment into which all code is generated They are mutually exclusive but both controls were explicitly specified Eliminate the one you don t want FARCODE control invalid for tbe component The farcode control is valid only for 24 bit models Add a 24 bit model control or remove the offending control FARDATA conflicts with NEARDATA These two controls determine the default location of non constant non register data They are are mutually exclusive but both controls were explicitly specified Eliminate the one you don t want FARDATA control invalid for tbe component The fardata control is valid only for 24 bit models Add a 24 bit model control or remove the offending control filename too long truncated The filename length exceeded the limit of the operating system fixedparams attribute ignored for function The fixedparams control was specified for the function or the function was declared with the alien keyword but the prototype contained the r construct The compiler has changed the calling convention to varparams on the assumption that the variable parameter list will be used Specify the function in a varparams control or don t use the construct fixedparams attribute
236. other of a different type invalid type An invalid combination of type modifiers was specified Messages and Error Recovery 9 23 invalid type combination An invalid type was specified for example a function returning an array invalid use of void expression An expression of data type void was used in an expression left operand must be lval The left operand of an assignment or the operand of a or operator must be an lvalue that is it must have an address macro expansion buffer overflow Insufficient memory exists for expansion of a macro the macro is not expanded macro expansion too nested The maximum nesting level of macro expansion has been exceeded Macro recursion direct or indirect can also cause this error NEAR qualifier cannot be applied to function The near qualifier was used in the declaration of a function pointer Only the farcode and nearcode controls determine whether a function is placed in the farcode segment All functions in all modules must reside in the same segment Remove or relocate the near qualifier NEAR qualifier cannot be applied to function result The near qualifier was used in the declaration of a function The result of a function is a value and has no address Remove or relocate the near qualifier NEAR qualifier cannot be applied to member The near qualifier was used in the declaration of a component of a structure or union Only the entire aggregate object
237. ow the declaration of the symbols For example the following pragma control line locates i1 and i2 to addresses 1F00H and 1F02H respectively int il i2 pragma locate il 0x1F00 i2 0x1F02 You can also use the define preprocessor directive to define the absolute address Then you can use the macro symbol as a base address and the and signs to indicate the offset For example assume the previous example but with a macro definition define abs addr 0x1F00 int 21 229 pragma locate il abs_addr i2 abs_addr 2 4 57 4 58 Chapter 4 This example has the same effect as the previous example You cannot locate non static block scope variables because they are allocated on the stack or in register overlay segments which are located by RL196 at link time The following example generates an error main IAE ae 2s pragma locate i2 O0x1F02 This line generates an error Compiler Controls 4 59 mixedsource Function Includes or suppresses mixed assembly source in listing Select the EDE C Compiler Options Project Options menu item Enable or disable the Merge C source code with assembly check box in the Listing tab sss mixedsource nomixedsource Abbreviation ms noms Class Primary control Default nomixedsource Description Use this control to include mixed assembly source text in the print file Use the nomixedsource control default
238. parate dialog if you want to save them before starting the build How to View tbe Results of a Build Once the files have been processed you can inspect the generated messages 1 In the Window menu select the Output menu item 2 12 Chapter 2 You can see which commands and corresponding output captured which have been executed by the build process in the Build tab c196 lights c f c tmp mkdac57a tmp C196 Compilation Complete 0 Remarks 0 Warnings 0 Errors C196 wait ms c f c tmp mkdac57b tmp C196 Compilation Complete 0 Remarks 0 Warnings 0 Errors asm196 f c tmp mkdac57c tmp ASSEMBLY COMPLETED NO ERROR S FOUND r1196 f c tmp mkdac57d tmp RL196 COMPLETED 0 WARNING S 0 ERROR S oh196 lights abs to lights hex 80C196 program builder vx y rz SN00000000 003 c year TASKING Inc How to Start tbe Debugger Once the files have been compiled assembled linked located and formatted they can be debugged To execute the debugger Click on the Debug application button The following button is the Debug application button which is located in the ribbon bar El Depending on the project file you selected either the ChipTools simulator or the Intel AppBuilder is launched The simulator will automatically download the compiled file for debugging How to Start a New Project When you first use EDE you need to setup a project Access the Project menu and select New Give your project a name and then click
239. pecified for the function The comma and ellipsis indicate that the number of parameters to the function has no limit In this Case varparams is in effect The notranslate and noob ject controls suppress the object file causing varparams to have no effect However if you specify the code control with the noob ject control the effect of varparams does appear in the pseudo assembly code listing You can specify varparams in the compiler invocation and in pragma preprocessor directives throughout the source text When specified without arguments this control affects all functions in the subsequent source text and remains in effect until the compiler encounters the opposite control ixedparams or the end of the source text The varparams control specified with an argument list affects only the functions in the argument list See the fixedparams control for more information on how the FPL calling convention differs from the VPL calling convention More than one explicit calling convention specification for any one function causes a warning A warning occurs if a function in the source text is explicitly declared with a variable parameter list and is named in the function list for the fixedparams control pragma fixedparams x int x int 1 In this example varparams is in effect Compiler Controls 4 117 Examples 1 3 4 q The following control in the compiler invocation specifies the default va
240. pile time 3 4 Chapter 3 Object file content controls specify the contents of the object file Listing controls specify the names locations contents and formats of the output listing files 3 2 2 WHERE TO SPECIFY CONTROLS The three types of controls are primary general and invocation only controls You can specify these compiler controls in the source text and compiler invocation The type determines where and how often you can specify any particular control as follows Primary You can specify this type of control once in the compiler invocation or in a pragma preprocessor directive preceding the first executable statement or data definition statement in the source text A primary control applies to the entire module and you cannot change or suspend its effects for any part of the source text To override a primary control specified in a pragma specify a contradictory control in the invocation An example of a primary control is the model control which selects the instruction set of one of the processors for the module General You can specify this type of control as often as necessary in the compiler invocation and in pragma preprocessor directives throughout the source text A general control applies to the subsequent source text or to the arguments of the control Each specification of a general control adds to or overrides previous specifications of the control An example of a general control is the no
241. ple license dat SERVER HOSTNAME HOSTID PORT DAEMON Tasking usr local flexlm bin Tasking FEATURE W008002 32 Tasking 3 000 EXPDATE NUSERS PASSWORD SERIAL After modifications from a license data sheet example SERVER elliot 5100520c 7594 DAEMON Tasking usr local flexlm bin Tasking FEATURE SW008002 32 Tasking 3 000 1 jan 00 4 0B1810310210A6894 123456 A 6 Appendix A If the license dat file already exists then you should make sure that it contains the DAEMON and FEATURE lines from your license data sheet An appropriate SERVER line should already be present in that case You should only add a new SERVER line if no SERVER line is present The third field of the DAEMON line is the pathname to the Tasking daemon and you may change it if necessary If the pathname of the resulting license file differs from usr local flexlm licenses license dat then you must set the environment variable LM LICENSE FILE to the correct pathname If you have more than one product using the FLEXIm license manager you can specify multiple license files by separating each pathname fpatb with a setenv LM LICENSE FILE path fpath When the main license daemon Imgrd already runs it is sufficient to type the command lmreread for notifying the daemon that the 1icense dat file has been changed Otherwise you must type the command lmgrd usr tmp lmgrd log amp Both commands reside in the flexlm bin directory mentioned befor
242. ples 3 20 Object file 4 14 4 113 Print file 3 20 4 105 4 113 4 126 symbols control 4 105 T Table of compiler controls 3 5 tabwidth control 4 106 TASKING extensions Keywords 4 23 4 24 4 90 4 91 Prototype declarations 4 24 Type checking 4 24 Temporary files 1 5 1 10 3 11 Temporary registers 4 109 6 3 6 6 Locating 4 109 Termination message See Completion message Time 3 17 title control 4 107 TMPDIR 1 5 1 10 tmpreg 4 26 4 97 tmpreg control 4 109 6 6 TMPREGO 10 9 translate control 4 112 Translation 4 112 Type checking 4 24 Object file 4 14 4 113 Print file 4 113 type control 4 113 Type qualifier _win 6 16 _winl 6 16 U UDI 8 15 UDI format 8 27 udistr function 8 13 8 27 UNIX scripts 3 25 Unreachable code optimization 4 74 updating makefile 2 13 V Variable parameter list calling convention 4 115 Variables Alignment 10 4 Contiguity 10 4 Initialization 10 15 varparams control 4 115 Vector table 4 41 4 44 Version 9 3 Vertical windowing 4 121 Vertical windows C196 interfacing with ASM196 6 14 hold control 4 36 Register allocation scheme 6 11 Windowed parameters 6 15 windows control 4 123 6 12 Vertical windows VWindows 6 10 volatile keyword 10 20 VPL calling convention 4 115 Ww Warning messages 4 19 9 28 warning true false control 4 118 Warnings 4 118 winl 32 4 119 winl 64 4 119 Index win128 4 120 win32 4 120
243. processor cannot detect oscillator failure in powerdown mode The watchdog timer is disabled on reset and becomes enabled on the first write operation to it The 80C196 processor cannot time out the watchdog timer in powerdown mode All internal RAM is preserved You can exit out of powerdown mode with an external interrupt on the pin mapped to INT7 or with a hardware reset Returns The power down function does not return a value Libraries 8 23 printf sprintf Function Formats output Prototype Declaration int printf const signed char format ptr int sprintf signed char buf ptr const signed char format ptr where format ptrpoints to the output format specification buf ptr points to a memory output buffer yes indicates variables containing values to be written Header File stdio h Description Use these functions to perform formatted output printf to the output serial port and sprintf to a memory buffer For guidelines on how these functions operate see C A Reference Manual listed in Related Publications The printf and sprintf functions do not support the p floating point conversion operations Before using printf for the first time you must call the init serio function once after a reset or exit from the powerdown mode to ensure correct operation of subsequent calls to putch The printf function calls the put lt h function The init serio function initializes a static variabl
244. r Controls 4 63 The predefined macro ARCHITECTURE has the value 61 90 BH CA CB ER EC KB KC KD KR LB MC MD MH NP NT or NU depending on the value specified for the model control The predefined macro SFR H has the value bh sfrs h ca sfrs h cb sfrs h ea sfrs h ec sfrs h kb_sfrs h kc sfrs h kd sfrs h kr sfrs h lb sfrs h mco sfrs h md sfrs h mh sfrs h np sfrs h nt sfrs h or nu sfrs h depending on the value specified for the model control You can use this predefined macro in your C source instead of the name of the xx sfrs h include file include lt stdio h gt include _SFR_H_ The predefined macro _FUNCS_H_ has the value xx_sfrs h depending on the value specified for the model control If notranslate or noobject is in effect the compiler does not generate an object module and model has no effect However specifying model with noobject and code can still affect the pseudo assembly listing in the print file The model control affects the entire object module You can specify this control in the compiler invocation or in a pragma preprocessor directive preceding the first line of data definition or executable source text To override a pragma model processor preprocessor directive specified in the source text specify model with a different processor in the compiler invocation farcode nearcode farconst nearconst fard
245. r can follow a left parenthesis or comma For example the following line is not valid in ANSI C int const i volatile j However the C196 compiler recognizes this line as equivalent to the following int const i int volatile j This extension does not affect the semantics of any source text that follows the rules of ANSI C but does cause an asymmetry For example the first of the following two declarations causes x y and z all to be read only variables The second declaration causes only y to be read only x and z are both modifiable int const x y Zi valid for ANSI C int x const y zj C196 extended syntax 10 4 4 INITIALIZATION The C196 compiler supports initialization of object at both file and block scope with the new OMF version 3 2 If you specify either omf 0 or omf 1 on the invocation line initialization of non constant file scope objects is not allowed Examples of constant file scope global initializations are const int i 1 long 1 long const lp amp 1 const struct int i j sl 1 2 These examples can be used with both the omf 1 and the omf 2 control The C196 compiler also supports initialized variable data in RAM This feature affects only non constant data Constant data of course has always been initialized This feature is only available with OMF level 2 or above 10 16 i Chapter 10 The following examples of file scope initializations are only
246. r code and less code size Select the EDE C Compiler Options Project Options menu item Choose a Speed level in the Optimization tab esse speed level where level is the value 0 1 or 2 The values correspond to no fast code faster code and fastest code respectively Abbreviation Sp Class Primary control Default speed 0 Description Use this control to tell the compiler to choose between faster code and less code size Compiler Controls 4 105 symbols Function Generates or suppresses identifier list in print file Select the EDE C Compiler Options Project Options menu item Enable or disable the Include identifier list check box in the Listing tab E symbols nosymbols Abbreviation sb nosb Class Primary control Default nosymbols Description Use this control to include in the print file a table of all identifiers and their attributes from the source text Use the default nosymbols control to suppress the table The xref control causes the compiler to generate a cross referenced symbol table even if the nosymbols control is specified If noprint or notranslate is in effect the compiler does not generate a print file and symbols has no effect The symbols and nosymbols controls affect the entire object module You can specify either of these controls in the compiler invocation or in a pragma preprocessor directive preceding the first li
247. r invocation 4 80 pagewidth print tabwidth title translate Chapter 4 Compiler Controls 4 81 pagewidth Function Specifies line width in the print file Select the EDE C Compiler Options Project Options menu item Enter the number of characters in the Page width characters per line field in the Listing tab ess pagewidth chars where chars is the line length in number of characters This value can range from 72 to 255 Abbreviation pw Class Primary control Default pagewidth 120 Description Use this control to specify the maximum width in characters of lines in the print file The noprint and notranslate controls suppress the print file causing the pagewidth control to have no effect The pagewidth control affects the entire print file You can specify this control in the compiler invocation or in a pragma preprocessor directive preceding the first line of data definition or executable source text To override a pragma pagewidth chars specified in the source text specify pagewidth with a different chars in the compiler invocation 4 82 pagelength print tabwidth title translate Chapter 4 Compiler Controls 4 83 preprint Function Generates or suppresses a preprocessed source text listing file Select the EDE C Compiler Options Project Options menu item Add the control to the Additional options field in the Misc tab
248. r with gt Your network has more than one FLEXIm license server daemon and the default license file location for Imreread differs from the default assumed by the program Also there must be more than one license file Try one of the following solutions on the same host which produced the error message type lmreread c usr local flexlm licenses license dat setLM LICENSE FILE to the license file location and retry the Imreread command use the Imreread program supplied with the product SW000098 Flexible License Manager SW000098 is bundled with all TASKING products Flexible License Manager FLEXIm A 27 3 There is a protocol version mismatch between Imgrd and the daemon with the name Tasking the vendor daemon according to FLEXIm terminology or there is some other internal error These errors are always written to the log file of Imgrd The solution is to upgrade the Imgrd daemon to the one supplied in SW000098 the bundled Flexible License Manager product On the other hand if Imreread complains about not being able to connect to the license server then follow the procedure described in the next section for the error message Cannot read license file data from server The only difference with the current situation is that not the product but a license management utility shows a connect problem FLEXIm license error Cannot read license file data from server This indicates that the program coul
249. rce ms Specifies to generate mixed assembly Listing Primary nomixedsource noms source in the print file Default content nomixedsource model a md Selects the processor instruction set Object Primary Default model kb object a oj Generates and names or suppresses Object Primary noobject nooj the object file Default sourcename obj The noobject control overrides all object controls except for their effects on the print file 3 7 3 8 Chapter 3 Control Abbr Description and Default Effect Usage oldobject 00 Tells the compiler to produce an Object Primary nooldobject nooo object file compatible with V2 x the 16 bit only C196 compiler Default nooldobject omf a omf Specifies the OMF96 version Default Object Primary omf 2 optimize a ot Specifies the level of optimization Object Primary Default optimization level 1 overlay ov Locates register symbols to absolute Object General addresses in the overlay register segments Pragmas only pagelength a pl Specifies the number of lines per Listing Primary page in the print file Default 60 lines format per page pagewidth a pw Specifies the number of characters Listing Primary per line in the print file Default 120 format characters per line preprint a pp Generates and names or suppresses Listing Invocation nopreprint nopp the preprint file Default nopreprint content
250. readme is available as on line help readme c hlp The information is also available as HTML readme c html And there are other read files with information about previous releases They could be of interest to you if you have been using iC 96 before
251. rectory higher than the directory containing the c196 binary For example c196 is installed in usr local c196 bin then the directory searched for include files is usr local c196 include The current directory no prefix When searching for a file specified with the include filename preprocessor directive the compiler tests the prefixes in the following order The directories specified by the searchinclude list The directory in the C196INC environment variable if defined The include directory one directory higher than the directory containing the c196 binary The source directory The current directory no prefix The searchinclude and nosearchinclude controls affect only the subsequent source text and remain in effect until the compiler encounters a contradictory control Specifying the searchinclude control more than once adds to the search path prefix list Specifying the nosearchinclude control after the searchinclude control suppresses the search path prefix list until the next occurrence of searchinclude You can specify these controls in the compiler invocation and in pragma preprocessor directives throughout the source text Compiler Controls 4 101 Example SM gm 09 6 y This example demonstrates the paths searched by the compiler when a C196INC environment variable is defined and the searchinclude control is specified The C196INC environment variable is defined as follows PC set C196INC pr
252. rectory of the binaries is present in the PATH environment variable Compile assemble link and locate the modules using one call to the program builder mk196 mk196 This command will build the example using the file makefile 2 14 Chapter 2 To see which commands are invoked by mk196 without actually executing them type mk196 n This command produces the following output 80C196 program builder vx y rz SN000000 019 c year TASKING Inc e tmp mk25495a tmp model ea enf amp type amp debug amp code amp dn 0 amp ot 0 amp ms c196 lights c f c tmp mk25495a tmp c tmp mk25495b tmp model ea enf amp type amp debug amp code amp dn 0 ot 0 ms c196 wait ms c f c tmp mk25495b tmp c tmp mk25495c tmp ea_start a96 ri model ea enf cmain asm196 f c tmp mk25495c tmp c tmp mk25495d tmp lights obj amp wait_ms obj amp ea_start obj amp c96 lib amp to lights abs amp model ea enf ram 01Ah 17Fh rom 0FF2080h OFF2FFFh ss 6 sfr rl196 f c tmp mk25495d tmp oh196 lights abs to lights hex amp amp The debug control in the makefile in the CCFLAGS and ASFLAGS macro definition is used to instruct the C compiler to generate symbolic debug information This information makes debugging an application written in C much easier to debug To remove all generated files type mk196 clean COMPILING AND LINKING al TASKING uality De
253. red as register variables has exceeded the compiler limit This limit is either the processor limit or is imposed by the registers control Use a different argument for the registers control or declare fewer variables as register variables undefined tag A tag was used before its definition was completed zero or negative subscript The value of an array subscript must be a positive integer 9 36 Chapter 9 9 6 REMARKS Remarks have the following syntax Remark at line nn of filename message Following is an alphabetic list of remark messages a constant in a selection statement A constant is encountered in the expression of a selection statement such as an if else or switch statement comparison of signed and unsigned value This remark is generated when one of the operands in an or operation has a signed type and the other operand has an unsigned type but only if the unsigned value is at least as wide as the signed value The usual conversions are done before the comparison if needed interrupt pragma sbould precede tbe function definition of name In the source module the compiler expects to find the interrupt designation before the actual function definition invalid number of parameters The actual number of arguments in a function call do not agree with the number of parameters in a function definition that is not a prototype Name bides usage of variable witb same name This remark is gener
254. riable parameter list convention VPL for all functions in the source text except the plm_fen function fixedparams plm fcn The following pragma preprocessor directive has the same effect as the control in the above example pragma fixedparams plm fcn The following combination of controls in the compiler invocation specifies the fixed parameter list convention FPL for all functions in the source text except the native function fixedparams varparams native The following pragma preprocessor directives have the same effect as the controls in the above example pragma fixedparams pragma varparams native code object extend translate fixedparams 4 118 Chapter 4 warning true false Function Enables the comparison always returns TRUE and comparison always returns FALSE warnings Syntax warning true false nowarning true false Abbreviation wt nowt Class Primary control Default warning true false Description Use this control to generate the comparison always returns TRUE or the comparison always returns FALSE warnings These warnings appear for instance when comparing two constants or when comparing a negative number with an unsigned integer Use the nowarning true false control to suppress these warnings Compiler Controls 4 119 win1 32 win1 64 Function Combination of a pragma locate and pragma overlay Only if WSRI is present Syntax pragma winl_3
255. rmat ptr int sscanf signed char buf ptr const signed char format ptr where format ptrpoints to the output format specification buf ptr points to a memory input buffer ys indicates any number of pointers to variables to which the input values are assigned Header File stdio h Description Use these functions to perform formatted input scanf from standard input and sscanf from a character string in memory For guidelines on how these functions operate see C A Reference Manual listed in Related Publications The scanf and sscanf functions do not support the p pointer formatting specification If conversion terminates because of a conflict between an input character and the corresponding format specifier the offending character remains unread Trailing white space including a newline character in a format specification can match optional white space in the input field 8 26 Chapter 8 Before using scanff for the first time you must call the init ungetc function once after a reset or exit from the powerdown mode to ensure correct operation of subsequent calls to ungetc The scanf function calls the ungetc function The init ungetc function initializes a static variable used to hold the serial port status This function sets the TI bit in the static variable thereby initializing the mechanism used by the ungetc function The ungetc function then waits for the TI bit to be set indicating that the previous c
256. rols are diagnostic 1 and translate If the compilation ends because of a fatal error the compiler displays the following message C196 FATAL ERROR COMPILATION TERMINATED The print file lists the error that ended the compilation If the noprint control is in effect all diagnostics restricted by the diagnostic control that the compiler generates appear on the screen Messages and Error Recovery 9 5 9 3 FATAL ERROR MESSAGES Fatal error messages have the following syntax C196 FATAL ERROR message Following is an alphabetic list of fatal error messages argument not allowed for control control This message indicates an attempt to pass arguments to a control that accepts none Improper argument passing is a fatal error if it occurs in the compiler invocation but the preprocessor only issues a warning if the improper argument occurs in a pragma directive argument not allowed for negated control control Negated controls except for the noreentrant control do not accept arguments If you specified an argument for a negated control in the compiler invocation the compiler generates this error However if you specified the argument for a negated control in a pragma directive line the preprocessor only issues a warning argument out of range for control control arg This message indicates an attempt to use an argument value that is out of the valid range An out of range argument is a fatal er
257. ror if it occurs in the compiler invocation but the preprocessor only issues a warning if the improper argument occurs in a pragma directive argument required for control control A missing required argument is a fatal error if it occurs in the compiler invocation but the preprocessor only issues a warning if the missing argument occurs in a pragma directive argument too long for control control The length of the argument to the control exceeds the maximum number of characters allowed by the compiler BMOV only valid for model KB The bmov control is valid only if you specified the model kb control 9 6 Chapter 9 7 compiler error This message follows internal compiler error messages If you receive this message you should contact TASKING customer service See the Service Information on the inside back cover control control cannot be negated You cannot use the no prefix with this compiler control Improper negating is a fatal error if it occurs in the compiler invocation but the preprocessor only issues a warning if it occurs in a pragma directive duplicate control control A primary control that must not be specified more than once was specified more than once Only the following controls can be specified more than once define reentrant fixedparams regconserve include searchinclude interrupt varparams If you specify a compiler control both in the compiler invocation and in a pragma preprocessor directive
258. rors A 20 Appendix A Selected EXISTING master node This license daemon has selected an existing master node as the master SERVER shutdown requested A daemon was requested to shut down via a user generated kill command NEW Server started for feature list A possibly new server was started for the features listed Sbutting down xxx The license daemon is shutting down the vendor daemon xxx SIGCHLD received Killing cbild servers A vendor daemon logs this message when a shutdown was requested by the license daemon Started name The license daemon logs this message whenever it starts a new vendor daemon Trying connection to node The daemon is attempting a connection to node Flexible License Manager FLEXIm A 21 4 2 CONFIGURATION PROBLEM MESSAGES bostname Not a valid server bost exiting This daemon was run on an invalid hostname bostname Wrong bostid exiting The hostid is wrong for hostname BAD CODE for feature name The specified feature name has a bad encryption code CANNOT OPEN options file file The options file specified in the license file could not be opened Couldn t find a master The daemons could not agree on a master license daemon lost all connections This message is logged when all the connections to a server are lost which often indicates a network problem lost lock exiting Error closing lock file Unable to re open lock file The vendor daemon h
259. s interrupt interruptpage 4 32 Chapter 4 fixedparams Function Specifies fixed parameter list calling convention Syntax fixedparams function where function is the name of a function defined in the source text Abbreviation fp Class General control Default varparams Description Use this control to cause functions to use the fixed parameter list FPL calling convention The variable parameter list VPL calling convention is the default used by the C196 compiler When calling a PL M 96 function from a C196 program specify fixedparams for the PL M 96 function in the C196 compilation A function s calling convention dictates the sequence of instructions that the compiler generates to manipulate the stack and registers during a call to the function Code generated for the FPL calling convention performs the following sequence of operations 1 The calling function pushes the arguments onto the stack with the leftmost argument pushed first 2 The calling function transfers control to the called function 3 The called function executes 4 The called function removes the arguments from the stack Compiler Controls 4 33 5 The called function returns control to the calling function See the varparams control for more information on how the VPL calling convention differs from the FPL calling convention The calling convention specification must precede the function declaration The
260. s or it can be machine instructions immediately preceding a loop identical to those ending the loop In the first case the compiler inserts code on only one path and inserts a jump to that path in the other path In the second case the compiler generates a branch to reuse the code generated at the beginning of the loop Removing Unreacbable Code at Levels 2 and 5 The compiler eliminates code that can never be executed During the second pass of the compiler the optimization that removes the unreachable code goes through the generated object code and finds areas which can never be reached due to the control structures created in the first pass Compiler Controls 4 75 Reversing Branch Conditions at Levels 2 and 3 The compiler optimizes the evaluation of Boolean expressions so only the shorter of two mutually exclusive conditions is evaluated For example in Figure 4 2 the if statement on the left has the execution order of its branches reversed as shown on the right Original Source Text Effect of Optimization if a if a block 1 block 2 7 else else block 2 block 1 Figure 4 2 Reversing branch conditions Optimizing Indeterminate Storage Operations at Level 3 The indeterminate storage operations involve pointer indirection When code assigns a pointer to refer to a variable it creates an alias for that variable A variable referenced by a pointer has two aliases the
261. s for a particular control do not use an empty pair of parentheses either Some controls use an optional list of arguments Separate multiple argument definitions with commas Brackets surrounding a comma and an ellipsis indicate an optional list See the Conventions Used In This Manual listed at the beginning of this manual for special meanings of type styles used in this manual With controls that can be set from within EDE you will find a mouse icon that describes the corresponding action 4 4 Chapter 4 S abszero Function Specifies whether the compiler zeroes uninitialized variables in absolute segments Select the EDE C Compiler Options Project Options menu item Enable or disable the Clear unititialized RAM variables in absolute segments check box in the Code tab ess abszero noabszero Abbreviation az noaz Class Primary control Default noabszero Description Use the abszero control pragma enable the generation of zeroing entries in the initialization tables for absolute segments variables positioned by either pragma locate or the reg storage class modifier This control is only valid for the default OMF version 3 2 Use the noabszero control pragma to prevent the generation of zeroing entries in the initialization tables for absolute segments AN noinit forces noabszero init Zero Compiler Controls 4 5 bmov Function Tells the compiler to
262. s h Example The following example includes the file nt uncs h pragma model nt_ef include _FUNCS_H_ The same result can be obtained by include lt nt_funcs h gt Libraries 8 9 xx Sfrs h Function Processor specific facilities non ANSI Description The xx sfrs h header files define variables to access the Special Function Registers SFRs and declare functions to manipulate the processor hardware xx represents a processor as specified to the model xx control See the processor specific User s Manual for details on SFRs The compiler initializes the predefined macro SFR H with the name of the processor specific xx sfrs h Example The following example includes the file nu s rs h pragma model nu ef include SFR H The same result can be obtained by include nu sfrs h 8 10 Chapter 8 ctype h Function Character handling ANSI Description The ctype h header file contains macros and function prototypes useful for testing and mapping characters These character handling utilities operate as described in C A Reference Manual listed in Related Publications The ctype h header file provides both function like macros and function prototypes for some ANSI character query and conversion functions Include ctype h if your program calls any of the following functions isalnum isdigit isprint isupper isalpha isgraph ispunct isxdigit iscntrl islower isspace The ctype h header f
263. s is specified with no argument list or the argument list is not properly delimited with parentheses illegal syntax in a directive line A syntax error is encountered in a preprocessor directive illegal syntax in a directive line newline expected A preprocessor directive line is not terminated with a newline illegal syntax in an argument list An argument list in a macro contains misplaced or illegal characters illegal use of FAR qualifier The far qualifier was used in the declaration of an automatic block scope object Only file scope and static objects may contain the far qualifier Remove the qualifier or make the object static illegal use of NEAR qualifier The near qualifier was used in the declaration of an automatic block scope object Only file scope and static objects may contain the near qualifier Remove the qualifier or make the object static incompatible types The two operands of a binary operator have incompatible types for example assigning a non zero integer to a pointer Messages and Error Recovery 9 19 incomplete static object name The type of an object with static storage class must be complete by the end of the module For example static int i 10 20 is an incomplete static object type static int i 5 10 20 completes the type incomplete type The compiler detected a variable whose type is incomplete such as the following example declaration where th
264. s not allowed Arguments were passed to a function that does not accept arguments array too large This error occurs when the size of an array exceeds 64 kilobytes Messages and Error Recovery 9 13 call not to a function A call is made to a symbol which is not a function cannot initialize The type or number of initializers does not match the initialized variable or the variable was not declared with the const qualifier With om 0 and omf 1 the C196 compiler supports static initialization of only const objects in file scope and only static const objects in block scope For example const int i 10 supported int j 10 not supported static int a 10 not supported void f void int i 350 supported static const int b 10 supported const int c 10 supported static int j 10 not supported NN Use om 2 or higher cannot initialize extern in block scope An external declaration cannot be initialized in any scope other than file scope The following example is an invalid external declaration EC extern const int i 1 cannot take the address of asm register operand The address of a register variable was accessed using the ampersand amp address operator after the variable was used as a register operand in an in line code assembly statement for example register int a int ps asm ld a 0A0H p amp a This statement genera
265. s of reusing registers is called overlaying The C196 compiler overlays registers within each module The RL196 relocator and linker can also be used to overlay registers between modules through the use of the regoverlay control 6 8 E Chapter 6 The compiler generates prolog and epilog code and it overlays registers differently for reentrant and nonreentrant functions The two functions differ as follows Reentrant functions contain overhead code and use a smaller number of registers because the functions share the same register space The prolog and epilog of a reentrant function contain code that saves and restores the values of registers used by the function The compiler can then overlay reuse the preserved registers For example if functions f a and b are reentrant the compiler can overlay all the registers used by f a and b Local variables of a function become undefined once the function finishes its execution The C196 compiler allocates a set of registers specifically for the function s local register variables so the compiler does not need to generate the code to preserve the register values in the prolog and epilog The compiler attempts overlaying by using the critical path analysis call graph to determine which functions are active simultaneously and which are not For example if function f calls functions a and b and a and b do not call each other the compiler can overlay the registers used by a and b but m
266. se address You can specify the interruptpage control in the compiler invocation and in pragma preprocessor directives 4 50 Chapter 4 Example The following is an example of a valid interruptpage control specified on the invocation line interruptpage 0x0F Here are some pragma examples pragma model nt e pragma interruptpage 0x0F pragma interrupt int1 1 void intl void Vector at 0x0F2002 pragma model nt e pragma interruptpage OxFE0000 pragma interrupt int1 1 void intl void Vector at OxFE2002 pragma model kc pragma interruptpage 0xD000 pragma interrupt int1 1 void intl void Vector at OxD002 qo interrupt model Compiler Controls 4 51 list Function Specifies or suppresses source text listing in print file Syntax list nolist Abbreviation li noli Class General control Default list Description Use this control to generate a listing of the source text The compiler places the source listing in the print file Use the nolist control to suppress the source listing Several other controls affect the contents of the listing as follows e The cond control causes uncompiled conditional code to appear in the listing e The listexpand control causes macros to be expanded in the listing e The listinclude control causes text from include files to appear in the listing The noprint an
267. signed 0 char second_byte unsigned 0 unsigned bits1 4 unsigned 4 unsigned bits2 3 gap bits2 gap bits1 OSD247 Figure 10 3 Alignment of Structure Members With Padding Language Implementation 10 7 The overlay segment the compiler generates is word aligned The compiler adds one byte to the size of an odd size overlay segment This additional byte can cause the compiler to use one more byte of registers than what you have specified in the registers control if any 10 2 CALLING CONVENTIONS This section describes the four sections of object code shown in Figure 10 4 that the compiler generates to handle a function call as follows setup is code in the calling function that the processor executes just before control transfers to the called function cleanup is code in the calling function that the processor executes just after control returns from the called function prolog is code in the called function that the processor executes first when control has transferred from the calling function epilog is code in the called function that the processor executes just before control returns to the calling function The calling convention determines the contents of each of these four sections of code Calling Function Called Function Control Transfer gt Setup Call i Cleanup OSD1074 Figure 10 4
268. software timer is the interrupt routine for HSO software timer O0 p T xu BRR IR IR ek ke ke kk kk khe IIR RI kk kk kk ke Sk ek ok Ck ke kk kk kk ke ke ke k ek ko kk ke ko ke kk kk kk ke IO ke kk f void software timer void ad_command 8 Start A D channel 0 hso_command 0x18 Give command to HSO hso_time timerl 64 Set HSO command to occur in 126 microsecs BRR IK IK KK IK k e IR IR IR RK RR ke IR OR RR k k k kk ko IO k k k k k k k k k k I RK kk BRR e IR RR I IIR IRR II IIR IIR II IORI k I A I I I dX Ey analog conversion done is the interrupt routine for A to D conversion Le iA BRR IK kk Ck kk kk kk ke k IR kk kk kk kk kk ke k ok Ck kk kk ko kk kk kk kk o kk kk k k k kk kk I k kkk k kk Figure 3 13 Digital signal filter preprint file continued Compiling and Linking 3 39 void analog conversion done void input ad_result_hi if ad_result_lo amp unsigned char 0x80 amp amp ad_result_hi unsigned char 0x71 input if ioportO0 amp unsigned char 0x80 Bypass filter if P0 7 is set ioportl input else word value input unsigned char 0x71 ioportl unsigned char 0x71 ioportl unsigned char amp word value 1 BRR kk kk kk ke kk kk khe kk ko kk ke kk Sk kk kk ke ke Sk ek ko Kk ke kk kk kk kk ke k ek ke kk ke kk kk kk kk ke ko I ke kk f BRR RIK Ck ek Ck kk o kk kk kk ko ko kk kk kk o kk kk kk o kk kk kk ko kk kk k
269. specify additional build options such as to stop the build process on errors and to select a command to be executed as foreground or background process 1 Access the EDE menu and select the Build Options menu item 2 10 OVERVIEW Chapter 2 This opens the Build Options dialog Build Options GREGEM NEN URGERE cx NN Ja Use DUS srel nhen calling debuager OR eme Deas L Build Options Overview 2 11 If you set the Show command line options at the bottom of a tool tab check box EDE shows the command line equivalent of the selected tool option 2 Make your changes and press the OK button 3 Select the EDE Directories menu item and check the directory paths for programs include files and libraries You can add your own directories here separated by semicolons You can use this dialog to specify which directories to search for binary include and library files To specify more than one directory separate them with a semicolon Executable Files Path c MaskingNbin Include Files Path c tasking include d isdn myinc Library Files Path fe tasking lib Canes 4 Access the EDE menu and select the Scan All Dependencies menu item 5 Click on the Execute Make command button The following button is the execute Make button which is located in the ribbon bar If there are any unsaved files EDE will ask you in a se
270. specify the extend control the compiler allows more flexibility in the operation of the register attribute as follows e You can declare file scope variables with the register storage class That is you can declare register variables outside of any block e The compiler uses register memory to optimize data access for variables not explicitly declared with the register keyword allocating variables to registers in the following order 1 All variables explicitly declared with register are allocated first If it runs out of register memory before all the explicitly declared register variables have been allocated the compiler generates an error message 2 If register memory remains after all the explicitly declared register variables have been allocated the compiler can allocate frequently used variables to registers as specified by the regconserve and registers controls See Chapter 4 for the description of each control 6 4 2 ALLOCATING AND OVERLAYING REGISTERS The maximum number of registers available for variable allocation for a module is 220 bytes You can further limit this number by specifying the registers control However you can declare more register variables in a program than the number of registers available in the processor hardware The C196 compiler can reuse the registers used by the local register variables of one function for another function provided the functions are never simultaneously active This proces
271. stem administrator to remove a single user s license for a specified feature This could be required in the case where the licensed user was running the software on a node that subsequently crashed This situation will sometimes cause the license to remain unusable lmremove will allow the license to return to the pool of available licenses Imremove is used as follows Imremove c file feature user host display Imremove will remove all instances of user on node host on display display from usage of feature If the optional c file is specified the indicated file will be used as the license file Since removing a user s license can be disruptive execution of Imremove is restricted to users with root privileges A 10 7 Appendix A Imreread i The Imreread utility will cause the license daemon to reread the license file and start any new vendor daemons that have been added In addition all pre existing daemons will be signaled to re read the license file for changes in feature licensing information Usage is Imreread c icense_file If the c option is used the license file specified will be read by Imreread NOT by Imgrd Imgrd re reads the file it read originally Also Imreread cannot be used to change server node names or port numbers Vendor daemons will not re read their option files as a result of Imreread Flexible License Manager FLEXIm A 11 3 FLEXLM USER COMMANDS Imdown 1
272. ster variables to registers If unused register memory remains after all explicit register variables have been allocated the compiler can put frequently used non register variables in the unused register locations Compiler Controls 4 93 You can prevent the compiler from using the remaining register memory for file scope block scope or all non register variables Specifying regconserve without arguments keeps all non register variables out of register memory The bscope argument restricts block scope non register variables to the stack and the scope argument restricts file scope non register variables to the data segment Table 4 2 lists where non register variables can be allocated for each variation of no regconserve The regconserve and noregconserve controls affect the entire object module You can specify either of these controls in the compiler invocation or in a pragma preprocessor directive preceding the first line of data definition or executable source text To override a pragma regconserve or pragma noregconserve specified in the source text specify a different no regconserve scope control in the compiler invocation Control File scope Block scope Variables Variables regconserve data segment Stack regconserve bscope fscope data segment stack regconserve bscope data segment or stack registers regconserve fscope data segment stack or registers noregconserve data segment or stack or reg
273. style definition char c char promoted to int With extend in effect the compiler allows exact type matching between parameters in a prototype declaration and parameters in the associated old style definition The above example is accepted with extend in effect Compiler Controls 4 25 The extend and noextend controls affect the entire object module You can specify either of these controls in the compiler invocation or in a pragma preprocessor directive preceding the first line of data definition or executable source text To override a pragma extend or fpragma noextend specified in the source text specify the opposite control noextend or extend respectively in the compiler invocation qo alien fixedparams regconserve varparams 4 26 Chapter 4 extratmp Function Enable or disable usage of extra temporary registers TMPREGS to TMPREG16 Select the EDE C Compiler Options Project Options menu item Enable or disable the Use 16 TMPREG bytes instead of 8 for 16 bit models check box in the Optimization tab ess extratmp noextratmp Abbreviation et noet Class Primary control Default noextratmp for non 24 bit models extratmp for 24 bit models Description The compiler uses a maximum of 8 TMPREG bytes for non 2 bit models and a maximum of 16 TMPREG bytes for 24 bit models If you specify one of the controls you get what you specify ET or NOET For non 24
274. t f 6 return input a A 7 else 8 9 Figure 3 4 Print file source text listing Compiling and Linking 3 19 Line numbers range from 1 to 99999 Each error warning and remark message when present refers to the line numbers in the source text listing Line numbers do not always correspond to the sequence of lines in the source text source text lines that end in a backslash are continued on the following line The listing s line numbers are not incremented for continuation lines The block nesting level ranges from 0 for a statement outside of any function definition loop or other control block to 99 When its value is 0 this field is blank The include nesting level describes how many include preprocessor directives or instances of the include control the preprocessor encountered to include the statement in the source text For the primary source file the nesting depth is 0 and this field is blank Each nested include preprocessor directive or include control increments the include nesting level The include nesting level column has a value only if the listinclude control is in effect The maximum nesting of include files depends on the number of files open simultaneously during compilation and can vary with the operating system Table 3 5 shows the compiler controls that affect the source text listing portion of the print file Control Effect no cond generates or suppresses uncompiled
275. t control for a function has the same effect as defining the function with the reentrant keyword The reentrant keyword is available for compatibility with earlier versions of C196 The default extend control must be in effect for the compiler to recognize the reentrant keyword Compiler Controls 4 91 You cannot reactivate a nonreentrant function if it is currently active Use the noreentrant control to define the functions in the module as nonreentrant In this case the compiler allocates a set of registers for the local variables of the function After the function exits the compiler then reuses the same register space for another nonreentrant function depending on the call graph The compiler generates no additional code to save and restore the registers modified by the function Specifying the noreentrant control for a function has the same effect as defining the function with the nonreentrant keyword The nonreentrant keyword is available for compatibility with earlier versions of C196 The extend control must be in effect for the compiler to recognize the nonreentrant keyword The noobject and notranslate controls suppress the object file causing reentrant and noreentrant to have no effect However if you specify code with noob ject the effects of reentrant and noreentrant appear in the pseudo assembly listing of the print file The reentrancy specification for a function must precede the function declaration The first declara
276. t cri When noextend is in effect the C196 compiler uses ANSI semantics for the register storage class The ANSI semantics allow register storage class variables within blocks only not at the file scope level and do not allow combining static or extern with register storage class The extension keywords that the compiler recognizes when extend is in effect are redundant with some of the compiler controls and are provided for compatibility with earlier versions of C196 The reentrant nonreentrant and alien keywords have the same effect as the reentrant noreentrant and fixedparams controls respectively The extend and noextend controls have no effect on the reentrant noreentrant and fixedparams controls The extend control also extends the way C196 performs parameter type checking between prototype function declarations and old style function definitions The ANSI C standard specifies that in old style function definitions char and short parameters are promoted to int and float parameters are promoted to double When a prototype declaration and an old style definition exist for a function the parameters of the prototype must be compatible with the promoted parameters of the old style definition With noextend in effect C196 conforms to the ANSI standard For example with noextend in effect the following combination causes an invalid redeclaration error for the function f int f char prototype declaration int fc old
277. t file and two listing files as shown in Table 3 3 File type Filename Contents Compiler Controls Defaults object file source obj object module objector translate object translate preprint file source i preprocessed preprint or nopreprint source text notranslate translate print file source st listings com print print pilation results 1 source is the filename of the primary source file without the filename extension Table 3 3 Compiler output files Figure 3 1 shows the input and output files of the C196 compiler 3 12 Chapter 3 Input Primary Source File Included File s C196 Files COMPILER EG id 199 Preprint Print Object File File File Output OSD239 Figure 3 1 C196 input and output files The two optional listing files produced by the compiler the preprint file and the print file embody two aspects of compilation The preprint file contains the source text after textual preprocessing such as including files and expanding macros The print file contains information about the results of compiling the source text into an object module By default the compiler generates a print file but not a preprint file The following sections describe the two listing files in detail 3 4 1 PREPRINT FILE In generating a preprint file from a source text file the compiler completes the following operatio
278. tal error if it occurs in the compiler invocation but the preprocessor only issues a warning if the null argument occurs in a pragma directive missing left brace An aggregate initializer list must be enclosed in braces for example const int i 1 2 3 no body for static function function name The function name function is declared as a static function but is neither defined nor called in the module pragma ignored An entire pragma preprocessor directive was ignored as a result of an error Whenever an error is found in a pragma preprocessor directive the diagnostic is followed by either this message or remainder of pragma ignored whichever is appropriate 9 34 Chapter 9 predefined macros cannot be deleted redefined The predefined macros e g LINI or FILE cannot be deleted or redefined by the preprocessor directives define or undefine Gl qualifier ignored for bit fields You cannot use a type qualifier with bit field members of a structure or union redefined attribute ignored for function Calling convention varparams or fixedparams or reentrancy for the function name has already been established with a declaration definition or compiler control regconserve conflicts with registers all registers all conflicts with regconserve The registers all control specifies that the compiler is to allocate all program variables to registers including variables declared without the
279. te parameter name The same identifier was found more than once in the identifier list of a function declarator For example the following code contains a duplicate a identifier int f a a duplicate parameter name in macro Two arguments in the definition of a macro are identical Every argument must be unique in the macro definition duplicate tag A struct union or enum tag was defined more than once within the same scope empty character constant A character constant should include at least one character or escape sequence expression not within range A register specified is not in the range of 0 to 255 An immediate count in a shift is not in the range of 0 to 15 A register count in a shift is not in the range of 16 to 255 An immediate operand in byte instructions or a dcb constant is not in the range of 128 to 127 FAR qualifier cannot be applied to function The far qualifier was used in the declaration of a function pointer Only the farcode and nearcode controls determine whether a function is placed in the farcode segment All functions in all modules must reside in the same segment Remove or relocate the far qualifier FAR qualifier cannot be applied to function result The far qualifier was used in the declaration of a function The result of a function is a value and has no address Remove or relocate the far qualifier 9 16 Chapter 9 FAR qualifier cannot be applied to member The far quali
280. ter int far far_ptr_to_near_int far int far far_ptr_to_far_int int near_ptr_to_near_int 10 4 9 2 FAR AND NEAR CODE Far code can be located anywhere within the entire extended address space of the processor Near code must reside in the upper 64K because it is accessed with 16 bit addressing You choose between far or near code solely by the farcode and nearcode controls The far and near keywords may not be used to qualify functions 10 22 Chapter 10 All separately compiled modules must use the same choice of far or near code since the selected mode is determined by the processor upon reset and is not changeable by software The processors Configuration Control Register CCR controls whether the processor will use the extended addressing mode and you must set it to match your choice of far or near code see the ccb compiler control Using only near code is more efficient than using far code When the arcode control is in effect e Extended call instructions are used to invoke external functions but ordinary call instructions are used to invoke functions defined in the same module e All function pointers are 32 bits wide e Return addresses on the stack are 32 bits wide e Any jump tables generated for switch statements are built with 32 bit table entries 10 5 COMPILER LIMITS The values listed in Table 10 2 represent the maximum size or number of each item that the compiler can process E
281. ter application is based on Experiment 9 17 of the book The 16 Bit 8096 Programming Interfacing Applications 122 Experiments by R Katz and H Boyet permission granted by the publisher H Boyet 14 E 8th St NY NY BRK IK kk hok kk kk kk kk ko kk kk kk ok kk kk ke kk kk kk ko IO o kk kk ke kk kk kk AO k k kk kk kk kk ke kk k f TX K This is the initialization code for the digital signal filter utd lA BRR e IK RRR RI I ok ek Ck ke kk kk kk ke IO IR e e e k e e e II IO ko kk kk ke IR A I IO kk kkk f pragma model kb Select instruction set for the 80C196KB processor pragma interrupt software timer 5 pragma interrupt analog conversion done 1 include kb sfrs h Include header file that declares variables to ay access analog to digital A D channel high speed output HSO software timer 0 input output I O ports and interrupt flags This header file also declares enable to enable interrupts define K unsigned char 0x71 Scaling factor for input define M unsigned char 0x71 Scaling factor for history define MSB unsigned char 0x80 Mask for low byte of input define Full Scale unsigned char 0x71 Mask for high byte of input register unsigned char input register unsigned int word value define byte value unsigned char amp word value 1 byte value is the high order bit of word value Compiling and Linking 3 31
282. tes th rror 9 14 Chapter 9 case not in switcb A case was specified but not within a switch statement code segment too large The size of the code segment which includes the program s code and constant objects exceeds 64 kilobytes conditional compilation directive is too nested The nesting of conditional compilation directives exceeded 16 levels constant expected A non constant expression appears when a constant expression is expected e g a non constant expression as array bounds or as the width of a bit field constant value must be an int The constant specified must be representable as the data type int data segment too large The data segment which includes the program s variables and can include some constants exceeds 64 kilobytes declaration exceeded 64K The size of a declared object exceeded 64 kilobytes thus exceeding the space available for the data segment default not inside switch A default label was specified outside of a switch statement division by 0 Evaluation of an expression resulted in division by a 0 value duplicate case in switch number The same value number was specified in more than one case in the same switch statement duplicate default in switch More than one default label was specified within the same switch statement Messages and Error Recovery 9 15 duplicate label A label was defined more than once within the same function duplica
283. the Embedded Microcontrollers and Processors Handbook listed in Related Publications for a detailed explanation of the contents of the CCR To specify more than one byte the value should be given as a hexadecimal string The bytes specified will be placed in successive even addresses as required by the processor with a byte of 20H automatically placed in the intervening odd addresses For example if you specified ccb 0x010203 the compiler would place 0120022003 in addresses OFF2018H through OFF201CH You can specify the ccb control in the compiler invocation or in a pragma preprocessor directive preceding the first line of data definition or executable source text Compiler Controls It is better to use pragma than to use the control on invocation Can only be used once in the whole application 4 9 4 10 Chapter 4 code Function Generates or suppresses pseudo assembly language code listing in print file Select the EDE C Compiler Options Project Options menu item Enable or disable the Generate pseudo assembly language check box in the Listing tab E code nocode Abbreviation co noco Class General control Default nocode Description Use this control to produce a pseudo assembly language listing equivalent to the object code generated by the compiler The compiler places this listing in the print file below the source text listing Use the default nocode control to s
284. the source text use the include preprocessor directive You can abbreviate the include control but not the include preprocessor directive Example This invocation line tells the compiler to include the file kb sfrs h in its C source c196 filel c include kb sfrs h qe listinclude preprint searchinclude 4 40 Chapter 4 init Function Specifies whether the compiler produces the initialization segments and tables Select the EDE C Compiler Options Project Options menu item Enable or disable the Support initialized and cleared RAM variables check box in the Code tab ess init noinit Abbreviation it noit Class Primary control Default init Description Use the init control to allow the compiler to produce the initialization segments and tables This control is only valid for the default OMF version 3 2 At startup reset library module cstart processes the initialization table it copies the initial constant data to the corresponding variables and zeroes the uninitialized variables Use the noinit control pragma to prevent the generation of initializing data and tables even though you have used initializers in your source code noinit also prevents zeroing of uninitialized variables qb abszero Zero Compiler Controls inst Function Specifies whether the compiler generates vector tables for switch statements Select the EDE C Compiler Options
285. then generates the WSR management code which saves the HLDEN bit in the WSR in the prolog as follows ldbze Tmp0 WSR push TmpO andb WSR 80h to retain HLDEN in WSR orb WSR WSR If you are not using the HOLD HOLDA protocol specify the windows control with the nohold parameter The compiler then produces a reduced amount of overhead code as follows ldbze TmpO WSR push TmpO ldb WSR WSR For the epilog the compiler produces the following code ldb WSR SP pop RO For more compact code declare functions as static when appropriate This declaration suppresses the generation of the WSR management code in the prolog and epilog of these functions Processor Registers 6 13 The linker first locates the global variables allocated in register segments below the window base selected in the lower 256 registers during link time This scheme enables access to a global variable without regard to the WSR Then the linker locates the overlay segments after all register segments are located If there are gaps between register segments the linker attempts to fill the gaps with overlay segments of the right size The linker selects the window size based on the last highest address space occupied by the last register segment The last occupied address must fall below 80H the 128 byte window or 0COH the 6 byte window or c EOH the 32 byte window Otherwise the linker sets the WSR to zero takes no a
286. tion can be useful to other tools in the application development process A linker uses type information to perform type checking across modules A debugger or an emulator uses type information to display symbols according to their attributes To include all possible information for symbolic debugging use type with the debug control as described in the debug entry in this chapter Use the notype control to suppress type information reducing the size of the object module The noobject and notranslate controls suppress the object file causing type and notype to have no effect 4 114 Chapter 4 The symbols and xref controls are the print file counterparts to the type control The symbols control puts a listing of all identifiers and their types into the print file The xref control adds line number cross reference information to the symbol table listing The type and notype controls affect the entire object module You can specify either of these controls in the compiler invocation or in a pragma preprocessor directive preceding the first line of data definition or executable source text To override a pragma type or pragma notype specified in the source text specify the opposite control notype or type respectively in the compiler invocation debug translate object xref symbols Compiler Controls 4 115 varparams Function Specifies variable parameter list calling convention Syntax varparams function
287. tion or definition of a function sets the reentrancy specification for that function based on the no reentrant control in effect for the function or based on the non reentrant keyword if specified for the function You can specify reentrant and noreentrant in the compiler invocation and in pragma preprocessor directives throughout the source text When specified without arguments these controls affect all functions in the subsequent source text and remain in effect until the compiler encounters the opposite control noreentrant or reentrant respectively or the end of the source text Either of these controls specified with an argument list affects only the functions in the argument list qo extend registers 4 92 7 Chapter 4 regconserve Function Disallows file scope and automatic non register variables in registers Select the EDE C Compiler Options Project Options menu item Enable or disable the Allow allocation of block scope variables to registers and orAllow allocation of file scope variables to registers check box in the Optimization tab regconserve scope noregconserve where scope can be bscope indicating block scope variables or scope indicating file scope variables Abbreviation rc norc Class Primary control Default noregconserve Description Use this control to specify whether the compiler can allocate file scope and automatic block scope non regi
288. to create a batch or command file RUNNING THE COMPILER To learn how to invoke the compiler read Chapter 3 To learn how each control affects the compilation process see Chapter 4 Chapter 9 provides information you can use to interpret a compiler error or warning and including possible causes and suggested actions to recover from the error PROGRAMMING IN C196 To learn about the 80C196 architecture and the C196 data types calling conventions and library functions read Chapters 6 through 10 and the example at the end of Chapter 3 XII Manual Purpose and Structure MANUAL STRUCTURE Related Publications Conventions Used In This Manual 1 Software Installation Describes the installation of the C196 compiler 2 Overview Provides an overview of the TASKING 80C196 toolchain and gives you some familiarity with the different parts of it and their relationship A sample session explains how to build a 80C196 application from your C file 3 Compiling and Linking Deals with C compiler invocation output files and describes how to automatically invoke the compiler 4 Compiler Controls Contains an alphabetical list of all compiler controls 5 Startup Code Describes the C startup code 6 Processor Registers Describes the variables declared in the xx s rs h header files where xx represents the processor as specified with the model xx control for using the SFRs and explains how to use the C196 compiler for e
289. to suppress the generation of mixed assembly source in the print file By default the compiler lists the C source at the beginning of the print file and generates lines with Statement num to indicate a C source line With the mixedsource control the compiler does not list the C source at the beginning of the print file but mixes the C source lines with the assembly source So the line with Statement num are replaced by the source line itself You can specify the mixedsource and nomixedsource control in the compiler invocation and in pragma preprocessor directives at the beginning of the source text qo list listinclude print 4 60 Chapter 4 e model Function Specifies the processor instruction set Choose a cpu from the EDE CPU Model menu item Optionally select one or more of the radio buttons Near Code Far Code Near Const Far Const Near Data Far Data ess model processor where processor Selects the instruction set the compiler uses in generating code for a specific member of the 80C196 processor family Abbreviation md Class Primary control Default model kb Description This control allows you to specify which processor instruction set you are using The cb ea np nt and nu arguments of the model control also enable the compiler to recognize the nearcode farcode nearconst farconst neardata and fardata controls Specify the processor as one of the following 61
290. trol 0 if using the nearcode control EAR CONST default placement of constant objects 1 if using the farconst control 0 if using the nearconst control FAR DATA default placement of non constant objects 1 if using the fardata control 0 if using the neardata control FUNCS H name of processor specific xx funcs h include file xx is one of the processor models as specified by the model control HAS PTS only defined as 1 if the processor has a PTS unit OMF96 VERSION OMF version 0 V2 0 1 V3 0 2 V32 _OPTIMIZE_ current optimization level as set by the optimize control 0 1 2 or 3 REGISTERS number of bytes of register memory available for register variable allocation as specified by the registers control Compiling and Linking 3 15 Name Value _SIGNEDCHAR signed or unsigned default of char variables 1 if using the signedchar control 0 if using the nosignedchar control _SFR_H_ name of processor specific xx_sfrs h include file xx is one of the processor models as specified by the model control Table 3 4 C196 predefined macros 3 4 1 2 INCLUDE FILES The preprint file also shows the source text files inserted from file inclusions To include files in the source text use the include control in the compiler invocation or the include preprocessor directive The preprocessor inserts the contents of a file included with the incl
291. trol does not suppress translation and does not prevent the compiler from producing a print file The noobject control overrides other object file controls except for their effects on the print file 4 68 Chapter 4 A If a file already exists for either the default or the specified filename the compiler writes over the existing file with the new object file The object and noobject controls affect the entire compilation You can specify these controls in the compiler invocation or ina pragma preprocessor directive preceding the first line of data definition or executable source text To override a pragma object filename or pragma noobject preprocessor directive specified in the source text specify the opposite control noobject or object with a different filename respectively in the compiler invocation d gt code oldobject translate Compiler Controls 4 69 oldobject Function Produces an object file compatible with the OMF96 V2 x Syntax oldobject nooldobject Abbreviation oo nooo Class Primary control Default nooldobject Description Use this control to produce an object file compatible with earlier versions of the C196 compiler This control causes the compiler to place all constants including switch tables in the code segment No constant segment is produced You may need to use the inst control when you use oldobject if your system overlaps RAM and ROM Also if you want your data a
292. trols in the compiler invocation and in pragma preprocessor directives at the beginning of the source text qe interrupt interruptpage 4 36 Chapter 4 hold Function Specifies whether the windowing code needs to preserve the HOLD HOLDA bit in the WSR Select the EDE C Compiler Options Project Options menu item Enable the Support Vertical Windowing check box and enable or disable the Save restore HOLDEN bit of WSR at function entry exit check box in the Code tab g hold nohold Abbreviation ho noho Class Primary control Default nohold Description If you are using the HOLD HOLDA protocol along with vertical windowing specify the hold control This control causes the compiler to generate additional code to preserve the HOLDEN bit of the Window Select Register WSR If you are not using the HOLD HOLDA protocol specify the nohold control to reduce the amount of overhead code This control provides the same function as the hold and nohold parameter keywords in the windows control but without the need to use the windows control AN The hold control is not a substitute for the windows control The hold control is merely to be used with the windowed parameter method for vertical windows using the keywords _reg and _win or winl and the windowram control Compiler Controls 4 37 The WSR management code allows access to local and static register variables located in the mapped
293. ude control before the first line of the source file The preprocessor inserts the contents of a file included with the include preprocessor directive into the source text in place of the line containing the include directive Paired occurrences of the 41ine preprocessor directive bracket the included text The compiler inserts the line directive in the preprint listing file at the beginning of the included text and another line directive at the end of the included text C A Reference Manual listed in Related Publications provides more information on preprocessor directives 3 4 1 3 CONDITIONAL COMPILATION Conditional preprocessor directives delimit sections of source text to be compiled only if the conditional expression evaluates to true The preprocessor evaluates the conditions and determines which sections of source text are compiled The source text that is not compiled does not appear in the preprint file The conditional directives are if else elif endif ifdef and ifndef The if directive can take a special defined operator See the book C A Reference Manual listed in Related Publications for explanations on how to write a program using conditional compilation 3 16 Chapter 3 i 3 4 1 4 PROPAGATED DIRECTIVES The preprocessor propagates the directives line error and pragma from the source text to the preprint file to ensure that the preprint text is equivalent to the source text after preprocess
294. unction call in your source text Table 8 2 lists the names and functionality of the C196 library header files and the manuals which describe each header file Filename Contents Described In ctype h character handling utilities this chapter float h floating point limits C A Reference Manual limits h fixed point limits C A Reference Manual math h absolute value function prototype C A Reference Manual setjmp h non local jump function prototypes C A Reference Manual stdarg h variable argument list utilities C A Reference Manual stddef h common definitions C A Reference Manual stdio h input output I O utilities C A Reference Manual stdlib h general utilities C A Reference Manual string h string handling utilities this chapter xx funcs h processor specific functions this chapter Xx_sfrs h processor special facilities as they this chapter are described in the processor specific User s Manual Table 8 2 Header files 8 8 Chapter 8 E xx_funcs h Function Processor specific functions non ANSI Description The xx funcs h header files contain function prototypes of the functions enable disable enable pts disable pts power down idle and possible type definitions for the various PTS control blocks xx represents a processor as specified to the model xx control The compiler initializes the predefined macro _FUNCS_H_ with the name of the processor specific xx func
295. uppress the pseudo assembly language listing You can use the pseudo assembly language listing while debugging to view the following e The effects of different levels of optimization set by the optimize control e The difference in code the compiler generates under the various arguments to the model control e The differences in calling sequences the compiler generates under the fixedparams varparams noreentrant and reentrant controls Compiler Controls 4 11 The noprint and notranslate controls suppress the pseudo assembly language listing specified by the code control but the noobject control does not You can specify these controls in the compiler invocation and in pragma preprocessor directives throughout the source text If the code or nocode control is embedded within the source text the control only affects the source text that follows the control line until the compiler encounters the opposite control or the end of the source text debug object reentrant extend optimize translate fixedparams print varparams model 4 12 Chapter 4 cond Function Includes or suppresses uncompiled conditional code in source text listing Select the EDE C Compiler Options Project Options menu item Enable or disable the Include conditionally uncompiled source code check box in the Listing tab E cond nocond Abbreviation cd noca Class General control Default nocond Description
296. use the bmov instruction to initialize or copy structures or array elements Select the EDE C Compiler Options Project Options menu item Enable or disable the Use the uniterruptable bmov instead of bmovi check box in the Object tab Eg bmov nobmov Abbreviation bm nobm Class Primary control Default nobmov Description Use this control to tell the compiler to use the bmov instruction when initializing or copying structures or array elements This control is valid for all models Use the model control to specify the specific instruction set The compiler generally does not generate the bmov instruction because of its interrupt latency The bmov instruction is uninterruptable See the Embedded Microcontrollers and Processors Handbook listed in Related Publications for more information on the bmov and ebmov instruction Without the bmov control the compiler automatically generates the bmovi instruction for the same process The bmovi instruction is interruptable You can specify the bmov control in the compiler invocation or in a pragma preprocessor directive preceding the first line of data definition or executable source text qo model 4 6 7 Chapter 4 case Function Tells compiler to act case sensitive Select the EDE C Compiler Options Project Options menu item Enable or disable the Operate in case sensitive mode check box in the Code tab esse case
297. ust use its own separate registers You can specify a function to be reentrant either by using the reentrant storage class in the function declaration or by specifying the reentrant control Since the reentrant storage class is a non ANSI Intel extension to the C language the reentrant control is recommended for writing portable programs Similarly you can specify a function to be nonreentrant either by using the non ANSI nonreentrant attribute in the function declaration or by specifying the noreentrant control Since an interrupt function can be active at any time simultaneously with any other function the compiler treats interrupt functions as reentrant functions Processor Registers 6 9 Hexadecimal Address OFFH Register Variables E 24H or 2CH TMPREGO Tempory Registers 1CH Frame Pointer 1AH Stack Pointer 18H 2 Special Function Registers P 00H SFRs OSD1815 Figure 6 2 Calculating register memory requirements You can calculate the number of bytes of register memory needed by a module as in the following example illustrated in Figure 6 2 The compiler allocates two bytes of register memory for the A function These two bytes are locations 24H and 25H The compiler allocates six bytes of register memory for the B function Since A and B are never simultaneously active B can use the same two bytes that A uses The B function uses locations 24H through 29H The compiler allocates six byt
298. velopment Tools Worldwide Compiling and Linking 3 3 3 1 INTRODUCTION This chapter provides the information you need to invoke the C196 compiler You can compile a C196 program without making any modifications to the basic environment simply by specifying the complete compiler invocation syntax each time you use the compiler However setting environment variables discussed in the Software Installation chapter specifying compiler controls discussed in detail in Chapter 4 using makefiles and using batch files and UNIX shell scripts can greatly reduce the complexity of a compiler invocation 3 2 COMPILER INVOCATION SYNTAX For the following syntax the square brackets enclose optional elements for the command line If you do not specify an optional element do not use an empty pair of parentheses The C196 compiler invocation has the following format cpath c196 spatb filename controls Where cpatb is the path to the directory that contains the compiler spath is the path to the directory that contains the primary source file filename is the name of the primary source file controls are the compiler controls separated with spaces For a complete description of each control see Chapter 4 3 2 4 HOW CONTROLS AFFECT THE COMPILATION Each control affects the compilation in one of three ways Source processing controls specify the names and locations of input files and define macros at com
299. win64 4 120 Windowed variables 4 121 windowram control 4 121 6 15 Windows Horizontal 6 11 Mapping 6 11 Vertical 6 11 windows control 4 123 6 12 windowsize control 6 13 wordalign 4 125 Work files 1 5 1 10 3 11 WSR 4 78 WSR management code 4 36 4 123 6 12 X xref control 4 126 xx_funcs h header file 4 87 4 89 6 5 8 8 xx_sfrs h header file 6 5 8 9 Z zero control 4 128 RELEASE NOTE INDICATOR Customer Information Software INDICATOR NR CIS9927 CONCERNS TK006022 00 80C196 C Compiler Release 6 1 ISSUE DATE May 99 SUPERSEDES CIS9828 TO BE FILED IN 80C196 C Compiler User s Guide SUMMARY A new release of the 80C196 C Compiler has been made Release 6 1 The main reasons for this update are e Solving of reported problems e New style manuals e PDF and HTML versions of on line manuals ON LINE MANUALS For Windows 95 98 and Windows NT the complete set of manuals is available as Windows on line help files in the etc directory The manuals are also available as HTML files for Web browsers in the html directory and in PDF format in the subdirectory pd for viewing with Adobe s Acrobat Reader Al TASKING Quality Development Tools Worldwide Rel 2 Release Note x SOLVED KNOWN PROBLEMS The distribution contains the file readme_c txt with information about solved problems known problems and additional notes For Windows 95 98 and Windows NT the
300. xceeding any of these can produce a diagnostic message or result in incorrect execution Item Maximum number of conditional compilation directives 16 nesting level of macro invocations 64 number of arguments in a macro invocation 31 length in characters of a pragma preprocessor directive 1024 number of search path prefixes including prefixes for the 19 searchinclude control and prefixes defined in the C196INC environment variable number of filenames in the include control if c96init h is present 18 number of filenames in the include control if c96init h is not 19 present length of a pathname in characters 128 number of case values in a switch statement 255 nesting level of functions specified in function argument lists 20 Language Implementation Item Maximum number of functions defined in a module 255 number of external references in a module 65536 statement nesting level 32 number of arguments in a function call 31 nesting level of structures unions 32 maximum size of structure returned from a function in bytes 127 Table 10 2 Compiler limits 10 23 10 24 Chapter 10 LANGUAGE FLEXIBLE LICENSE MANAGER FLEXLM al TASKING uality Development Tools Worldwide Flexible License Manager FLEXIm A 3 1 INTRODUCTION This appendix discusses Highland Software s Flexible License Manager and how it is integrated into the TASKING toolchain It also
301. y saves restores the state of the floating point library see psave and fprstor in the 80C196 Utilities User s Guide The compiler also creates an interrupt vector entry for each interrupt function If the code being generated is for the 8096 the interrupt number must be in the range 0 to 7 If the code being generated is for the 80C196 microcontrollers the interrupt number must be in the range 0 to 9 or 24 to 31 The interrupt numbers correspond to positions in the interrupt vector table calculated as follows the interrupt number n multiplied by 2 and added to the base of the vector table For 8096 and most 80C196 parts the base is 2000h For 80C196NT NP the base is FF2000h With the interruptpage control you can override the default base of the vector table If you specify an interrupt address instead of an interrupt number you must check your processor specific manual for valid addresses It is not necessary to specify the page when you use addresses For example address 0x2008 and address 0xFF2008 are the same on an extended model The interrupt priority determines interrupt sequencing when several interrupts are pending You can allow any priority of interrupt to occur by explicitly enabling it using int mask and imask1 Since an interrupt function prolog includes either pushf for 8096 code or pusha for 80C196 code which disable interrupts the execution of the interrupt handler cannot be interrupted unless you reenabl
302. ype with zeroes INDEX al TASKING uality Development Tools Worldwide Index Index 3 Symbols bat files 3 24 i extension 3 13 obj extension 3 23 REGISTERS 3 14 SFR H 3 15 8 9 _SIGNEDCHAR 3 15 _tolower function 8 10 _toupper function 8 10 win type qualifier 6 16 FRAMEO variable 4 109 10 9 10 10 OVRBASE symbol 10 12 wsr variable 4 36 4 123 6 14 Square brackets 3 3 define preprocessor directive 3 13 elif conditional directive 3 15 else conditional directive 3 15 endif conditional directive 3 15 error directive 3 16 if conditional directive 3 15 ifdef conditional directive 3 15 ifndef conditional directive 3 15 include directive 3 15 include preprocessor directive 3 18 line directive 3 16 pragma directive 3 4 3 16 DATE 3 13 __FILE__ 3 13 J LINE 3 13 STDC 23 13 TIME 3 13 16 BITS 3 13 24 BITS 3 13 ARCHITECTURE 3 14 C196 3 14 _DEBUG_ 3 14 _DIAGNOSTIC_ 3 14 _FAR_CODE_ 3 14 FAR CONST 3 14 FAR DATA 3 14 _FUNCS H 3 14 8 8 _HAS PTS 3 14 main 5 4 Writing your own 5 6 _main c Subroutines 5 4 OMF96 VERSION 3 14 _OPTIMIZE_ 3 14 reg storage class 6 15 _winl type qualifier 6 16 Numbers 80C196 processor Registers 6 10 80C196 utilities LIB196 library manager 2 5 OH196 converter 2 5 RL196 linker 2 5 A Absolute addresses Assigning 4 57 abszero control 4 4 adding fil
303. zation continued Compiling and Linking 3 43 0061 80007 0061 00008 0061 27FE br 80007 0063 80009 Statement 65 0063 F0 ret Figure 5 15 Digilal signal filter code listing level 0 optimization continued 3 8 OPTIMIZING When you have finished debugging you can compile the program for both memory and execution efficiency By specifying the notype control and not specifying the debug control you can eliminate all symbolic information that is not needed for execution By specifying the highest level of optimization optimize 3 you can reorganize the object code to occupy less space and to use the fewest instructions 3 44 COMPILING Chapter 3 COMPILER CONTROLS al TASKING uality Development Tools Worldwide Compiler Controls 4 3 This chapter describes the C196 compiler controls Use compiler controls to specify options such as the location of source text files the amount of debug information in the object module and the format and location of the output listings Since most of the controls have default settings you need not specify any of the controls if the defaults match your application needs Table 3 1 lists default settings and a brief description of each control The entries in this section describe in detail the syntax and function of each compiler control Square brackets L enclose optional arguments for controls If you do not specify optional argument

Download Pdf Manuals

image

Related Search

Related Contents

Wiring fault detection, diagnosis and reporting for process control    ジクロロメタン スーパーMAL-2  取扱説明書 - 三菱電機  Installation & Operation Manual  "取扱説明書"  SerVice Manual  Bulletin de souscription PEA Oddo et Cie  Fujitsu S26391-F655-L300  Fujitsu AMILO Pi 1505  

Copyright © All rights reserved.
Failed to retrieve file