A Microcontroller-Based Development Platform

for Regulator Applications

 

 

 

 

 

 

 

Carl F Trefil

 

 

 

 

 

 

 

 

 

 

 

Göteborg

August 8, 1995

 

Department:

Department of Computer Engineering

Chalmers University of Technology

Göteborg, Sweden

 

Date:

August 8, 1995

 

Title:

A Microcontroller-Based Development Platform for Regulator Applications

 

(En Microcontrollerbaserad Utvecklingsplatform för Regulatortillämpningar)

 

Author:

Carl F Trefil

 

Examiner:

Lars-Åke Johansson

 

Supervisor:

Erik Hesslow

group 6210 Systems Engineering

Department of New Technologies

AB Volvo, Technological Development

 

Abstract:

The aim of this exam project was to investigate if it is possible to use a microcontroller-based hardware, BaseNode 167, as the hardware base for a development platform used for the designing and testing of regulators. The tools in the BSO/Tasking 80C166 tool chain were used to build and debug test applications. The O'Tool Executive and O'Tool IOS were used as in-target-computer support software. All the parts of the development platform were evaluated and necessary additional in-target-computer support software, CFT I/O Driver Package, was developed. The conclusion of the project is that the development platform is tricky to handle initially. The user must have a thorough knowledge of how to handle and utilise a microcontroller based hardware practically (or be willing to spend the time necessary to develop this skill). Nevertheless, the development platform may prove to be very powerful after a while. The knowledge, practices, and software developed during this project will hopefully make the use of the development platform a lot easier.

 

Contents

 

1. Useful hints when reading this paper *

2. The purpose of the project *

3. Problem formulation and restriction of the scope of the project *

3.1. Three necessary major parts of a development platform *

3.2. A brief description of the old AICC application *

3.3. A list of the available parts of the development platform *

4. The progress of the project *

5. A short description of the available parts of the development platform *

5.1. The development ECU BaseNode 167 *

5.1.1. Controller Board *

5.1.1.1. Microcontroller *

5.1.1.2. Memory *

5.1.2. I/O Board *

5.1.3. The microcontroller C167CW *

5.1.3.1. Some qualities of the microcontroller *

5.1.3.2. The different parts of the microcontroller *

5.2. The BSO/Tasking 80C166 tool chain *

5.2.1. The different parts of the tool chain *

5.2.2. Options/controls *

5.2.2.1. Compiler options *

5.2.2.2. Macro preprocessor controls *

5.2.2.3. Assembler controls *

5.2.2.4. Linker controls *

5.2.2.5. Locator controls *

5.2.3. Output Format Utility options *

5.2.4. Using steering files when calling tools *

5.3. The stand alone load program VIAPC *

5.4. O'Tool Executive *

5.5. O'Tool IOS *

5.5.1. The Device Management Interface and I/O Controller Interface *

5.5.2. The Generic File and Device Access Interface *

5.5.3. O'Tool IOS as base for the C-library *

6. Knowledge, design practices, and software developed during the project *

6.1. Controlling the application building process *

6.1.1. Using the tool chain: calling tools *

6.1.2. Using the Make Utility *

6.1.2.1. Merging all calls and steering files into a single file *

6.1.2.2. A makefile design practice *

6.1.2.3. The use of makefile templates *

6.2. Description of the developed support software additions *

6.2.1. How to perform I/O in an application *

6.2.2. Using CFT I/O Driver Package *

6.2.2.1. Some hints on how the I/O drivers interfere with each other and other programs running in the microcontroller of the ECU *

6.2.2.2. Performing analog input *

6.2.2.3. Performing analog output *

6.2.2.4. Performing input and output on digital ports *

6.2.2.5. Performing frequency measurements of digital signals *

6.2.2.6. Performing asynchronous serial communication *

6.2.2.7. Performing CAN communication *

6.3. An example of the usage of the developed support software additions: the AICC application *

6.3.1. The structure of the application *

6.3.2. What is done in the application *

7. Evaluation of the available parts of the development platform *

7.1. Evaluation of the ECU *

7.1.1. BaseNode 167 *

7.1.1.1. Controller Board *

7.1.1.2. I/O Board *

7.2. Evaluation of the application building tools *

7.2.1. BSO/Tasking 80C166 tool chain *

7.2.1.1. C Cross-Compiler *

7.2.1.2. Macro Preprocessor *

7.2.1.3. Cross-Assembler *

7.2.1.4. Linker/Locator *

7.2.1.5. Output Format Utilities *

7.2.1.6. Make Utility *

7.2.1.7. Debugger *

7.2.2. Stand alone load program VIAPC *

7.3. Evaluation of the in-target-computer support software *

7.3.1. O'Tool Executive *

7.3.2. O'Tool IOS *

8. Is the microcontroller-based development platform suitable for the designing and testing of regulators ? (Conclusions) *

8.1. Requirements on a development platform *

8.2. Are the requirements fulfilled by the available development platform? *

8.3. Is the development platform suitable? *

9. References *

Appendix A *

A.1. Using the microcontroller C167CW and the libraries from BSO/Tasking *

A.1.1. Requirements when using the microcontroller and libraries *

Appendix B *

B.1. Using the O'Tool package *

B.1.1. Details of O'Tool Executive *

B.1.2. Requirements when using the O'Tool package *

Appendix C *

C.1. Debugging an application using the debugger XVW166E v1.1 *

C.1.1. The debugger *

C.1.2. Loading and debugging *

C.1.3. Requirements when using the debugger *

C.1.4. Useful hints when using the debugger *

Appendix D *

D.1. Loading an application using the stand alone load program VIAPC *

D.1.1. The load program *

D.1.1.1. Loading by using the "Boot programs" alternative *

D.1.1.2. Loading by using the "Application program" alternative *

D.1.2. Requirements when using the load program *

Appendix E *

E.1. Terminology used in this paper *

Appendix F *

F.1. Makefile templates for simple applications *

F.1.1. Building for debugging with xvw166e v1.1 *

F.1.2. Building for downloading with VIAPC *

Appendix G *

G.1. A makefile example: the makefile of the adapted AICC application *

 

 

1. Useful hints when reading this paper

The structure of this paper is shown in Figure 1.

The terminology used in this paper is explained in Appendix E.

 

 

 

2. The purpose of the project

Earlier in their work a group called 6210 Systems Engineering (at the Department of New Technologies at AB Volvo, Technological Development) used PC computers when designing and testing regulator applications for use in various test vehicles.

A desire to implement these applications in a more realistic way, pointed at the need to use a microcontroller-based hardware. They had also an idea to use this microcontroller-based hardware environment as part of an actual development platform for regulators.

The purpose of this exam project is to investigate if these ideas are realistic.

 

 

 

3. Problem formulation and restriction of the scope of the project

3.1. Three necessary major parts of a development platform

The aim of this exam project is to investigate if it is possible to use a microcontroller-based hardware (from here on called ECU, Embedded Computation Unit) as the hardware base for a development platform used for the designing and testing of regulators.

At the outset of the project it was assumed that two other major parts were needed as well, to get a suitable development platform :

1) Application building tools, which can be used to build, load and debug the

application which is to be executed in the ECU.

2) In-target-computer support software, for example a real time kernel that supports

pseudo-parallel task processing, and a package of I/O drivers that simplifies communication with the world outside.

 

As a concrete test of the development platform, an AICC (Autonomous Intelligent Cruise Control) application is going to be implemented in the ECU. This application already exists in a version designed for PC. As this version has already been thoroughly tested, it is to serve as a template when developing the new microcontroller-based regulator application.

 

Finally all the hardware, application building tools and support software, which have been used, are going to be evaluated.

3.2. A brief description of the old AICC application

The already existing AICC application that is to serve as a template in this project, is an advanced form of cruise controller, which adapts the speed of the vehicle to the set speed and to the distance to the car in front. The cruise controller implemented in the application is to be used in buses or trucks, when driving on motorways and main roads.

This AICC application is the result of another exam project (refer to [18]).

 

The most important input signals to the cruise controller are the speed of the host vehicle, the distance to the vehicle in front and the differential speed between the two vehicles. Other input signals are fetched from the vehicle driver's pedals, the cruise control stick, the retarder stick and the time gap knob. Output signals are the desired accelerator and electric retarder levels.

 

The function of the regulator, which is embedded in the cruise controller, is to keep the real speed of the host vehicle as near the desired speed value as possible, as long as the real distance to the vehicle in front doesn't fall bellow the desired (safe) distance.

 

For test proposes, the cruise controller can also be manipulated by using the keyboard belonging to the PC in which it is executed. Input, output and regulator-internal signal values are, for the same reason, displayed on the PC screen.

 

The hope has been expressed that the described qualities of the old AICC application will be realised, and that the necessary in-target-computer support software, which isn't available on the market (for example an I/O driver package) will be implemented.

3.3. A list of the available parts of the development platform

ECU:

The development ECU BaseNode 167, developed at Mecel AB, is going to be used.

 

Application building tools:

To build and debug the applications, the BSO/Tasking 80C166 tool chain is going to be used. A stand alone load program, viapc, has been delivered with the hardware from Mecel AB.

 

In-target-computer support software:

To make multitasking possible, the real-time kernel O'Tool Executive, which has been developed at Arcticus Systems AB, is going to be used. The O'Tool IOS package, from the same company, may possibly be used as a framework when realising the necessary I/O software.

 

 

 

4. The progress of the project

At the time when this project was started, the knowledge of how to use the hardware, the support software and the application building tools was slight, nor were there any but dim ideas of where problems would arise. Therefore no strict time plan was drawn up. A first glance at the task indicated that detailed and extensive knowledge of the different parts was necessary.

 

Some of the problems that arose during the project, the approximate points in time when they arose, and the approximate time spent on solving each problem, are listed in the table below. The different stages of the project are also indicated here:

 

 

 

Time

 

 

 

Stage in the project

 

 

Problems

94

Oct.

 

 

<< I studied the whole old AICC application.

 

 

 

 

 

 

 

 

<< The documentation of BaseNode was studied.

 

 

 

 

 

 

 

<< The documentation of O'Tool Executive and of O'Tool IOS were studied.

 

 

 

 

 

Nov.

 

 

<< I learned how to use the BSO/Tasking tool chain.

 

 

 

 

 

 

 

 

 

 

<< The debugger Cross View 80166 did not work at all (xvw166e v1.1 was used in stead).

 

 

 

 

<< The various communication functions of the BaseNode 167 were tested using simple test applications.

 

 

 

 

Dec.

 

 

 

 

 

 

 

 

 

 

 

 

 

<< The I/O Board of BaseNode 167 did not work properly.

 

 

 

 

 

 

 

<< The effects of the various functional problems of the microcontroller C167CW had to be investigated.

 

 

 

 

 

 

 

 

95

Jan.

 

 

 

 

 

 

 

 

 

 

 

 

 

<< There were problems with getting the CAN communication between the host PC and the C167CW running.

 

 

 

 

 

 

 

<< The monitor of viapc had to be adapted to the memory model Large, etc.

 

 

 

 

 

 

 

<< The C-start file, which was delivered along with the BSO/Tasking tool chain, had to be adapted to the BaseNode 167.

 

Feb.

 

 

 

 

 

 

 

 

 

 

<< The various I/O drivers were designed and implemented.

 

 

<< Misapplication of an O'Tool Executive service in some interrupt handlers caused errors that were very hard to remove.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Mars

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Apr.

 

 

 

 

 

<< Problems with the floating point library from BSO/Tasking were detected.

 

 

 

 

 

 

 

<< The test application for the frequency measurement driver "cap_dev" was seriously disturbed by the debugger xvw166e v1.1 .

 

 

 

 

<< The new AICC application was developed.

 

 

<< Additional problems with the floating point library from BSO/Tasking were detected.

 

 

 

 

 

 

 

 

 

May

 

 

 

 

 

 

 

 

 

 

<< This documentation was written.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

June

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

5. A short description of the available parts of the development platform

5.1. The development ECU BaseNode 167

BaseNode 167 is a development ECU (Embedded Computation Unit), developed at Mecel AB.

 

The standard version of BaseNode 167 has two printed circuit boards (pcb) as major physical components:

1) The general purpose Controller Board, which contains the microcontroller

and the memory units, connected with a high speed bus.

2) The I/O Board, which is adapted to the customer's specific needs and which

contains the signal conditioning circuits, power supply, and physical communication interface for CAN and RS232.

The Controller Board and the I/O Board are connected with three inter-board connectors.

 

A custom-made version of the ECU is used in this project. Due to the desired set of I/O connections, the I/O Board has been supplemented with an additional circuit board (not shown in Figure 3) where some of the signal conditioning circuits have been placed.

5.1.1. Controller Board

The Controller Board of BaseNode 167 contains the following physical units:

1) A microcontroller chip.

2) Two RAM memory chips, with the total size 256 kb.

3) Two flash programmable ROM memory chips (below referred to as "flash

memory"), with the total size 256 kb. These memory chips are reprogrammed, without removing them from the ECU, by using the stand alone load program viapc.

4) An I/O interface (coupled to the inter-board connectors).

 

The subset of microcontroller qualities, which can be utilised by the microcontroller programmer when working with the ECU, is among other things determined by

1) ...how the address and data parts of the external bus are coupled to the

microcontroller, and which of the available bus control signals that are used. The bus configuration used is fixed, and is obtained by setting the general system configuration and external bus interface configuration. How this is done is described in the section called "Microcontroller".

2) ...how the physical memory units are mapped to the logical address space. This

mapping is done by hardware, and it is described in the section called "Memory".

3) ...how the signal conditioning circuits for digital I/O, analog I/O (analog input and

analog output) and capture/compare I/O (capture input and compare output) are mapped to the port pins of the microcontroller. It is also determined by whether, and in that case how, the physical communication interfaces for RS232 and CAN are mapped to the port pins of the microcontroller. This mapping is described in the section called "I/O Board".

4) ...in which mode the microcontroller is started. The appropriate mode can be

selected by the user. Read more about this in the section called "Microcontroller".

5.1.1.1. Microcontroller

The heart of the ECU is the microcontroller C167CW from Siemens. The microcontroller is supplied with a 16 MHz signal, which controls the CPU clock frequency.

 

The general system configuration of the microcontroller is normally set by the execution of the C-start function at the beginning of the execution of the application. A default C-start function is delivered in a C-start file along with the application building tools. This file has to be adapted to the specific needs of the ECU, of which the microcontroller is a part. An adapted version, called "bn167_cs.s", is found in directory CALLE\MECEL\CSTART.

 

The external bus interface configuration of the microcontroller is determined by the states of the port P0 pins at power up reset. In this particular case these states are achieved by external pulldown resistors, which have been placed on the Controller Board. The result of this configuration is, among other things , that the bus mode is non-multiplexed, that the bus data width is 16 bits, and that no more than 5 Mbyte of memory space can be addressed.

 

Using a jumper on the I/O Board (refer to the sections called "Requirements when using the..." in Appendix C and D respectively), the microcontroller can be configured to start in two different modes:

1) Bootstrap Loader Mode, which implies that the bootstrap function of the

microcontroller is activated at power up reset.

2) Normal Mode, which implies that the microcontroller starts to execute the code

"pointed to" by interrupt vector No. 0h. This might be the C-start function, if it has been merged with the application.

 

For more information about the microcontroller refer to the section called "The microcontroller C167CW".

5.1.1.2. Memory

The version of BaseNode 167 used in this project has only a 512 kbyte physical memory space, of which 256 kbyte is RAM and 256 kbyte is flash memory.

 

When the stand alone load program viapc is to be used, flash memory sector 0 (32 kbyte of the available ROM memory) is reserved for the Base Block, which contains the code and constant data of the monitor part of viapc.

As the ROM memory in this case must be mapped (by hardware) to the lower part of the logical memory space (refer to the section called "Requirements when using the load program" in Appendix D), this sector corresponds to the memory range 00000h - 07FFFh.

The memory range corresponding to the flash memory sectors 1-7, can (with some restrictions, refer to Appendix D) be utilised to store the Application Block, which contains the code and constant data of the actual application.

 

When the memory is used as described in the paragraph above, the map between physical and logical memory space, appears as in Figure 2. For the sake of completeness, the figure has been supplemented with a view that relates these memory spaces to the way the microcontroller represents code and data addresses.

 

 

When an application is to be debugged, using a debugger from BSO/Tasking, the RAM memory must be mapped (by hardware) to the lower part of the logical memory space (refer to the section called "Requirements when using the debugger" in Appendix C).

 

The 2 kbyte internal RAM (IRAM) of the microcontroller, the internal memory of the on-chip CAN module and some reserved areas of the microcontroller, correspond to the memory range 0EF00h - 0FFFFh. When the ROM memory is mapped (by hardware) to the lower part of the logical memory space, this range overlaps a small part of the flash memory sector 1 (refer to Figure 2). This small part of flash memory is (or should be) hidden from the microcontroller and thus this part of the flash can't be used to store code and constant data.

5.1.2. I/O Board

In general, the I/O Board of BaseNode 167 contains the following physical units:

1) Power supply circuits.

2) Signal conditioning circuits for digital, analog, and capture/compare I/O.

3) Physical communication interface for RS232.

4) Physical communication interface for CAN.

5) Three inter-board connectors, which are used to couple the Controller Board and

the I/O Board.

 

The I/O Board is adapted to the customer's specific needs, concerning:

1) The number of units of each type of microcontroller I/O connections that is

needed at the I/O Board connector.

2) The supply voltage.

 

The requirements on the configuration of the I/O Board used in this project, is shown in the table below :

 

Function

Number

Type

Comments

Supply voltage

-

24V

-

DI

10 pins

Active low

1 x [0-8V ,capture/compare function],

9 x 0-24V

DO

4 pins

Measurements relative GND

0-24V, must be able to supply >100mA

AI

2 pins

-

0-5V

AO

2 pins

-

0-5V

voltage output

1 pin

-

5V

RS232

1 port

-

-

CAN

1 port

-

-

 

Due to these requirements, the I/O Board has been supplemented with an additional circuit board (not shown in Figure 3) where some of the signal conditioning circuits have been placed.

The required I/O connections have been mapped to the I/O Board connection pins as shown in Figure 3.

 

5.1.3. The microcontroller C167CW

The heart of the ECU is the microcontroller C167C from Siemens, or to be more precise, the engineering sample C167CW, which has several functional problems. For further information about these functional problems, refer to the errata sheet for C167CW [6].

Serial production of the improved variant C167CR was started in December 1994, after the start of this project.

5.1.3.1. Some qualities of the microcontroller

Note the following qualities of the microcontroller:

* 16-bit CPU with four-stage pipeline, which gives a 125 ns minimum instruction

cycle time, a 625 ns multiplication (16-bit*16-bit) and a 1.25 m s division (32-bit/16-bit). Thus the maximum execution speed is 8 million instructions per second. It is here assumed that a 16 MHz CPU clock is used.

* The memory space is configured in a Von Newmann architecture, which means

that code memory, data memory, registers and I/O ports are mapped to the same linear address space (logical memory space).

When accessing code, the memory appears to be divided into blocks, segments, with the size of 64 kbyte. When accessing data (both variable and constant) the memory appears to be divided into blocks, pages, with the size of 16 kbyte. That is, a segmented approach is used when addressing code and a paged approach is used when addressing data.

* Multiple fast internal buses.

* Flexible external bus interface.

* 2 kbyte of fast accessible internal RAM.

* Interrupt system with 16 interrupt priority levels. Each interrupt priority level can

be assigned to at most 4 interrupt sources, which must be assigned different group levels. If two interrupts with the same interrupt priority level occur simultaneously, the one with the highest group level has precedence. There is a 375/625 ns typical/maximum interrupt latency. It is here assumed that a 16 MHz CPU clock is used.

* 8-channel Peripheral Event Controller (PEC) with 250/563 ns typical/maximum

interrupt latency.

* Numerous on-chip peripheral subsystems (refer to Figure 4).

* On-chip CAN module, which implements the CAN 2.0 ISO standard for a physical

layer used for communication. This module communicates with the CPU via the external bus interface and is connected to an on-chip supplement of the external bus called XBUS.

* Individual addressable I/O port pins.

5.1.3.2. The different parts of the microcontroller

The system modularity of the microcontroller is shown in Figure 4.

 

 

As shown in Figure 4, the microcontroller contains the following modules :

* CPU Core, which is the base of the controller.

 

(System Resources:)

* Peripheral Event Controller (PEC), which contains 8 channels that are used for

interrupt-driven transfers of data between RAM memory and registers of Peripheral Subsystems.

* Interrupt Controller, which administers the interrupts from all interrupt sources

(System Resources, Peripheral Subsystems and external sources) in a uniform way.

* Bus Controller (BUSCTL), which contains the External Bus Controller (EBC).

* Clock generator (OSC), which filters the externally supplied clock signal to

generate a CPU clock signal. The clocks of the Peripheral Subsystems are based on the CPU clock.

 

(Peripheral Subsystems:)

* Parallel Ports (P0...P8), which have a width of 4 -16 bits, and which provide 111

I/O lines.

* Asynchronous/Synchronous Serial Channel (ASC0).

* High-speed Synchronous Serial Channel (SSC).

* General Purpose Timer Units GPT1 and GPT2, which contain the general

purpose timers T2, T3, T4, and T5, T6, respectively.

* Watchdog Timer (WDT), which can be used as a fail-safe mechanism.

* Capture/Compare Units (CAPCOM1 and CAPCOM2), which contain 16 channels

each, and which also contain the dedicated timers T0, T1, and T7, T8, respectively. These channels are for example used to capture edges or generate simple pulses on digital ports.

* Pulse Width Modulation Unit (PWM), which contains 4 channels that are used to

generate pulses on digital ports. By filtering these pulses you can produce an analog output signal.

* A/D Converter (ADC), which contains 16 analog input channels.

 

(Modules connected via XBUS:)

* CAN module, which contains 15 channels, of which one is input only.

5.2. The BSO/Tasking 80C166 tool chain

The BSO/Tasking 80C166 tool chain is used to build and debug applications to be executed in microcontrollers belonging to the SAB 80C166 or C16x microcontroller families from Siemens.

5.2.1. The different parts of the tool chain

Included in this tool chain is the following type of tools:

 

* Tool:

80166 C Cross-Compiler

v4.0 r2

Name of the executable:

c166.exe

 

Name when mentioned in this paper:

 

c166

 

Input file:

C code source file.

(default suffix .c )

Function:

To compile C code.

Output file:

Assembly source file (without any assembly language macros).

(default suffix .src )

 

Comments:

-

 

* Tool:

80166 Macro Preprocessor

v4.0 r2

Name of the executable:

m166.exe

 

Name when mentioned in this paper:

 

m166

 

Input file:

Assembly source file.

(default suffix .asm)

Function:

To preprocess assembly source files which contain macros.

Output file:

Assembly source file (without any assembly language macros).

(default suffix .src )

 

Comments:

The assembly language macros are in fact a small language of its own, which constitutes a powerful tool to create flexible assembly code.

 

* Tool:

80166 Cross-Assembler

v4.0 r2

Name of the executable:

a166.exe

 

Name when mentioned in this paper:

 

a166

 

Input file:

Assembly source file (without any assembly language macros).

(default suffix .src )

Function:

To assemble code, which is generated by m166 or c166, or code (without any assembly language macros) which is directly written by the user.

Output file:

Relocatable object file.

(default suffix .obj )

 

Comments:

-

 

* Tool:

Linker:

80166 Linker/Locator

 

v4.0 r2

Name of the executable:

l166.exe link

 

Name when mentioned in this paper:

 

"the link stage of l166"

 

Input files:

Relocatable object files and object library files.

(default suffix .obj )

Function:

To merge a number of relocatable object files, which are generated by the a166, with the supplied object libraries (if any).

Output file:

Relocatable link file.

(default suffix .lno )

 

Comments:

-

 

* Tool:

Locator:

80166 Linker/Locator

 

v4.0 r2

Name of the executable:

l166.exe locate

 

Name when mentioned in this paper:

 

"the locate stage of l166"

 

Input files:

Relocatable object files, relocatable link files and object library files.

-

Function:

To allocate a number of relocatable object files (if any), relocatable link files (the latter correspond to relatively self-supporting program units), and the supplied object libraries (if any) into a single absolute object file.

This file is loadable.

Output file:

Absolute object file.

(default suffix .out )

 

Comments:

As the stated names of the tools indicate, the linker and locator tools are integrated in the same executable. A command line argument (link and locate, respectively) is used to choose the desired stage.

 

* Tools:

Output Format Utilities:

(1) 80166 IEEE-695 Formatter

(2) 80166 Intel Hex Formatter

 

v4.0 r2

v4.0 r2

Name of the executable (1):

ieee166.exe

 

Name of the executable (2):

ihex166.exe

 

Name when mentioned in this paper (1):

 

ieee166

 

Name when mentioned in this paper (2):

 

ihex166

 

Input file:

Absolute object file.

(default suffix .out )

Function:

To format (convert) the absolute object file into a file that is suitable for the type of (a) downloading and (b) execution of the application you are interested in at the moment.

Output file (1):

XVW166 load file.

(default suffix .abs )

 

Output file (2):

Intel Hex format file.

(default suffix .hex )

 

Comments:

If, for example, you want to debug the application using a debugger from BSO/Tasking (referred to as XVW166 above), you should use ieee166 to process the absolute object file.

If, on the other hand, you want to load the application using the stand alone load program viapc, from Mecel AB, you should use ihex166 to process the absolute object file.

 

* Tool:

80166 Debugger for EVA 166

v1.1

Name of the executable:

xvw166e.exe

 

Name when mentioned in this paper:

 

xvw166e v1.1

 

Input file:

XVW166 load file.

(default suffix .abs )

Function:

To provide the necessary support for loading an application into and debugging this application in BaseNode 167. The download is made by using the bootstrap function of the microcontroller in the ECU.

Comments:

For a detailed description of xvw166e v1.1, refer to Appendix C.

 

There are also some other tools included in the tool chain. Two of these, the Make Utility and the Steering Program, are described in the section called "Using the tool chain: calling tools". The library manager and the disassembler is of no interest in this context.

5.2.2. Options/controls

The tools in the tool chain are controlled by the use of options (for the tools which have got a more expressive and language-like set of options these are called controls). These options are supplied to the respective tool by writing them as command line arguments when calling the tool. This procedure is probably well known to you.

In the following subsections the purpose of the possible options for the tools in the chain are described briefly.

5.2.2.1. Compiler options

By default c166

* ...adapts the generated assembly code to the memory model Small.

* ...makes almost all possible code optimisations. These are based on both

assembly code density and code execution speed criteria.

* ...instructs the assembler to minimise the amount of symbolic information

transferred to the relocatable object file, generated in the next stage of the tool chain. The compiler brings about this by inserting certain controls in the assembly code it generates. Symbolic information is used by debug programs.

* ...keeps the amount of information presented to the user as limited as possible.

For example, the following information is left out:

- The error report file.

- The C code in the form of comments in the resulting assembly file.

 

You have to adjust the default behaviour of c166, when, for example, you want to

* ...adapt the generated assembly code to one of the memory models Tiny,

Medium or Large.

* ...optimise the generated assembly code in some other way.

* ...adapt the output file to create an application component, which is suitable for

tests in a debugger.

* ...adapt the generated assembly code to a special type of library.

* ...make the interrupt handling more robust.

* ...get more information about the compilation.

 

The adjustments are accomplished by the use of compiler command line options.

If you are interested in learning a usable set of compiler options, study for example the macro "CFLAGS" in the makefile for the AICC application ( refer to Appendix G).

5.2.2.2. Macro preprocessor controls

When designing an assembly source file, it is easy to make it more flexible by using conditional assembly. This is realised by inserting assembly language macro instructions in the code and preprocess the code using m166. By supplying a macro definition as a command line argument when calling m166, the user is able to include or exclude portions of the assembly code.

5.2.2.3. Assembler controls

In practice just a few assembler controls are used as command line arguments. The controls that are used in this way, deal with the information about the assembly process which is presented to the user. Most of the assembler controls are instead inserted directly into the assembly code. This is for example done by c166, when generating assembly code.

5.2.2.4. Linker controls

Most of the controls needed to steer the link stage of l166 , affect which libraries to link to the supplied relocatable object files and the information about the link process which is presented to the user.

5.2.2.5. Locator controls

The amount of controls needed to steer the locate stage of l166 is by far the largest, compared to the amount used for the other tools in the chain. These controls are used to in order to

* ...couple link files containing interrupt procedures to interrupt vectors in the CPU.

* ...define which memory ranges that correspond to ROM memory (used for

program code and constants), and also to define which memory ranges that correspond to RAM memory (used for variables and dynamically allocatable memory areas).

* ...reserve memory ranges where no code or data should be placed.

* ...specify where the logically defined relocatable code and data sections shall be

placed (this can be done in a number of ways).

* ...regulate the amount of information from the allocation process presented to the

user, for example which information that should be included in the map file.

5.2.3. Output Format Utility options

No options were needed for the output format utilities.

5.2.4. Using steering files when calling tools

The number of options/controls needed to steer the tools are, in most cases, too large to be put directly on the command line, when calling the respective tool. Therefore it is always possible to supply the options/controls via a steering file (an ordinary text file), by supplying the file name on the command line. The syntax of these files differs slightly, but as a rule of thumb it is always unwise to write more than one option/control on a single row in a steering file.

5.3. The stand alone load program VIAPC

The stand alone load program viapc makes it possible to download applications into BaseNode 167. Here is a short description of this tool:

 

Tool:

VIAPC

 

Name of the executable:

viapc.exe

 

Name when mentioned in this paper:

 

viapc

 

Input file:

Intel Hex format file.

(has suffix .hex )

Function:

To load an application into BaseNode 167, either by using the bootstrap function of the microcontroller in the ECU, or by calling the monitor part (Base Block) of viapc, that has already been downloaded to the ECU.

Comments:

For a detailed description of viapc, refer to Appendix D.

5.4. O'Tool Executive

O'Tool Executive is a multitasking real-time kernel for microcontroller based environments. It is based on Ada concepts.

The real-time kernel version, which is used in this project, supports

1) parallel activities (processes), which when mentioned in this paper are referred

to as O'Tool tasks or just tasks, and the scheduling of these tasks according to priority or by the use of time slicing. The time slicing mechanism must be triggered by calls from an interrupt handler.

2) activation, abortion, and termination of tasks.

3) co-operation (synchronisation and communication) between different tasks

according to the rendezvous concept (synchronous communication), and the mailbox concept (asynchronous communication).

4) communication between interrupt handlers and tasks according to the mailbox

concept (i.e. interrupt handlers can send signals to tasks), or via buffers that are implemented as resources (refer to 4).

5) resource handling. A resource is considered to be an entity which can be used

by only one task at a time. Both tasks and interrupt handlers are able to request and release resources.

6) dynamic memory. Different memory partitions are left to be managed by O'Tool

Executive. Pools of data buffers can be created in these memory partitions. On request, the tasks are supplied with data buffers from these pools. The data buffers can be returned when they have been used.

7) time handling. O'Tool Executive maintains an internal clock, which must be

incremented by calls from an interrupt handler. The real-time kernel uses this clock as a reference, when handling time supervisions requested by various tasks. For example, a task can request to delay its execution for a number of clock ticks, while waiting for a service to become available from O'Tool Executive.

8) exceptions. When O'Tool Executive is unable to deliver a service, an

exception is raised. This indicates that the configuration of the software system is inaccurate. For example, the memory partitions given to the real-time kernel may be too small.

 

Some of the services delivered by the real-time kernel are illustrated in Figure 5.

 

More details of this particular version of O'Tool Executive are presented in Appendix B.

5.5. O'Tool IOS

The O'Tool IOS (O'Tool Input and Output System) package promotes a well structured, layered approach when designing an I/O driver, which implements an I/O operation by controlling the corresponding I/O device.

It also provides a Generic File and Device Access Interface, which conforms to the standard UNIX device and file access interface, a Device Management Interface, and an I/O Controller Interface.

When supported by O'Tool IOS, an I/O driver is supposed to be composed of two layers. The lowest layer is the I/O Controller layer, which is meant to manipulate the hardware device directly. The layer above is the Device Handler layer, which is meant to interpret the incoming data and prepare the outgoing data.

The relations between the above-mentioned interfaces and layers are shown in Figure 6.

 

 

 

Before using a driver to perform an I/O operation, a driver object must be created, i.e. a unique "copy" of the driver is produced and storage is reserved for the internal data that is needed by this "copy". This creation can be performed in the application by using the Device Management and the I/O Controller interfaces.

Furthermore the driver object must be initiated, i.e. the object is adapted to the specific operation that shall be performed, and it is coupled to the specific device that it is meant to control (if several devices of the same type exist).

A link must also be created between the application and the driver object. This is accomplished by opening an access path to the driver object in question. The path is identified by an unique file descriptor.

The initiation, the opening of an access path, and the following use of the driver object to achieve I/O can be performed in the application by calling the Generic File and Device Access Interface.

5.5.1. The Device Management Interface and I/O Controller Interface

A driver object is composed of a Device Handler object and an I/O Controller object, which correspond to the two layers of the driver.

The routines necessary to create a driver object are:

* otool_IOC_NEW (...) , which belongs to the I/O Controller Interface, and

which creates the I/O Controller object.

* otool_DEV_NEW (...) , which belongs to the Device Management Interface,

and which creates the Device Handler object.

* otool_IOC_ATTACH (...) , which belongs to the I/O Controller Interface, and

which attaches an I/O Controller object to a Device Handler object.

 

Among other things the Device Handler and I/O Controller objects are given unique names, whose extensions are specified by calling the application, when the various objects are created. The base parts of the names are the epithets of the specific Device Handler and I/O Controller layers respectively.

 

The name of the Device Handler object is used to identify the driver object, when it has been created. This name is used when opening a path to the driver object.

5.5.2. The Generic File and Device Access Interface

The following routines belong to this interface:

* otool_OPEN (...) , opens an access path to a driver object and the

corresponding device. The path identity is returned in the form of a file descriptor. When the application calls this function, the driver object is specified by using its unique name, which has been defined when creating the object..

* otool_IOCTL (...) , initiates a created driver object and its device.

* otool_READ (...) , reads data from a device via the driver object.

* otool_WRITE (...) , writes data to a device via the driver object.

* otool_CLOSE (...) , deletes an opened access path to a driver object and its

corresponding device.

 

When the application calls the last four above-mentioned routines, the device you want to manipulate is specified by using a unique file descriptor, which is fetched by using 'otool_OPEN'.

5.5.3. O'Tool IOS as base for the C-library

If you want to use the high level file descriptor controlled I/O routines, which are implemented in the C-library of c166 and whose function prototypes are declared in the include file "stdio.h", you have to couple them to a lower I/O layer. This is due to the fact that these I/O routines do not have any proper connection to any hardware devices. O'Tool IOS can be used as a framework when implementing the I/O drivers of the necessary lower I/O layer.

 

 

The connection between the C-library and the lower I/O layer is made via simple adapter functions, as shown in Figure 7.

However, the use of I/O routines from the C-library is not recommended, due to the amount of nestled function calls that are generated, when performing an I/O operation.

 

6. Knowledge, design practices, and software developed during the project

The findings of this project can be divided into four major parts:

 

1) Detailed knowledge of the requirements when building applications of

various types. These requirements are presented in Appendix A - D. Useful information about how to use viapc and xvw166e v1.1 in practice, is also included here.

 

2) A makefile design practice, which is a suggestion of how to design a makefile

that is used to steer the Make Utility when building an application. This practice has been developed from the makefile example delivered along with the O'Tool package, and is useful when administering the application building process.

 

You will find a description of how the practice developed and of its appearance in the section called "Controlling the application building process".

 

3) The developed support software additions, which consist of CFT I/O Driver Package.

The use of this package is described in the section called "Using CFT I/O Driver Package". The I/O drivers in this package give the application programmer the possibility to perform I/O with a minimum of knowledge of the hardware.

 

4) An adapted version of the AICC application software, which is designed in

accordance with the developed application design practice, and which utilises all the available in-target-computer support software. It is built with the help of the makefile design practice.

The application is described in the section called "An example of the usage of the developed support software additions: the AICC application".

Due to the lack of time this application was never tested as a whole!

6.1. Controlling the application building process

Those who are used to the protected programming environment of a personal computer (or work station), might be surprised when confronted with some aspects of the microcontroller-based programming environment of this project. Among other things it is much more difficult to get a simple test application running. Often, in the PC programming environment, the only thing you have to do when you want to build your application is to call the compiler, using a list of the files to compile as an argument. All the parts are compiled, linked together, and located without any further specifications made by the user. When you want to run your executable program just write the name of it, and the operating system takes care of the necessary loading of the program into the memory and then starts its execution. When you want to communicate with the outer world the libraries connected to the compiler often include the necessary communication routines. Otherwise you just write the name of a suitable, commercially acquired, communication library among the other file names on the command line, when calling the compiler. You will then have access to a number of powerful communication tools.

 

The above scenario is, as you well know, described in rather too positive terms. Nevertheless, it will serve as a good reference, contrasting the situation when you work with the clean, microcontroller-based programming environment of this project. In this case the meaning of "clean" is that you have not got any application building tools, which are adapted to the specific ECU that is used, and not much in-target-computer support software.

 

When you confront this clean environment, you will soon realise that some of the application building tools that are used need a complex set of instructions to function, especially the instruments used to link and locate the program code. This is due to the fact that

1) ...the application building tools of the BSO/Tasking 80C166 tool chain are

designed to be able to process program code intended for a range of similar processors.

2) ...the microcontrollers (for example the C167CW used in this project), for which

the application building tools are intended, are powerful and thus complex.

 

The problem of how to steer the application building tools is discussed in the subsections below. The problem generated by the lack of in-target-computer support software, is discussed in the section called "How to perform I/O in an application".

6.1.1. Using the tool chain: calling tools

As mentioned above, the BSO/Tasking 80C166 tool chain is used in this project to build and debug the applications.

This tool chain is briefly described in the section called "The BSO/Tasking 80C166 tool chain".

 

To build an application and generate a load file, which can be downloaded to the microcontroller of the ECU in some way or another, a lot of tools of the BSO/Tasking tool chain must be called. If there are a lot of source files and libraries to be processed and merged, it will be far too time-consuming to call the tools manually. Add to this the extensive, but nevertheless necessary, use of command line instructions to some of the tools, and the problem of keeping the result files from the tools up-to-date, without going through the whole application building process every time you change a detail in some part of the source code.

 

Thus it was soon realised that a tool was needed to administer the application building process. Two tools, which have the potential to fit this need, are included in the BSO/Tasking tool chain:

 

1) Tool:

80166 Steering Program

v4.0 r2

Name of the executable:

cc166.exe

 

Name when mentioned in this paper:

 

cc166

 

Input files:

Any input file in the tool chain.

-

Function:

To build applications by calling the other tools in the chain. By supplying cc166 with proper command line options, the user is able to build a relatively small and simple application in just one call. The tool calls the necessary tools in the tool chain, according to the stated options.

Output file:

Any output file, which can be generated from the supplied input files with the help of the other tools in the tool chain.

-

 

Comments:

When the application grows more complex, cc166 becomes blunted, because of the trouble in telling the tool what to do, and the difficulty in understanding what the tool really does and how it performs its job.

 

2) Tool:

Make Utility:

80166 Program Builder

 

v4.0 r2

Name of the executable:

mk166.exe

 

Name when mentioned in this paper:

 

mk166

 

Input files:

Any input file in the tool chain.

-

Function:

To build and update applications by calling the other tools in the chain. By supplying mk166 with a makefile, which contains building instructions, the user is able to build a large and complex application in just one call. The tool only builds the application components that are out of date.

Output file:

Any output file, which can be generated from the supplied input files with the help of the other tools in the tool chain.

-

 

Comments:

Compared to cc166, mk166 offers a more comprehensive and powerful way of attacking the problem of administering the application building process. Read more about this tool in the section called "Using the Make Utility". mk166 is able to call cc166.

 

Perhaps, someone gets the idea to use PC bat files when building applications. This might be suitable for small applications, but all services that may be offered by a bat program (and a lot more) can be performed by mk166.

6.1.2. Using the Make Utility

The need for a tool giving support to the task of administering the generated files when building an application, became obvious almost immediately during the work with the microcontroller-based programming environment. mk166 gives the necessary support.

6.1.2.1. Merging all calls and steering files into a single file

mk166 is controlled by a makefile (an ordinary text file) supplied by the user. In this file the user defines the hierarchy of files which must be created, before the final load file can be generated. The user also specifies how the various files in the hierarchy are generated.

The contents of a steering file, the name of which is supplied at the command line when calling a tool in the makefile, can be written directly in the makefile. mk166 makes a temporary file out of the specified options/controls, and feeds this file to the tool when calling it. In this way all information about the application building process can be gathered in one single file.

 

Together with a close in-file documentation (including a header page and plenty of comments), a uniform structure in all makefiles, and an extensive use of macros, the use of makefiles becomes a powerful way of keeping track of the application components.

 

Here are some of the advantages:

* It is relatively easy to keep the application up-to-date, when changes are

made in the source modules.

* It is easy to inspect which application components that are used to build an

application.

* It is easy to survey the structure of the application, in spite of the size of the

makefile, which is normally quite large.

* It is easy to emphasize differences in structure between applications.

* It is easy to emphasize differences in the way applications are built. For instance,

one type of procedure is appropriate, when the goal is to generate a final product to be loaded with the stand alone load program viapc, and another procedure is appropriate, when the goal is to debug the final product with a debugger from BSO/Tasking.

* Re-usability is high, because of the uniform makefile structure.

6.1.2.2. A makefile design practice

The test applications, which were used to test the drivers of CFT I/O Driver Package, typically contain the application components shown in Figure 8.

A more general application can be built from a similar set of application components. However, the number of drivers, belonging to CFT I/O Driver Package (refer to the section called "Using CFT I/O Driver Package"), can vary between 1 and 6.

 

When building one of these test applications, the majority of the application components are compiled/assembled and then linked into one single relocatable link file.

 

The rest of the modules are either assembly code modules or relocatable link files, which each contains a low level interrupt handler (a task procedure that implements a Siemens Interrupt Task). After the assembly code modules have been assembled and linked into a relocatable link file each, all these application components are merged with the rest of the application during the locate stage. The low level interrupt handlers are also coupled to their respective interrupt vectors during this stage.

 

When building a more general application, which contains several I/O drivers, it is wise to link C code modules belonging to a single driver into a separate relocatable link file. This file is merged with the rest of the application during the locate stage. This gives the makefile a better structure.

 

The information flow generated, when building one of these test applications, has roughly the appearance shown in Figure 9.

To build and administer a test application, a makefile structure as shown in Figure 10 is appropriate.

 

If you are interested in learning about the details of how to write makefiles, refer to the makefile templates in Appendix F, or refer to the makefile for the AICC application (Appendix G).

6.1.2.3. The use of makefile templates

It is quite easy to produce makefile templates. Different makefile templates are needed for applications with different general structures and for the different ways of building the applications.

There is one problem, though. Especially when you are expanding an old application (increasing code size, adding more I/O drivers, using additional C library services etc.), there is always a risk that the controls for steering the locate function become inadequate. This will make the locate function unable to allocate all code and data sections correctly. For the inexperienced user, this failure of the tool chain may be very time-consuming to correct.

6.2. Description of the developed support software additions

6.2.1. How to perform I/O in an application

The C library which belongs to c166, includes a minimum amount of the routines that are suggested in the ANSI standard. The supplied routines are only a portion of the functions which are suggested to have their function prototypes declared in the include files "stdlib.h", "stdio.h", "math.h" and "string.h". On the surface this seems to be all one needs to build sophisticated applications. There is, however, a problem, which is hard to solve for the inexperienced microcontroller programmer. The powerful functions declared in "stdio.h" have no bottom, in the sense that, when an actual I/O operation is to be performed, they call a dummy function. There is one such function for reading and another one for writing. The result is that all the high level file descriptor controlled I/O functions you normally have access to in a PC programming environment are useless, unless you have bought a complete I/O library, which can realise the functions needed in this upper I/O layer, defined in the C library of c166.

 

In this project there was no library containing the necessary lower layer I/O routines available. Two possible solutions to this problem existed:

1) To implement each different type of I/O operation as tightly as possible, by

taking only the needs from the AICC application into consideration.

2) To design a general I/O package, which gives a uniform interface to the various

types of I/O operations. This solution would probably give the largest code size of the final application.

 

Since the purpose of this project partly was to design a development platform based on BaseNode 167, the second solution was chosen. By choosing this alternative, the opportunity was given to test the O'Tool IOS package as a framework for the I/O drivers, which were to be implemented.

 

If you are interested in finding out how this choice worked out, please refer to the section called "Evaluation of the in-target-computer support software".

6.2.2. Using CFT I/O Driver Package

In this section the use of the developed package of I/O drivers, CFT I/O Driver Package, will be explained. Just a minimum of details of how the drivers work are included. When there is an obvious risk of using an I/O driver incorrectly, details are supplied to explain how the driver works internally.

 

The source files of the various I/O drivers are found in their respective sub-directories in the directory CALLE\IO_C167.

6.2.2.1. Some hints on how the I/O drivers interfere with each other and other programs running in the microcontroller of the ECU

If you not are careful, there is always a risk that different program parts will interfere with each other. Potential sources of errors are:

1) Two program parts try to use the same resource (e.g. a timer unit) as if they

were the only user .

2) Two program parts make erroneous initiations of a shared resource (e.g. a CAN

circuit, or a timer unit containing several timers), thus affecting each other.

3) A time critical interrupt-driven program part is disturbed by the other interrupts

(almost everything in a real time application, implemented in an ECU, has to be interrupt-driven...).

 

It is therefore necessary to specify clearly which resources and interrupts that a distinct small program part requires. This is made below, when each type of I/O driver is presented. It is also helpful to make a summary of the total use of an entire application.

 

NOTE that the routines, which are used for creation and initiation of driver objects of a specific I/O driver, are not reentrant. Thus only one task a time should be able to call the initiation and creation routines of the I/O driver in question.

 

 

6.2.2.2. Performing analog input

The described driver is called "ai_dev" (which is also the name of the Device Handler layer it contains).

"ai_dev" is used to measure analog signal levels.

Basic information about the analog input driver "ai_dev"

Due to the difference in resources used, when performing analog input and analog output, these operations have been implemented as two separate I/O drivers.

 

Source files:

* The Device Handler and I/O Controller layers of the driver are implemented in the

C code files "ai_dev.c" and "ai_ioc.c", respectively. When the driver is to be used, the compiled results of these files must be merged with the application during the link stage.

* The assembly file "ai_int.s" contains a low level interrupt handler for the analog

input operation. When the driver is to be used, the linked results of this file must be merged with the application during the locate stage.

 

Include files:

* Two out of four data structures needed when creating a driver object, have to be

supplied from the application. The type definitions needed to define these data structures are defined in "ai_ioc.h" and "ai_dev.h", which have to be included in the application, when the driver is to be used.

* The files "macro.q" and "model.q" are needed when macro preprocessing

"ai_int.s", because they are included in the assembly file.

 

Device:

The driver supports the A/D Converter (ADC) of the microcontroller C167CW . Since the "W" version is an engineering sample of the C167C circuit, it has several functional problems. Therefore the more advanced functions of the ADC module cannot be used by the I/O Controller layer.

 

No error detection mechanisms in the module are supported by the driver.

 

Interrupt:

The I/O driver uses the end-of-conversion interrupt generated by the ADC module. The interrupt is connected by hardware to interrupt vector No. 28h. The CPU interrupt level that is used is defined in the above-mentioned include file "ai_ioc.h". The low level interrupt handler, defined in "ai_int.s", must be called when an interrupt occurs.

Using the analog input driver "ai_dev"

Creation:

Two out of four data structures needed when creating a driver object, have to be supplied from the application. Thus one structure of the type 'ai_ioc_IOCB_TYPE' and one of the type 'ai_dev_DCB_TYPE' must be defined for each object which is to be created.

 

The I/O driver supports the parallel use of up to 16 analog input channels and their corresponding driver objects. The Device Handler object of a driver object must be created before its I/O Controller object.

 

A call to the routine 'ai_ioc_init' must be made before any driver objects are created.

 

Open a path:

The name of the Device Handler object ("ai_dev", plus the specified extension) is used when opening a path to the corresponding created I/O driver object.

 

Initiation:

When using the I/O Controller Parameters, the user is able to influence

1) ...the conversion timing:

- Conversion Clock t_cc = 32 , 64 or 128 times TCL.

- Sample Clock t_sc = 1, 2, 4 or 8 times t_cc.

The total conversion time is: 10*t_cc+2*t_sc+4*TCL, where TCL = one period of CPU clock.

2) ...which port P5 pin (No. 0...15) to measure.

 

Default settings are: t_cc = 32 *TCL, t_sc = 1 *t_cc and that P5.0 is measured.

 

A call to the routine 'ai_channel_init' must be made after each separate driver object has been created and its parameters have been set to the desired values.

This is done via the Generic File and Device Access Interface, as the last step of the initiation procedure for each driver object.

 

Reading analog values:

When calling the read operation via the Generic File and Device Access Interface, an A/D conversion of the voltage, on the port P5 pin belonging to the specified driver object, is initiated.

The result of the A/D conversion is returned as a floating point value ( of the type 'float' ), which is put directly into the input buffer. Thus the total size of the input buffer, which is provided by the caller, must be equal to or larger than the size needed to store a variable of the type 'float' (4 bytes). You have to use a type cast in the application to get the floating point value out of the input buffer.

 

The result is normated to the range 0-5 V.

No write-operation is implemented in this I/O driver.

 

6.2.2.3. Performing analog output

The described driver is called "ao_dev" (which is also the name of the Device Handler layer it contains).

"ao_dev" is used to output analog signal levels.

Basic information about the analog output driver "ao_dev"

Due to the difference in resources used, when performing analog input and analog output, these operations have been implemented as two separate I/O drivers.

 

Source files:

* The Device Handler and I/O Controller layers of the driver are implemented in the

C code files "ao_dev.c" and "ao_ioc.c", respectively. When the driver is to be used, the compiled results of these files must be merged with the application during the link stage.

* The assembly file "ao_int.s" contains a low level interrupt handler for the analog

output operation. When the driver is to be used, the linked results of this file must be merged with the application during the locate stage.

 

Include files:

* Two out of four data structures needed when creating a driver object, have to be

supplied from the application. The type definitions needed to define these data structures are defined in "ao_ioc.h" and "ao_dev.h", which have to be included in the application when the driver is to be used.

* The files "macro.q" and "model.q" are needed when macro preprocessing

"ao_int.s", because they are included in the assembly file.

 

Device:

The driver supports the Pulse Width Modulation Unit (PWM) of the microcontroller C167CW . The driver uses the PWM module to generate analog output values.

 

Interrupt:

The I/O driver uses the output-value-accepted interrupt generated by the PWM module. The interrupt is connected by hardware to interrupt vector No. 3Fh. The CPU interrupt level that is used is defined in the above-mentioned include file "ao_ioc.h". The low level interrupt handler, defined in "ao_int.s", must be called when an interrupt occurs.

Using the analog output driver "ao_dev"

Creation:

Two out of four data structures needed when creating a driver object, have to be supplied from the application. Thus one structure of the type 'ao_ioc_IOCB_TYPE' and one of the type 'ao_dev_DCB_TYPE' must be defined for each object which is to be created.

 

The I/O driver supports the parallel use of up to 4 analog output channels and their corresponding driver objects. The Device Handler object of a driver object must be created before its I/O Controller object.

 

A call to the routine 'ao_ioc_init' must be made before any driver objects are created.

 

Open a path:

The name of the Device Handler object ("ao_dev", plus the specified extension) is used when opening a path to the corresponding created I/O driver object.

 

Initiation:

When using the I/O Controller Parameters, the user is able to influence

1) ...on which port P7 pin (No. 0...3) to output the analog value.

 

By default port pin P7.2 is used.

 

A call to the routine 'ao_channel_init' must be made after each separate driver object has been created and its parameters have been set to the desired values.

This is done via the Generic File and Device Access Interface, as the last step of the initiation procedure for each driver object.

 

Writing analog values:

When calling the write operation via the Generic File and Device Access Interface, a change of the analog output voltage, on the port P7 pin belonging to the specified Device Handler object, is initiated.

 

The desired output value is specified as a floating point value (of the type 'float'), which the user puts directly into the output buffer. This is done by the use of type casts. The total size of the output buffer, which is provided by the caller, must be equal to the size needed to store a variable of the type 'float' (4 bytes).

 

The desired output value must be within the range 0-5 V.

No read-operation is implemented in this I/O driver.

 

6.2.2.4. Performing input and output on digital ports

The described driver is called "dio_dev" (which is also the name of the Device Handler layer it contains).

"dio_dev" is used to measure and output digital signal levels.

Basic information about the digital port driver "dio_dev"

Source files:

* The Device Handler and I/O Controller layers of the driver are implemented in the

C code files "dio_dev.c" and "dio_ioc.c", respectively. When the driver is to be used, the compiled results of these files must be merged with the application during the link stage.

 

Include files:

* Two out of four data structures needed when creating a driver object, have to be

supplied from the application. The type definitions needed to define these data structures are defined in "dio_ioc.h" and "dio_dev.h", which have to be included in the application when the driver is to be used.

 

Device:

The driver supports the digital ports of the microcontroller C167CW.

 

Interrupt:

The driver does not use any interrupts.

Using the digital port driver "dio_dev"

Creation:

Two out of four data structures needed when creating a driver object, have to be supplied from the application. Thus one structure of the type 'dio_ioc_IOCB_TYPE' and one of the type 'dio_dev_DCB_TYPE' must be defined for each object which is to be created.

 

The I/O driver supports the parallel use of all digital port pins (and their corresponding driver objects) that can be manipulated using this driver. The Device Handler object of a driver object must be created before its I/O Controller object.

 

The driver requires no initiations before the driver objects are created.

 

Open a path:

The name of the Device Handler object ("dio_dev", plus the specified extension) is used when opening a path to the corresponding created I/O driver object.

 

Initiation:

When using the I/O Controller Parameters, the user is able to influence

1) ...which port pin to measure/affect : Port No. 2, 3, 5, 7 and 8 can be selected.

Which and how many port pins that are selectable, depends on the specific port that has been chosen (refer to the table below ).

 

 

Port that can be selected:

Available pins:

 

P2

0...15

 

P3

0...13, 15

 

P5

0...16

 

P7

0...8

 

P8

0...8

 

2) ...if the port pin is to be configured as input or output ( 0==>input, 1==>output ) .

3) ...if the pin driver circuit is to have a "push/pull" or "open drain" configuration

(0==>"pull/push", 1==>"open drain") .

 

Default settings are: port pin P2.0 is used, input configuration, and "push/pull" configuration.

In the cases where just the input- or/and "push/pull"-alternative are available, the corresponding parameter settings are irrelevant.

 

When using the Device Handler Parameters, the user is able to influence

1) ...if the logical port value is to be inverted when reading ( 0==>no inversion,

1==>inversion).

2) ...if the logical port value is to be inverted when writing.

 

By default the input values are inverted and the output values are not.

 

A call to the routine 'dio_pin_init' must be made after each separate driver object has been created and its parameters have been set to the desired values.

This is done via the Generic File and Device Access Interface, as the last step of the initiation procedure for each driver object.

 

Reading digital values:

When calling the read operation via the Generic File and Device Access Interface, the signal level on the port pin belonging to the specified driver object, is immediately read.

The logical value corresponding to the result of the read op. is, after a possible inversion, returned as a 'char' value, which is put directly into the input buffer. Thus the total size of the input buffer, which is provided by the caller, must be equal to or larger than one byte.

The 'char' value in the input buffer has the value 0, if a logical FALSE was read, otherwise it has the value 1.

 

Writing digital values:

When calling the write operation via the Generic File and Device Access Interface, the signal level corresponding to the specified logical value is, after a possible inversion, immediately generated on the port pin belonging to the specified driver object.

 

The desired output value is specified as a 'char' value, which the user puts directly into the output buffer. The total size of the output buffer, which is provided by the caller, must be equal to one byte.

 

If the value of the 'char' variable in the output buffer is 0, it is treated as a logical FALSE, otherwise it is treated as TRUE.

 

6.2.2.5. Performing frequency measurements of digital signals

The described driver is called "cap_dev" (which is also the name of the Device Handler layer it contains).

"cap_dev" is used to measure digital signal edge frequencies.

Basic information about the frequency measurement driver "cap_dev"

Source files:

* The Device Handler and I/O Controller layers of the driver are implemented in the

C code files "cap_dev.c" and "cap_ioc.c", respectively. When the driver is to be used, the compiled results of these files must be merged with the application during the link stage.

One function must be added to "cap_ioc.c" for each port pin used, if other port pins than P8.6 and P8.7 shall be measured. The necessary information needed to do this, e.g. function templates, can be found in the source file.

* The assembly file "cap_ovfl.s" contains a low level interrupt handler for the digital

input operation. When the driver is to be used, the linked results of this file must be merged with the application during the locate stage.

* An assembly file, containing a low level interrupt handler, has to be added for

each capture/compare channel (corresponding to the measured port pin) that is used. The assembly file examples "cap_p8_6.s" and "cap_p8_7.s", corresponding to the port pins P8.6 and P8.7, are supplied along with the other files belonging to the driver. When a port pin is to be measured, the corresponding assembly file has to be merged with the application during the locate stage.

 

Include files:

* Two out of four data structures needed when creating a driver object, have to be

supplied from the application. The type definitions needed to define these data structures are defined in "cap_ioc.h" and "cap_dev.h", which have to be included in the application when the driver is to be used.

* The files "macro.q" and "model.q" are needed when macro preprocessing

"cap_ovfl.s" and other similar assembly files, because the files "macro.q" and "model.q" are included in the latter ones.

 

Device:

The driver supports the Capture/Compare Unit CAPCOM2 of the microcontroller C167CW. The driver also uses the timers T6 and T8.

These resources are used to measure the digital signal edge frequencies.

 

Interrupt:

The I/O driver uses the timer-overflow interrupt generated by the timer T8. The interrupt is connected by hardware to interrupt vector No. 3Eh. The low level interrupt handler, defined in "cap_ovfl.s", must be called when this interrupt occurs.

 

In addition to this, the I/O driver utilises the edge-detected interrupt from each capture/compare channel that is used. The interrupt vectors 36h and 37h are connected to the capture/compare channels corresponding to port pin P8.6 and P8.7, respectively. The low level interrupt handlers, defined in "cap_p8_6.s" and "cap_p8_7.s", must be called when the equivalent interrupt occurs.

 

The same interrupt priority level is used for all interrupts used by this driver. This interrupt priority level is defined in the above-mentioned include file "ai_ioc.h".

NOTE that this level has to be one of the highest used in the specific application, otherwise the driver will be disturbed and incorrect frequency values will be returned to the application !

 

A suitable interrupt group level is automatically given to each interrupt used.

Using the frequency measurement driver "cap_dev"

Creation:

Two out of four data structures needed when creating a driver object, have to be supplied from the application. Thus one structure of the type 'cap_ioc_IOCB_TYPE' and one of the type 'cap_dev_DCB_TYPE' must be defined for each object which is to be created.

 

The I/O driver supports the parallel use of up to 3 capture/compare channels and their corresponding driver objects. The Device Handler object of a driver object must be created before its I/O Controller object.

 

A call to the routine 'cap_ioc_init' must be made before any driver objects are created.

 

Open a path:

The name of the Device Handler object ("cap_dev", plus the specified extension) is used when opening a path to the corresponding created I/O driver object.

 

Initiation:

When using the I/O Controller Parameters, the user is able to influence

1) ...which port pin to measure: Port No. 7 and 8 can be selected. Which and how

many port pins that are selectable, depends on the specific port that has been chosen (refer to the table below).

 

 

Port that can be selected:

Available pins:

 

P7

0...8

 

P8

0...8

 

2) ...if positive, negative or both pos. and neg. transitions are to be detected (

0==>positive, 1==>negative, 2==>both ).

3) ...the total clock prescaler (relative the CPU clock) for the time measuring unit

(composed of T6 and T8). Possible parameter values are 1...2^15-1. The resulting total prescaler is 4 times this value !

 

Default settings are: Detection of positive edges at port pin P8.6 with the total prescaler 100 * 4.

 

NOTE that when the driver object is initiated, by calling 'cap_channel_init', the parameter value affects the clock prescalers for all created I/O Controller objects.

 

A call to the routine 'cap_channel_init' must be made after each separate driver object has been created and its parameters have been set to the desired values.

This is done via the Generic File and Device Access Interface, as the last step in the initiation procedure for each driver object.

 

Reading frequency values:

When calling the read operation via the Generic File and Device Access Interface, the digital signal edge frequency on the port pin, belonging to the specified driver object, is immediately calculated from the last measurement made.

The result of the calculation is returned as a floating point value ( of the type 'float' ), which has been put directly into the input buffer. Thus the total size of the input buffer, which is provided by the caller, must be equal to or larger than the size needed to store a variable of the type 'float' (4 bytes). You have to use a type cast in the application to get the floating point value out of the input buffer.

 

The maximum and minimum frequencies that can be measured depend on the chosen clock prescaler:

The minimum frequency is =

1 / ( 1/ (CPU clock frequency) * clock prescaler * 4 * 2^16 ) Hz

 

The maximum (theoretical) frequency is =

1 / ( 1/ (CPU clock frequency) * clock prescaler * 4 * 1 ) Hz

The maximum correctly measured frequency cannot in practice be greater than about 1000 Hz, because of restrictions imposed by the real time kernel O'Tool Executive.

 

NOTE that in the following cases the returned digital signal edge frequency value may be incorrect:

1) The value 0.0 is returned, if the first frequency measurement has not been

made. The read operation never blocks the process calling it !

2) The largest possible value that can be measured is returned, if the frequency is

too large to be measured.

3) The most recently measured value that was in range is returned, if the frequency

is too small to be measured.

 

No write-operation is implemented in this I/O driver.

 

6.2.2.6. Performing asynchronous serial communication

The described driver is called "asc_dev2" (which is also the name of the Device Handler layer it contains).

 

"asc_dev2" is used to perform the following asynchronous serial communication operations:

1) To filter the in-coming bytes so that only string messages, by default consisting

of 9 consecutive bytes, followed by a line feed character, are read. The last received message is saved in a buffer.

2) To output strings of any length.

 

This driver is, in the adapted AICC application, used to send commands to and receive data from the ODIN 2 distance sensor.

Basic information about the asynch. serial comm. driver "asc_dev2"

Source files:

* The Device Handler and I/O Controller layers of the driver are implemented in the

C code files "asc_dev2.c" and "asc_ioc.c", respectively. When the driver is to be used, the compiled results of these files must be merged with the application during the link stage.

* The assembly files "t_ascrx.s" and "t_asctx.s" contain low level interrupt handlers

for the receive and transmit operation, respectively. When the driver is to be used, the linked results of this files must be merged with the application during the locate stage.

 

Include files:

* All the four data structures needed when creating the driver object, are in this

case supplied from the driver. But the parameter indexes are still defined in "asc_ioc.h" and "asc_dev2.h", which have to be included in the application, when the driver is to be used.

* The files "macro.q" and "model.q" are needed, when macro preprocessing

"t_ascrx.s" and "t_asctx.s", because the files "macro.q" and "model.q" are included in the latter ones.

 

Device:

The driver supports the Asynchronous/Synchronous Serial Channel (ASC0) of the microcontroller C167CW.

No error detection mechanisms in the ASC0 module are supported by the driver.

 

Interrupt:

The I/O driver uses the end-of-reception and end-of-transmission interrupts generated by the ASC0 module. The interrupts are connected by hardware to interrupt vector No. 2Bh and 2A, respectively. The CPU interrupt level that is used is defined in the above-mentioned include file "asc_ioc.h". When a receive interrupt occurs the low level interrupt handler, defined in "t_ascrx.s", must be called, and when a transmit interrupt occurs the low level interrupt handler, defined in "t_asctx.s", must be called.

 

NOTE that the same interrupt priority level must be assigned to the interrupts used by this driver. There is no restriction on the group levels of these interrupts.

Using the asynch. serial comm. driver "asc_dev2"

Creation:

All the four data structures needed when creating the (only) driver object, are in this case supplied from the driver. Thus the structures 'asc_ioc_type', 'asc_ioc_iocb', 'asc_dev_type' and 'asc_dev_dcb' have to be declared external in the application using the corresponding O'Tool IOS types for all of them. The interrupt handler 'asc_dev_ISR' also have to be declared external.

 

The I/O driver supports the use of the ASC0 module and its corresponding driver object. No parallel use of driver objects can be made ! The Device Handler object of the driver object must be created before its I/O Controller object.

 

The driver requires no initiations before the (only) driver object is created.

 

Open a path:

The name of the Device Handler object ("asc_dev2", plus the specified extension) is used when opening a path to the corresponding created I/O driver object.

 

Initiation:

When using the I/O Controller Parameters, the user is able to influence

1) ...if 8- or 9-bit data is to be used.

2) ...if 1 or 2 stop bits is to be used.

3) ...if a transmission rate of 19200, 9600, 4800, 2400, 1200, or 600 baud is to be

used.

Default settings are: 8-bit data, 1 stop bit, 9600 baud.

No parity is generated and no communication error detection is implemented.

 

When using the Device Handler Parameters, the user is able to influence

1) ...the size (1...20) of the read messages.

 

Default message size is 9 bytes.

 

No initiation calls are needed after the (only) driver object has been created, and its parameters have been set to the desired values.

 

Reading string messages:

String messages are automatically received by the driver.

A message consists (by default) of 9 bytes, which are received in a sequence, and which are also followed by a line feed character. The line feed character is thrown away.

 

When calling the read operation via the Generic File and Device Access Interface, the last received valid message is put into the input buffer.

 

The total size of the input buffer, which is provided by the caller, must be equal to or larger than the size needed to store a message of the chosen size.

 

NOTE that the following situations exist:

1) If no valid message has been received at all, the read operation blocks the

process calling it.

2) If a new valid message is received while a read operation is being performed,

the new message is lost.

 

Writing arbitrary strings:

When calling the write operation via the Generic File and Device Access Interface, the driver starts to put out the string in the output buffer one byte at a time.

No filtering of the transmitted bytes is performed. The string in the output buffer, which is provided by the caller, can be of any length.

 

6.2.2.7. Performing CAN communication

The described driver is called "can_dev4" (which is also the name of the Device Handler layer it contains).

"can_dev4" is used to perform CAN communication.

Basic information about the CAN driver "can_dev4"

Source files:

* The Device Handler layer of the driver is implemented in the C code file

"can_dev4.c". The I/O Controller layer is implemented in the C code files "can_ioc2.c" and "s_can167.c". The latter has been delivered from Mecel AB. When the driver is used, the compiled results of these files must be merged with the application during the link stage.

* The assembly file "can_int.s" contains a low level interrupt handler for the CAN-

receive and CAN-transmit operations. When the driver is to be used, the linked result of this file must be merged with the application during the locate stage.

 

Include files:

* Two out of four data structures needed when creating a driver object, have to be

supplied from the application. The type definitions needed to define these data structures are defined in "can_ioc2.h" and "can_dev4.h", which have to be included in the application when the driver is to be used.

* The file "can_reg.h" is included in "can_ioc2.c".

* The file "typedef.h" is included in both "can_ioc2.c" and "s_can167.c".

* the files "can167.h", "can_def.h", and "s_can167.h" are included in "s_can167.c".

* The files "macro.q" and "model.q" are needed when macro preprocessing

"can_int.s", because they are included in the assembly file.

 

Device:

The driver supports the CAN module of the microcontroller C167CW.

No error detection mechanisms in the module are supported by the driver.

 

Interrupt:

The I/O driver uses the interrupt generated by the CAN module. The interrupt is connected by hardware to interrupt vector No. 40h. The CPU interrupt level that is used is defined in the above-mentioned include file "can_ioc2.h". The low level interrupt handler defined in "can_int.s", must be called when an interrupt occurs.

Using the CAN driver "can_dev4"

Creation:

Two out of four data structures needed when creating a driver object, have to be supplied from the application. Thus one structure of the type 'can_ioc_IOCB_TYPE' and one of the type 'can_dev_DCB_TYPE' must be defined for each object which is to be created.

 

The I/O driver supports the parallel use of up to 14 CAN objects (communication channels of the CAN module) and their corresponding driver objects. The Device Handler object of a driver object must be created before its I/O Controller object.

 

A call to the routine 'can_ioc_init' must be made before any driver objects are created.

 

Open a path:

The name of the Device Handler object ("can_dev4", plus the specified extension) is used when opening a path to the corresponding created I/O driver object.

 

Initiation:

When using the I/O Controller Parameters, the user is able to influence

1) ...the address of the CAN-message ( 0 to (2^11-1) ).

2) ...if read or write operation are going to be performed ( 0 ==> read, 1 ==> write) .

3) ...the data field length of the CAN-message (1 to 8 bytes) .

 

Default settings are: address =0, operation =read, and data field length =1.

 

NOTE that to change the communication rate one has to edit "s_can167.c". The high and low bytes (BTR1 and BTR0) of the Bit Timing Register, belonging to the on-chip CAN module, have to be given new values (refer to for example to [5] ).

 

A call to the routine 'can_object_init' must be made after each separate driver object has been created and its parameters have been set to the desired values.

This is done via the Generic File and Device Access Interface, as the last step of the initiation procedure for each driver object.

 

Reading string messages:

CAN messages are automatically received by the driver.

 

When calling the read operation via the Generic File and Device Access Interface, the last received message of the CAN object, belonging to the specified driver object, is put into the input buffer.

 

The total size of the input buffer, which is provided by the caller, must be equal to or larger than the size needed to store a message of the chosen size.

 

NOTE that the following situations exist:

1) If no valid message has been received at all, the read operation gives the return

value 0 and the contents of the input buffer are undefined. The read operation never blocks the process calling it.

2) If a new message is received while a read operation is being performed, the new

message is lost.

 

Writing digital values:

When calling the write operation via the Generic File and Device Access Interface, the CAN object, belonging to the specified Device Handler object, is initiated to send the string specified in the output buffer, as a CAN message.

 

The total size of the output buffer, provided by the caller, must be equal to the chosen size of the CAN message.

 

6.3. An example of the usage of the developed support software additions: the AICC application

As is stated in the section called "Problem formulation and restriction of the scope of the project", one of the ultimate goals of this project is to test the developed support software additions by using them to implement a real-life regulator application. The AICC (Autonomous Intelligent Cruise Control) application, already developed for PC, is to serve as a template when developing this new microcontroller-based regulator application.

 

NOTE that, due to the lack of time and problems with the ODIN 2 distance sensor, this application was never tested as a whole! However, each component of CFT I/O Driver Package was thoroughly tested.

6.3.1. The structure of the application

To save time when designing the new program code, a decision was made to use essentially the same functional structure and the same structure of program modules as in the old application, but to simplify it where it was possible.

Figure 11 shows the main functional structure of the AICC application. The source files of the application are found in the directory CALLE\AICC_NEW\APPLICTN.

The functional parts of the application shown above are implemented in the following way:

 

Source files:

* "aicc_tck.c" , which contains routines for initiation and handling of the trigger

source for time increments needed by O'Tool Executive. An interrupt service routine, defined in this file, calls O'Tool Executive when it is time to increment the internal clock of the real-time kernel.

* "aicc_exc" , which contains exception handlers that are used when debugging

the application.

* "aicc_st.c" , which contains the System Start Function (in this case 'main'), that

initiates O'Tool Executive and O'Tool IOS and then creates and activates the "Main Task", defined in "aicc_tsk.c".

 

* "aicc_tsk.c" , which contains the tasks needed to perform the regulator function:

- The "Main Task" makes calls to create and initiate the driver objects.

Furthermore it creates and activates the other tasks, starts the time increment trigger source and finally signals to the "Regulator Task" to start its job.

- The main regulator loop (refer to Figure 11) is implemented in "Regulator

Task". This task is a restructured version of "aicc.c" of the old application.

- The "Time Task" keeps track of the time between two samples. This task

signals to "Regulator Task" when it has to execute its loop yet another round. The purpose of this is to utilise the existing time functions of O'Tool Executive, without getting unpredictable delays between samples.

- The "Screen Task" is used to collect information, which will be sent to the

operator's PC screen via CAN communication. The "Regulator Task" supplies the information. The purpose of this is to compensate for a possible slow CAN message reception rate of the operator's PC.

 

* "aicc_ini.c" , which contains routines for creation and initiation of the needed

driver objects. A routine for the opening of paths to the driver objects is also implemented here.

* "aicc_io.c" , which contains routines that call the created driver objects, via

the Generic File and Device Access Interface, to perform I/O. Some routines for message decoding, message preparation, and inter-task communication are also defined here.

 

* "aicc_ctl.c" , which implements the "Main controller" that contains the "Cruise

Control", "Distance Control" and "Coordination" functional modules (refer to the documentation of the old application). This file is based on "control.c" of the old application. The new version has been cleaned from garbage.

* "aicc_act.c" , which implements the "Actuator Controller" that contains the

"Accelerator Control" and "Retarder Control" functional modules (refer to the documentation of the old application). This file is based on "actuator.c" of the old application. The new version has been cleaned from garbage.

* "aicc_pi.c" , which implements a PI regulator. This file is based on "pid.c" of the

old application. The new version has been cleaned from garbage.

 

Include files:

* "aicc_def.h" , which contains application specific macro definitions related

to the management of tasks and drivers performed by O'Tool Executive and O'Tool IOS.

* "icc_par.h" , which contains macro definitions, that define values for various

regulator parameters. This file is based on "aicc.ini" of the old application.

 

* "aicc_ini.h", "aicc_io.h", "aicc_ctl.h", "aicc_act.h", and "aicc_pi.h" contain

type definitions and function prototypes for the corresponding C code file.

 

Used in-target-computer support software

* O'Tool Executive

* O'Tool IOS

* All the described drivers of CFT I/O Driver Package (i.e. "ai_dev", "ao_dev", "dio_dev", "cap_dev", "asc_dev2", and "can_dev4") are used.

 

The libraries and source files of these support software components are merged with the application during the link and locate stage of the application building process. The corresponding include files are included in the application source files where necessary.

 

Makefile:

* "aicc_mk.mak" , used to control mk166 when building the application.

 

Device:

The table below shows the hardware resources, of the microcontroller C167CW, which are used by the application via O'Tool Executive, CFT I/O Driver Package and "aicc_tck.c":

 

 

Delivered service

Hardware resources

Interrupt vector No.

O'Tool Executive uses some hardware and software traps.

 

 

4h, 6h, 29h

Trigger source for

time increments needed by O'Tool Executive

 

- timer T5

25h

Analog input

 

 

- A/D Converter (ADC)

- port pins P5.0

28h

Analog output

 

 

 

- Pulse Width Modulation Unit (PWM)

- port pins P7.2-3

3Fh

Digital input

 

 

 

 

- port pins P3.13, P3.15

- port pins P5.8-11, P5.14-15

- port pin P8.7

 

Digital output

 

port pins P7.0-1, P7.4-5

 

Capture input (frequency measurement)

 

 

 

 

- Capture/Compare Unit CAPCOM2

- timer T6

- timer T8

- port pin P8.6

3Eh, 36h

Async. serial comm.

 

 

 

- Async./Sync. Serial Channel (ASC0)

- port pins P3.10-11

2Ah, 2Bh

CAN comm.

 

 

- CAN module

- port pins P4.5-6

40h

 

 

Interrupt:

The table above shows the interrupt vectors, of the microcontroller C167CW, which are used by the application via O'Tool Executive, CFT I/O Driver Package and "aicc_tck.c":

6.3.2. What is done in the application

A simplified illustration of the various stages in the execution of the application is shown in Figure 12.

 

 

 

7. Evaluation of the available parts of the development platform

7.1. Evaluation of the ECU

Since my knowledge of other microcontroller-based hardware is slight, I cannot make any comparisons between the ECU used in this project and other similar products that are available on the market. Furthermore, the adapted AICC application was never tested as a whole, and thus the behaviour of BaseNode 167 under real-life conditions is not known exactly.

7.1.1. BaseNode 167

Documentation:

The hardware reference manual of BaseNode 167 [1] was written before the final design of the ECU was settled. Therefore some of the information presented in this manual is out of date. The description of how to work practically with the ECU is very superficial.

 

Functionality:

No general C-start file, with a minimum of adaptations to the ECU, was delivered along with BaseNode 167. The supplied C-start file was restricted to be used together with an application adapted to the memory model Small.

In spite of the fact that only a few changes were needed, a lot of time was spent adapting the C-start file (which has a default configuration) delivered along with the BSO/Tasking tool chain.

 

Product support:

The deficiencies in the hardware documentation and the initial functional problems of the I/O Board were compensated for by ample support from Mecel AB.

7.1.1.1. Controller Board

Functionality:

The Controller Board has no other functional problems than those associated with the microcontroller.

Microcontroller C167CW

Documentation:

When this project started, no complete description of the microcontroller in question was available. The documentation initially consisted of the functional reference manuals of the SAB 80C166 family [2, 3] and some material, which described the additional qualities of the C167 family [4, 5].

No information about the fact that the microcontroller used was an engineering sample was given by Mecel AB. This fact was not revealed until a call was made, to Siemens in Stockholm, to ask for errata sheets [6] for the microcontroller. A new functional reference manual [7, 9], covering both C167CW and the improved variant C167CR, was sent from Siemens.

 

The functional reference manual of the C167 family is still under development. The documentation produced so far indicates that the final product will present both the general structure and the details of the microcontrollers in a comprehensible way.

 

Functionality:

The C167CW has functional problems in almost all its peripheral modules.

 

Due to the functional problems of the ADC module, the more advanced features of this module couldn't be utilised, when the I/O Controller layer of the driver "ai_dev" (belonging to CFT I/O Driver Package) was designed. Measures were also taken to compensate for functional problems in the on-chip CAN module, when the I/O Controller layer of the driver "can_dev4" (belonging to CFT I/O Driver Package) was designed.

 

It was hard to keep track of all the functional deficiencies of the C167CW. In the end it was established, that most of these deficiencies do not affect the I/O drivers that were developed. Nevertheless, all additional details about this tricky environment are confusing.

 

Most of the functional problems have been solved in the improved variant C167CR [8]. Thus the qualities of this microcontroller can be used without taking as many restrictions into consideration, as when using the earlier variant.

 

In my opinion, a microcontroller of the type C167C is both powerful and flexible, because of its various on-chip peripherals, and because of the uniform way these resources can be manipulated. It was hard to learn how to use the C167CW, but I suppose it is much harder to learn how to utilise the set of (external) peripherals needed to obtain a similar functionality. However one drawback is that the microcontroller just has one channel for asynchronous serial communication. It is desirable that two such channels are available, because otherwise an application that uses asynchronous serial communication can not be debugged using for example the debugger xvw166e v1.1.

 

My conclusion is that a microcontroller of the type C167C has the potential to serve as a part in the hardware base for a development platform for regulator applications.

 

Product support:

All information (errata sheets and manuals) was immediately delivered from Siemens in Stockholm, when it was requested.

7.1.1.2. I/O Board

Documentation:

The documentation of the custom-made I/O Board, used in this project, is incorrect. Among other things the digital output pins have been mixed up.

 

Functionality:

The functionality of the I/O Board had not been verified, when it was delivered from Mecel AB. Some of the signal conditioning circuits belonging to digital input did not work, because of bad soldering. Furthermore, flexes were missing in the signal conditioning circuits belonging to analog input and analog output.

 

Since my knowledge of how to debug hardware circuits is slight, a lot of time was spent debugging the I/O Board.

 

After these initial functional problems, all services of the I/O Board have been working as intended.

 

In my opinion, the idea to split the ECU into a general purpose Controller Board and an adaptable I/O Board is promising. It is desirable, though, that the set of I/O connections, available as standard configurations of the I/O Board, will include analog output.

7.2. Evaluation of the application building tools

7.2.1. BSO/Tasking 80C166 tool chain

Documentation:

The documentation belonging to some tools requires a high level of background knowledge of how to manage microcontroller applications.

 

Functionality:

The tools worked well, with some exceptions.

 

Product support:

No contacts were made with the product support of BSO/Tasking.

7.2.1.1. C Cross-Compiler

Documentation:

The manual of c166 [12] is quite difficult to understand, because

1) ...since the description of the software concept only describes the additions

compared to the ANSI standard, a good knowledge of the C language is necessary.

2) ...the explanations, of what the various memory models (Tiny, Small, Medium,

and Large) imply and of how the partitioning of code and data into various logical sections is made, are scanty. The understanding of these parts is essential, when creating steering files for the locate stage of l166. A description of these subjects is to be found in the manual of a166 [10].

3) ...the way the compiler transfers information, which is used to steer the

assembler, is not clearly explained. To get a grip on this subject one has to refer to the description of assembler controls in the manual of a166 [10].

4) ...the situations (for example when floating point arithmetic or initialised bit

variables are to be used), when it is necessary to make adjustments to the C-start file, are not clearly specified. These adjustments are brought about by supplying macro definitions as command line arguments when calling m166.

5) ...the large set of compiler options is very hard to survey. Both the purpose and

the effect of some of the options were difficult to understand at the beginning of the project.

6) ...the limitations of the floating point arithmetic is not emphasised. For more

information about some of the consequences of these limitations, refer to the section called "Details of O'Tool Executive" in Appendix B.

 

Functionality:

c166 works well, except that incorrect assembly code is generated in the following cases:

1) When a pointer (obtained by using the prefix operator "&" ) to a special function

variable is used in a definition of a constant variable. Work around: write the pointer value explicitly.

2) When assigning the value of a single floating point constant, floating point

variable, or floating point function parameter to another variable. Work around: multiply the expression with the floating point value 1.0 .

 

This incorrect assembly code causes a166 to produce error messages.

 

Sometimes when using floating point expressions in an application, the resulting application crashes after entering a specific expression. This happens every time the application in question is executed. This may be caused by bugs in the floating point libraries, or it may be caused by erroneous floating point library calls in the assembly code generated by c166. Work around: none.

7.2.1.2. Macro Preprocessor

Documentation:

The description of m166 [10] is quite easy to understand.

 

Functionality:

Perfect.

 

Additional comments:

To be able to analyse for example a general C-start file (which is delivered along with the BSO/Tasking tool chain) or the files "macro.q" and "model.q" (which are delivered as parts of the O'Tool package), knowledge is required of how to interpret assembly language macros. Furthermore, to create flexible assembly code modules, which can be included in various applications that are adapted to for example different memory models, you have to make use of assembly language macros.

7.2.1.3. Cross-Assembler

Documentation:

The description of a166 [10] is difficult to understand, because

1) ...it is assumed that the reader has a basic knowledge of the idea behind an

assembly language, which includes virtual instructions and virtual operand combinations.

2) ...it is assumed that the reader has a basic knowledge of the real instruction set

and the corresponding possible real operand combinations of the microcontroller.

3) ...it is hard to get a grip on the use of assembler directives. These constitute a

necessary part of the assembly language. Among other things, the memory can be addressed, and the code and data be partitioned into various logical sections, by the use of these directives.

4) ...the large set of assembler controls is quite hard to survey. Both the purpose

and the effect of some of the controls were difficult to understand at the beginning of the project. In practice, it is necessary to pay attention to just a few of these controls.

 

Functionality:

Perfect.

7.2.1.4. Linker/Locator

Documentation:

The description of l166 [11] is quite difficult to understand, because

1) ...it is assumed that the reader has a basic knowledge of the idea behind the

allocation of code and data using logical sections.

2) ...it is assumed that the reader has a basic knowledge of what the various

memory models imply for the allocation of code and data.

3) ...the large set of l166 controls, is very hard to survey. Both the purpose and

the effect of some of the controls were difficult to understand at the beginning of the project, especially as some controls can be used in both the link and locate stages of l166.

 

Functionality:

The difficulty to get a grip on how to use the l166 controls was a great problem, because to locate more complex applications (for example the test applications which were used to test the various I/O drivers), an extensive use of controls is necessary.

7.2.1.5. Output Format Utilities

Documentation:

It was not necessary to read this documentation.

 

Functionality:

Perfect.

7.2.1.6. Make Utility

Documentation:

The description of mk166 [11] is difficult to understand, because

1) ...it is assumed that the reader has a basic knowledge of how a typical makefile

language is used.

2) ...some aspects of the behaviour of mk166 are undocumented.

 

Functionality:

When you have learnt how to use macros and implicit rules, you will experience how powerful mk166 really is. The undocumented aspects of the behaviour of this tool will not cause any problems, if you are careful to specify how each application component in the application is to be processed.

7.2.1.7. Debugger

Documentation:

The description of xvw166e v1.1 (refer to the description of the text mode version in [13] ) is quite easy to understand. However, it does not cover the pitfalls of the debugger. For more information about these pitfalls refer to the section called "Useful hints when using the debugger" in Appendix C.

 

Functionality:

The debugger Cross View 80166 v4.0 r1 (the name of the executable is "xfw166e.exe"), which was delivered as a part of the BSO/Tasking tool chain, did not work at all. Instead the older text mode version xvw166e v1.1 was used in this project. The only way to steer this debugger is from the command line. Unfortunately the command language is awkward and the program has a lot of bugs.

 

In my opinion, it is therefore necessary to get hold of a working version of Cross View 80166 as soon as possible, if the BSO/Tasking tool chain is to be used in future projects.

7.2.2. Stand alone load program VIAPC

Documentation:

No printed documentation was available, although such documentation is necessary to use the program.

 

Functionality:

viapc works well. The monitor part (Base Block) of the load program has originally been designed to work together with an application, Application Block, that has been compiled with the memory model Small. As the libraries and relocatable link files of the O'Tool package have been compiled with the memory model Large, some adaptations have been made to this monitor. The files, which constitute the adapted monitor, are found in the directory CALLE\MECEL\SOURCE..

 

Product support:

The fact that the documentation was missing was compensated for by ample support from Mecel AB.

7.3. Evaluation of the in-target-computer support software

Note that the behaviour of O'Tool Executive and of O'Tool IOS under real-life conditions is not known exactly, because the adapted AICC application was never tested as a whole.

7.3.1. O'Tool Executive

Documentation:

The general description of O'Tool Executive [14] is easy to read and well structured. This description is about the concepts behind, the theory of operation for, and the interface to the real-time kernel. Unfortunately, the description of how the interrupt handling works is out of date. The specification of which services of O'Tool Executive that are permitted in an interrupt handler is vague.

 

The microcontroller specific description of O'Tool Executive [17] is very hard to understand, and the requirements when using the real-time kernel are vague. The description of how the stack handling works, and of the relation between task priorities and CPU priority levels, is unclear. A lot of phone calls to Arcticus Systems AB were necessary to get the first test application, using O'Tool Executive, running.

 

The application example that was delivered along with the O'Tool package gave much necessary information about how to utilise the real-time kernel. However, for the inexperienced user, it was too complicated. It is desirable that the demonstrations of O'Tool Executive, O'Tool IOS, and O'Tool Monitor Printer Package (refer to Appendix B) are made in separate application examples.

Furthermore, the supplied makefile of the test application was neither adapted to mk166, nor well commented. It is desirable that well structured, commented, and correct makefile examples are supplied along with a support software package.

The fact that neither a PC program, which could communicate with the monitor functions in the C167CW (via ASC0), nor a specification of the communication protocol used was supplied [16], made the O'Tool Monitor Printer Package useless, when O'Tool Executive was initially tested.

The above-mentioned factors led to the application example never being built and executed.

 

Functionality:

The fact that the real-time kernel had apparently not been completely tested, before it was delivered, led to several distracting updates by Arcticus Systems AB during the project. As mentioned above, the O'Tool Monitor Printer Package was of no use. A hard part was to get a first simple test application, using O'Tool Executive, running.

 

However, if you are careful only to make permitted calls in the interrupt handlers you design, the real-time kernel will function very well.

 

Product support:

The deficiencies in, for example, the microcontroller-specific parts of the documentation were compensated by ample support from Arcticus Systems AB.

7.3.2. O'Tool IOS

Documentation:

The reference manual of O'Tool IOS [15] is hard to understand, because it is difficult to survey the described system when reading it. It is desirable that some of the ideas behind the system structure are revealed. If you are unfamiliar with advanced use of pointers and structs of the C language, this I/O driver framework will be hard to utilise. Nevertheless, the code examples included in the reference manual were very instructive when CFT I/O Driver Package was designed.

 

The example application that was delivered along with the O'Tool package was not very helpful, when the I/O drivers were designed, because for the inexperienced user, the driver example included was too complicated. The driver example also contained a lot of garbage code. It is desirable that a simple example driver is delivered along with an I/O driver framework of this type.

 

Functionality:

In my opinion, the basic concepts of O'Tool IOS (the layered driver structure, the uniform interfaces to the layers, and the call-back method) are very promising. During the design of CFT I/O Driver Package a lot of code and data structures have been reused, when creating new drivers.

 

Product support:

The deficiencies in the documentation, were compensated for by ample support from Arcticus Systems AB.

 

8. Is the microcontroller-based development platform suitable for the designing and testing of regulators ? (Conclusions)

8.1. Requirements on a development platform

No precise requirements on a development platform for regulator applications have been specified by the members of the group 6210 Systems Engineering. Nevertheless, I have identified the following qualitative requirements:

1) The development platform must support regulator algorithm implementations

that are a) reliable, b) time, and c) memory space effective.

2) The development platform must allow the regulator algorithms to be

implemented in a fast and simple manner.

3) The resulting regulator application must be easy to test and validate.

4) The resulting regulator application must be easy to modify and maintain.

5) It must be possible to execute several applications in a single ECU.

6) Extensive communication with a host PC must be possible (to be able to monitor

and manipulate the regulator applications when testing).

7) After some adaptations, it must be possible to use the ECU of the development

platform and the developed applications in a commercial product.

 

8.2. Are the requirements fulfilled by the available development platform?

In this section, my opinion of how the above stated requirements are fulfilled is presented. Note that since the adapted AICC application was never tested as a whole, the behaviour of BaseNode 167, of O'Tool Executive, and of CFT I/O Driver Package (which is supported by O'Tool IOS) under a heavy work load is not known exactly.

 

Comments concerning requirement 1a:

The problems with the floating point library from BSO/Tasking seem to be relatively harmless in the sense that it is easy to check if an error will occur for the application in question. Requirement 1a might thus be fulfilled, if the improved microcontroller variant C167CR is used in BaseNode 167 and if this variant does not have any undocumented functional problems. However, there is an obvious risk that undocumented functional problems exist, since the C167 family of microcontrollers has only recently been introduced.

 

Comments concerning requirement 1b:

Since a microcontroller of the type C167C is very powerful, requirement 1b seems to be fulfilled, if the services delivered by O'Tool Executive are used with care. Time consuming services should, for example, not be used in more time critical processes and interrupt handlers.

 

Comments concerning requirement 1c:

The space requirements of O'Tool Executive, O'Tool IOS, and CFT I/O Driver Package are quite small. Thus requirement 1c seems to be fulfilled.

 

Comments concerning requirement 2:

One of the first conclusions made during this project was that the available parts of the development platform did not fulfil requirement 2 (refer to the sections called "How to perform I/O in an application" and "Controlling the application building process"). The development platform was initially very hard to work with. The knowledge, practices, and software developed during this project will hopefully make it a lot easier.

 

Comments concerning requirement 3:

The debugger xvw166e v1.1 has serious defects, and it is not possible to debug applications that use asynchronous serial communication using a debugger that also uses the ASC0 channel. Requirement 3 is thus not fulfilled. To solve this problem a working version of the debugger Cross View 80166 must be acquired. Furthermore, an external module for asynchronous serial communication will have to be added to BaseNode 167.

 

Comments concerning requirement 4:

It is easy to add components to and update an application by using Make Utility mk166 in the manner described in the section called "Using the Make Utility". Thus requirement 4 is fulfilled.

 

Comments concerning requirement 5:

A new application can easily be added, if applications are implemented as sets of tasks (parallel processes, which are supported by O'Tool Executive). The flexibility of CFT I/O Driver Package makes it easy to realize the additional communication functions that are needed. Thus requirement 5 is fulfilled.

 

Comments concerning requirement 6:

This can be achieved by the use of CAN communication. The on-chip CAN module in a microcontroller of the C167C family enables several applications, which are executed in the microcontroller, to communicate via separate channels.

 

Comments concerning requirement 7:

Since both the microcontroller and the I/O Board of the BaseNode 167 are quite flexible this requirement may be fulfilled.

8.3. Is the development platform suitable?

The requirements on a good development platform for regulator applications seem to be fulfilled, with exception of requirement 3. If improvements are not made to remove this exception, it will not be possible to debug, for example, the adapted AICC application properly.

 

In any case, you will experience that the development platform, which has been investigated during this project, is tricky to handle initially. Nevertheless, it may prove to be very powerful after a while.

 

9. References

References concerning the ECU:

[1] Tri, V. C. (1994). BaseNode 167 Hardware Reference Manual (ProVIA-93703,

Version 1/Draft). Göteborg (Sweden): Mecel AB.

 

[2] Siemens AG. (1990). SAB 80C166/83C166 User's Manual (Original Version

6.90). München.

 

[3] Siemens AG. (1992). Addendum to SAB 80C166/83C166 User's Manual

(Original Version 9.90). München.

 

[4] Siemens AG. (1992, July). SAB C167 Preliminary User's Manual (Revision 1.0).

München.

 

[5] Siemens AG. (1993). C167C Description of the On-chip CAN-Module (Advance

Information 05.93). München.

 

[6] Siemens AG. (1994, April 20). Errata Sheet C167CW (Release 1.1). München.

 

[7] Siemens AG. (1994, July). C167CR User's Manual (07.94 Advance Version).

München.

 

[8] Siemens AG. (1994, October 28). Status Sheet C167CR (Release 1.2).

München.

 

[9] Siemens AG. (1994, December 7). C167xR Specific Improvements (Advance

Product Information 04.94). München.

 

References concerning the application building tools:

[10] Boston Systems Office/Tasking. (1993). 80166 Cross-Assembler User's Guide

Volume 1. Amersfoort (The Netherlands).

 

[11] Boston Systems Office/Tasking. (1993). 80166 Cross-Assembler User's Guide

Volume 2. Amersfoort (The Netherlands).

 

[12] Boston Systems Office/Tasking. (1993). 80166 C Cross-Compiler User's

Guide. Amersfoort (The Netherlands).

 

[13] Boston Systems Office/Tasking. (1993). 80166 Cross View Debugger User's

Guide. Amersfoort (The Netherlands).

 

References concerning the in-target-computer support software:

[14] Arcticus Systems AB. (1991). O'Tool User's Manual (Release 3/Draft).

Järfälla (Sweden).

 

[15] Arcticus Systems AB. (1992). O'Tool IOS User's Manual (Third Draft). Järfälla

(Sweden).

 

[16] Arcticus Systems AB. (1992). O'Tool Monitor Printer Package Appendix

(Release 3). Järfälla (Sweden).

 

[17] Arcticus Systems AB. (1995, March 14). O'Tool Microprocessor Appendix-

80C16X (Release 3). Järfälla (Sweden).

 

References concerning the old AICC application:

[18] Botling, F., Edlund, S. (1994, April). Design and Implementation of Actuator

and Coordination Control for Autonomous Intelligent Cruise Control (LiTH-ISY-EX-1407). Linköping (Sweden): Linköping University.

 

Appendix A

A.1. Using the microcontroller C167CW and the libraries from BSO/Tasking

A.1.1. Requirements when using the microcontroller and libraries

In the description below it is assumed that the application is adapted to the memory model Large. However, if you neither are going to use the O'Tool package, nor the version of the monitor part (Base Block) of viapc that has been adapted to the memory model Large, you can choose any memory model you like. I recommend the memory model Large, though, since it is the most flexible one.

 

If you want to use the resources of the microcontroller and the services of the libraries from BSO/Tasking, the following requirements, among others, must be fulfilled:

* Since the memory model Large is assumed to be used, the C code files of the

application should be compiled using the option "-Ml".

* It is necessary to compile the C code files of the application using the compiler

option "-x", which tells c166 to generate code for a microcontroller of the C167 family.

* It is wise to compile the C code files of the application using the additional options

"-Ot -N -e -err". These options instruct the compiler to make some extra checks of the C code, to generate an error file, and to omit to generate an output file when serious syntax errors are detected.

* If you want to force single precision floating point arithmetic in the application, all

C code files, which contain floating point expressions, must be compiled with the option "-F". If you want the generated floating point code to be reentrant (i.e. the floating point arithmetic of different Siemens Interrupt Tasks are prevented from interfering with each other) and to simultaneously force single precision floating point arithmetic in the application, use the compiler option "-FR" instead of "-F".

* If you want the generated floating point code to be reentrant (i.e. the floating point

arithmetic of different Siemens Interrupt Tasks are prevented from interfering with each other) without forcing single precision floating point arithmetic in the application, all C code files that contain floating point expressions must be compiled with the option "-Fr".

 

* The C-start file "bn167_cs.s", macro preprocessed with the control

"DEFINE(MODEL,LARGE)", must be linked to the application. This file is found in the directory CALLE\MECEL\CSTART.

* If floating point expressions are used in the application, the C-start file

"bn167_cs.s" has to be macro preprocessed with the additional control "DEFINE(FLOAT,1)".

* If initialised bit variables are used in the application, the C-start file

"bn167_cs.s" has to be macro preprocessed with the additional control "DEFINE(BIT_INIT,1)".

 

* All the libraries from the BSO/Tasking package that are used must be fetched

from the sub-directory LIB\EXT in the home directory of the BSO/Tasking package.

* Since the memory model Large is assumed to be used, the library "c167l.lib" has

to be linked to the application, except when single precision floating point arithmetic is forced in the application. In this case the library "c166ls.lib" must be linked to the application.

* If floating point expressions are used, the floating point library "f166l.lib", must be

linked to the application.

* If you want to print values of floating point variables, by using for example 'printf',

a string formatter routine of the C-library, used when printing, must be modified. This is done by linking the C library source file "_doprint.c", compiled with the option "-DLARGE", to the application. This file is found in the sub-directory LIB\SRC in the home directory of the BSO/Tasking package.

* If you want to read values of floating point variables, by using for example 'scanf',

a string formatter routine of the C-library, used when reading, must be modified. This is done by linking the C library source file "_doscan.c", compiled with the option "-DLARGE", to the application. This file is found in the sub-directory LIB\SRC in the home directory of the BSO/Tasking package.

 

* The interrupt handlers (for example Siemens Interrupt Tasks) must be coupled to

their respective interrupt vectors.

* The size of the internal RAM of the microcontroller must be specified to 2 kB.

* During the locate stage, the following memory ranges must be reserved to

prevent data and code sections from being allocated to them:

- 0F200h to 0F5FFh (Reserved internal memory area of C167CW)

- 0FCE0h to 0FCFFh (PEC source and destination pointer registers)

- 0EF00h to 0EFFFh (data buffers, control registers etc. of the CAN module)

* The code and constant data sections must be allocated to memory ranges

corresponding to flash memory (ROM), and the rest of the data sections must be allocated to memory ranges corresponding to RAM. An exception is when you are going to use the debugger xvw166e v1.1. In this case all data sections must be allocated to memory ranges corresponding to RAM.

* If there are many nestled function calls involving functions that use floating point

arithmetic, the floating point stack size may have to be increased.

 

NOTE that the requirements of the O'Tool package (if this is used) and the requirements of the downloading method used are added to the requirements stated above.

 

Appendix B

B.1. Using the O'Tool package

O'Tool Executive (often just called O'Tool) and O'Tool IOS are included in the O'Tool package. A third part in this package is O'Tool Monitor Printer Package, which contains routines for monitoring O'Tool Executive during the development of an application. The version of the O'Tool package used in this project is O'Tool/80C166 v3.60 .

B.1.1. Details of O'Tool Executive

The purpose of the following information about O'Tool Executive is to clarify the behaviour of some parts of the real-time kernel. Note that some information given here is not included at all in the documentation of O'Tool Executive [14, 17], and that part of the information is specific to the version of O'Tool Executive that is included in O'Tool/80C166 v3.60 (even when not stated explicitly).

* The System Reset Function is in practice equivalent to the C-start function. The

System Start Function is in practice equivalent to the routine 'main'.

 

* There is no connection between task priorities (range: 0...63), which are internal

to the system of tasks, and CPU interrupt levels (range: interrupt priority level 0 and group level 0 ... interrupt priority level 15 and group level 4). The task priority levels, which are used to schedule the execution of the tasks, are never changed during the execution of the application.

 

The interrupt priority level of the real-time kernel can, at the initialisation of O'Tool Executive, be specified to a value between 0 and 13. I recommend a value between

5 and 8. Choose the higher of these values, if the application contains many interrupt handlers, which are supported by O'Tool Executive and which require different interrupt priority levels.

 

The ordinary execution of tasks is done at the default CPU interrupt level (i.e. interrupt priority level 0 and group level 0). When calling various services of O'Tool Executive, the interrupt level of a task is temporarily raised to the interrupt level specified for the real-time kernel, if necessary.

 

As no rendezvous can be performed between an interrupt handler and a task, the CPU interrupt level of a task cannot be temporarily raised during an interrupt.

 

* The idea of virtual Interrupt Tasks that handle interrupts and communicates with

ordinary tasks in the application are out-of-date. Consider them to be ordinary interrupt handlers.

 

Any interrupt handler, which has an interrupt priority level that is lower than the level specified for the real-time kernel, is allowed to use (some specific) services which are delivered by O'Tool Executive. Interrupts, which are time critical and which do not need services from O'Tool Executive, can be given higher interrupt priority levels.

 

When an interrupt (with interrupt priority level > 0) occurs, the execution of the current task is stopped, and the interrupt handler in question starts to execute at the CPU interrupt level that is specified for the interrupt. The stacks of the current task are used by the interrupt handler. If an interrupt with higher interrupt priority level occurs, the execution of the current interrupt handler is stopped and so on. The number of nestled interrupts that are allowed are only restricted by the number of interrupt priority levels available in the microcontroller, and especially by the sizes of the task stacks.

 

The maximum total frequency for interrupts, which have interrupt handlers that use services from O'Tool Executive, is limited to 4 kHz.

 

* The only routines that are permitted to call from an interrupt handler (or from the

sub-routines the interrupt handler calls) are:

- 'otool_INT_SEND', and 'otool_INT_RELEASE'.

- 'otool_RELEASE' (this is only permitted in O'Tool/80C166 v3.60).

- 'otool_NOTIFY_TSLICE' and 'otool_NOTIFY_TICK'.

- 'otool_NEW'.

 

* The following routines are not implemented:

- 'otool_ALLOCATE'.

- 'otool_RAISE'.

- 'otool_INT_CALL'.

- 'otool_INT_QENTER'.

 

* The interrupt priority level of the interrupt handler, which is used to increment

the internal clock of O'Tool Executive, must be the highest level serviced by O'Tool Executive ( i.e. the interrupt priority level must not be higher than the level specified for the real-time kernel). The periodicity of the trigger source, which "calls" the interrupt handler, is recommended to be set to 1 -10 ms.

 

* The interrupt priority level of the interrupt handler, which is used to notify the

time slicing mechanism of O'Tool Executive, must be the highest level serviced by O'Tool Executive ( i.e. the interrupt priority level must not be higher than the level specified for the real-time kernel). Note that up to four interrupts can have the same interrupt priority level, as long as they are given different group levels.

 

* The System Stack ( = User Stack, as defined for the BSO/Tasking tool chain) is

only used until the end of the System Start Function. During the following execution of tasks, the User Stacks belonging to the respective tasks are used to store function parameters and function-internal variables. All tasks also have their own copies of the Internal System Stack ( = System Stack, as defined for the BSO/Tasking tool chain). The copy of the Internal System Stack and the Kernel Stack belonging to a task are used to implement a Virtual Internal Stack for that task. The purpose of the virtual stack handling is to handle overflow situations for the Internal System Stack.

The relations between the different types of stacks are shown in Figure 13.

 

* It is desirable that the Internal System Stack does not overflow during the execution the

final application, because the virtual stack handling slows down the execution. By default, the largest memory space possible (512 bytes) is therefore reserved for the Internal System Stack. It is recommendable to use this size.

 

* All task stacks must be large enough to hold the variables of interrupt handlers that are

called, when the maximum number of nesteled interrups occurs.

 

* There are limitations to how O'Tool tasks can use floating point arithmetic.

These limitations have as a consequence that erroneous results will be achieved, if an O'Tool task, which is performing floating point arithmetic, is interrupted by another O'Tool task that also starts to perform floating point arithmetic. Note that the use of the compiler option "-Fr" or "-FR" does not prevent this erroneous behaviour, because the task bodies (i.e. program code) of all O'Tool tasks are linked to the same program unit (i.e. into the same relocatable link file), corresponding to a single Siemens Interrupt Task. Work around: if a task switch can possibly occur during the execution of a floating point expression, treat the floating point arithmetic in the application as a non shareable resource.

B.1.2. Requirements when using the O'Tool package

If you want to use the O'Tool package, the following requirements, among others, must be fulfilled:

* Some requirements are mentioned in the section called "Details of O'Tool

Executive".

* Some important initiations of O'Tool Executive and O'Tol IOS have to be

performed in the System Start Function (refer to [14, 17]).

* No interrupts are allowed during the execution of the System Start Function.

 

* It is necessary to compile the C code files of the application using the memory

model Large (because the libraries of the O'Tool package are adapted to this memory model). The corresponding compiler option is "-Ml".

 

* It is necessary to macro preprocess the assembly code files (which include

"macro.q" and "model.q") of the application, using the following controls as command line arguments when calling m166:

" DEFINE(MODEL,LARGE) DEFINE(C167,1) DEFINE(C165,0) "

These controls involve the definition of the macros "MODEL", "C167", and "C165", which are used to achieve conditional assembly.

 

* The assembly code file "ot_cnf.s" and the library "olt167l.lib" must be linked to

the application. This file and this library are found in the sub-directory P167L in the home directory of the O'Tool package.

* If O'Tool Monitor Printer Package is also to be used, the library "olt167l_.lib" must

be linked to the application. This library is found in the sub-directory P167L in the home directory of the O'Tool package.

* If O'Tool IOS is also to be used, the library "olt167li.lib", must be linked to

the application. This library is found in the sub-directory P167LIOS in the home directory of the O'Tool package.

 

* The relocatable link files "ot_stkov.ll7", "ot_stkun.ll7", and "ot_flush.ll7" must be

merged with the application during the locate stage. These files are found in the sub-directory P167L in the home directory of the O'Tool package.

* The sections of class 'OLIRAM' must be mapped to the internal RAM memory of

the microcontroller.

* The sections of class 'OLCODE' must be mapped to the same memory segment.

* Since the System Stack (= the ordinary User Stack, as defined for the

BSO/Tasking tool chain) is only used until the end of the System Start Function, it is wise to reduce the size of this stack (a size of 100 bytes is good enough).

 

NOTE that the requirements of the microcontroller and the requirements of the downloading method used are added to the requirements stated above.

 

Appendix C

C.1. Debugging an application using the debugger XVW166E v1.1

C.1.1. The debugger

The debugger xvw166e v1.1 from BSO/Tasking (the name of the executable is "xvw166e.exe") is used to load an application into and debug this application in BaseNode 167. The application must have been formatted into a XVW166 load file (suffix .abs ).

 

The files needed to support xvw166e v1.1 are shown in Figure 14. The files "boot167.abs" and "mon167.abs" must be the ones designed specially for xvw166e v1.1. The file "reg167.dat" contains register declarations for the microcontroller C167CW.

 

xvw166e v1.1 can be used to download programs into the RAM memory of BaseNode 167. The bootstrap function of the microcontroller is used, i.e. the microcontroller must be started in Bootstrap Loader Mode, and the program is downloaded via the Asynchronous/Synchronous Serial Channel ASC0. The communication rate can be set to <= 19200 baud, via an option written as a command line argument, when calling xvw166e v1.1. A number of other useful options exist, which are for example used to choose COM port in the host PC, and to specify a file with macros that can be used as commands, when working with the debugger (refer to [13]).

C.1.2. Loading and debugging

The microcontroller is started in Bootstrap Loader Mode. Boot program is downloaded to the target computer, and is started. Monitor program is downloaded and started, by the boot program. The load file is downloaded and programmed into the RAM memory, by the monitor program. The monitor program then waits for the user to send commands, via xvw166e v1.1 in the host PC, e.g. to start the execution of the application. The only way to steer xvw166e v1.1 is from the command line. Some hints about how to do this are given in the section called "Useful hints when using the debugger".

C.1.3. Requirements when using the debugger

If you want to download and execute an application by using the debugger xvw166e v1.1, the following requirements must be fulfilled:

* The RAM memory of the development ECU BaseNode 167 must be mapped by

hardware to the memory range 00000h - 3FFFFh. This is done by placing the two jumpers on the Controller Board in the positions indicated in Figure 15.

 

 

* The application must not use the Asynchronous/Synchronous Serial Channel

ASC0 (in the C167CW) or alter the initiations made for it.

 

* It is necessary to compile the C code files of the application using the additional

option "-g". This option tells the compiler to insert certain controls in the assembly code it generates. In the next stage of the tool chain, these controls instruct the assembler to include symbolic information in the relocatable object file.

* It is wise to compile the C code files of the application using the additional options

"-OZ -OO". These options tell the compiler not to make certain code and data optimisations, when generating the assembly code. This prevents the debugger from getting confused.

 

* The C code file "end.c" must always be linked to the application. This file is

found in the sub-directory EXAMPLES\XVW in the home directory of the BSO/Tasking tool package.

* The C code file "simio.c" must be linked to the application, when simulated I/O

is to be used. This file is found in the sub-directory EXAMPLES\IO in the home directory of the BSO/Tasking tool package.

 

* During the locate stage, the following memory ranges must be reserved to

prevent data and code sections to be allocated to them:

- 00200h to 00FFFh (monitor code and data)

- 0FCC0h to 0FCDFh (monitor register bank)

The memory areas are used by the monitor part of the debugger. The monitor used in this project is the RAM monitor EVA167.

* During the locate stage, all data and code sections must be allocated to memory

areas corresponding to RAM memory.

 

* The resulting absolute object file from the locate stage of l166 must be converted

to a suitable format, using the formatter ieee166.

 

* The microcontroller of the ECU must be started in Bootstrap Loader Mode. This is

achieved by placing the jumper, which is situated on the I/O Board of BaseNode 167, in the position indicated in Figure 16.

* The debugger must be called with the option "-C 167" (among others). This option

tells the debugger that the target processor belongs to the C167 family.

 

 

 

NOTE that the requirements of the microcontroller and the requirements of the O'Tool package (if this is used) are added to the requirements stated above.

C.1.4. Useful hints when using the debugger

Note the following remarks about how to write an application that is to be debugged:

1) You must add a new line character ("\n") at the end of a string, which is to be

written by the use of for example 'printf', when simulated I/O is to be used. Otherwise the debugger will not show the message on the PC screen.

 

Note the following remarks about how to debug an application:

1) You can inspect the register contents of the microcontroller by using the syntax:

$register

2) You must initiate the necessary communication streams in the debugger, if you

are going to use simulated I/O.

3) If you place brake points in interrupt handlers, the behaviour of the application may be

seriously affected. Among other things, the frequency measurement driver "cap_dev", which belongs to CFT I/O Driver Package, may be disturbed.

4) The source files of the routines, in which you want to place brake points, must be present

in the PC that is used as a host when debugging.

5) If different PCs are used to build and debug an application, it is wise to specify in the

makefile the paths of the source files, which is to be debugged, in a relative manner. The home directory of the application may, for example, be used as the reference. If you copy these files to a directory structure in the PC, which is to be used for debugging, and this structure has the same relative appearance, the source files will be found by the debugger.

6) If you want to debug an assembler source file, this file must not have more than one code

section and this section must be placed first in the source module, i.e. before all data sections (including register banks).

7) If you have problems to place break points correctly in a routine, in spite of the fact that

the corresponding C code file has been compiled with the options "-g -OO", the source file and the load file are probably inconsistent.

 

Note the following pitfalls of xvw166e v1.1:

1) An erroneous result may be returned, when you are inspecting a structure (of type

'struct'), which is identified with the help of a pointer.

2) An erroneous result may be returned, when you inspect bit-variables that are defined in

the application (i.e. that are not part of any bit-addressable register of the microcontroller).

3) If you place a break point on the first bracket ( "{" ) of a function erroneous results will

be returned, when you inspect the values of the function parameters.

4) An erroneous result is returned when you inspect the value of a variable, which is

identified with the help of a pointer that is implemented as a register variable (i.e. that has the type 'register').

5) If you try to evaluate an expression of the type "(pointer1-> pointer2) == pointer3" on the

command line of the debugger, the debugger may crash.

6) It is impossible to put break points in other Siemens Interrupt Tasks than the one that

corresponds to the reset interrupt (which normally calls the C-start function).

7) Often the debugger is unable to interrupt the application being executed in the

microcontroller.

 

Appendix D

D.1. Loading an application using the stand alone load program VIAPC

D.1.1. The load program

The stand alone program viapc from Mecel AB (the name of the executable is "viapc.exe") is used to load an application into BaseNode 167. The application to be downloaded must have been formatted into a load file with Intel Hex format (suffix .hex ). The files needed to support viapc are shown in Figure 17.

 

Two main downloading alternatives can be chosen via the menus of viapc (the program is supported by Microsoft Windows):

* The "Boot programs" alternative, which can be used to download programs into

the entire flash memory (all eight flash memory sectors). This alternative can be used to download a new Base Block into the flash memory sector 0.

The bootstrap function of the microcontroller is used, i.e. the microcontroller must be started in Bootstrap Loader Mode, and the program is downloaded via the Asynchronous/Synchronous Serial Channel ASC0. No monitor part (Base Block) of viapc has to be present in BaseNode 167, when the downloading is initiated. The communication rate can be set to <= 19200 baud, via the menus of viapc.

* The "Application program" alternative, which is used to download a new

Application Block into flash memory sector 1-7.

The microcontroller must be started in Normal Mode, and the monitor part (Base Block) of viapc has to be present in BaseNode 167, when the downloading is initiated. Two communication alternatives exist, which can be chosen via the menus of viapc:

- RS232. The application is downloaded via the Asynchronous/Synchronous

Serial Channel ASC0 of the microcontroller. The communication rate must be set to 9600 baud, via the menus of viapc.

- CAN, which does not work.

 

More detailed descriptions, partly based on hand-written notes supplied by Mecel AB, of the two downloading alternatives are given in the two following sections.

D.1.1.1. Loading by using the "Boot programs" alternative

The microcontroller is started in Bootstrap Loader Mode. Boot program 1 is downloaded to the target computer, and is started. Boot program 2 is downloaded and started, by boot program 1. The load file, which consists of the Base Block and the Application Block, is downloaded and programmed into the flash memory, by boot program 2. The application signature is also written into the flash memory by boot program 2.

 

You start a loaded application by resetting the microcontroller and starting it in Normal Mode.

D.1.1.2. Loading by using the "Application program" alternative

The microcontroller is started in Normal Mode. The reset vector of the Base Block points at a program reload initiation routine instead of the C-start routine (refer to Figure 18). The initiation routine determines (with the aid of an Application Signature) if an Application Block is present in the flash memory. If it is, a jump is made to the reset vector of the Application Block. If no Application Block is present, a jump is made to a command interpreter in the Base Block. The command interpreter waits for commands from the host PC and co-ordinates the reprogramming of the Application Block.

 

You start a loaded application by resetting the microcontroller and starting it in Normal Mode.

 

The interrupt vector table of the Base Block contains only jumps to the corresponding locations of the interrupt vector table of the Application Block. The only exception is the reset vector of the Base Block, as mentioned above.

 

The RS232 protocol of the Base Block uses no interrupts. This protocol cannot be used outside the Base Block.

 

If you want to be able to reprogram BaseNode 167, when an Application Block

is already present in BaseNode 167, you have to design the actual application in the Application Block so that it is able to receive the command "start reprogramming" from viapc in the host PC. When reprogramming is allowed by the application, any null character, which is received by the Asynchronous/ Synchronous Serial Channel ASC0, should be interpreted as this command. When this command has been received, an acknowledge character must be sent, by calling the routine 'putch', and then a jump has to be made to the Base Block, by calling the routine 'load_application'.

 

If the ASC0 channel is not used in the application, or is configured in an improper way, the configuration has to be adjusted before any commands can be received from viapc. The detection of the "start reprogramming" command is done by using the end-of-reception interrupt of the ASC0 channel.

If the end-of-reception interrupt has to be used by an I/O driver, which you do not want to adapt, you later have to use the "Boot programs" alternative, when loading a new application into BaseNode 167 .

 

An example of the above is implemented in the files "rs232int.c" and "shutdown.c", which are found in the directory CALLE\MECEL\OWN_SRC. In this example the routine 'config_rs232' is used to configure the ASC0 channel properly.

D.1.2. Requirements when using the load program

If you want to download an application by using viapc, the following requirements must be fulfilled:

* The ROM and RAM memories of the development ECU BaseNode 167 must be

mapped by hardware to the memory ranges 00000h - 3FFFFh and 40000h - 7FFFFh, respectively. This is done by placing the two jumpers on the Controller Board in the positions indicated in Figure 19.

 

 

* It is necessary to compile the C code files of the Base Block using the additional

option "-D_C167". This option involves the definition of the macro "_C167", which is used to achieve conditional compilation.

* It is also necessary to compile the C code files of the Base Block using the

memory model Large (since "initboot.c" has been adapted to this memory model ). The corresponding compiler option is "-Ml".

 

* The following C code files, which constitute the monitor part (Base Block) of the

load program, must always be linked to the application:

- "jmp.mac" , which contains a special interrupt vector table that is

mapped to memory address 00000h.

- "initboot.c" , which contains an initiation routine that makes the initiations

needed to execute this monitor in the microcontroller of the ECU. This routine also checks if an Application Block is present in the ROM memory. If this is the case, the application is started, but if it is not, a command interpreter of the monitor is called.

- "command.c" , which contains routines that implement a command

interpreter that co-ordinates the reprogramming of the Application Block. The file contains the routine 'load_application' (which is always mapped to the address 00210h).

- "vciprot.c" , which contains routines that implement an RS232 protocol

and thus initiate and perform asynchronous serial communication with the host PC. The file contains the routine 'putch' (which is always mapped to the address 00250h).

- "flash.c" , which contains routines that implement a flash programmer

that puts the new Application Block into the flash memory.

These files are found in the directory CALLE\MECEL\SOURCE.

* If you want to load a new Application Block by using the "Application program"

alternative in viapc, when an old Application Block is already present in the flash memory, (adaptations of) the following C code files must be linked to the application:

- "rs232int.c" , which contains routines that initiate the downloading

of a new Application Block. To make the reception of commands from viapc in the host PC possible, the routine 'config_rs232' must be called from the application. The interrupt routine 'rs232_rx_irq' has application specific parts. This routine is used to handle interrupts from the ASC0 channel of the C167CW.

- "shutdown.c" , which contains two routines whose details are

application specific. One of the routines is used to check if reprogramming is allowed, and the other routine is used to perform the operations needed to make the actual termination.

These files are found in the directory CALLE\MECEL\OWN_SRC.

 

* During the locate stage, all code and constant data sections must be allocated to

memory areas corresponding to ROM memory. Other data sections must be allocated to memory areas corresponding to RAM memory.

* During the locate stage, the code and constant data sections of the Base Block

must be mapped to the memory address range 00000h - 07FFFh. This range corresponds, with a correct physical mapping of the ROM memory, to the flash memory sector No. 0. Furthermore the code and constant data sections of the Application Block have to be prevented from being mapped to this sector.

* During the locate stage, the following memory ranges must be reserved to

prevent data and code sections from being allocated to them:

- 0C000h to 0C003h (Application Signature)

- 4C000h to 4C1FFh (Swap area for flash programming)

The memory areas are used by the Base Block.

* During the locate stage, the ordinary interrupt vector table must be mapped to

memory address 08000h. This address corresponds, with a correct physical mapping of the ROM memory, to the beginning of flash memory sector No. 1.

* During the locate stage, the code section _ICALL (of class 'SHAREDRTLIB') must

be mapped to memory address 00200h. This address falls within a range that, with a correct physical mapping of the ROM memory, corresponds to the flash memory sector No. 0.

 

* The resulting absolute object file from the locate stage of l166 must be converted

to a suitable format, using the formatter ihex166.

 

* When the "Boot programs" alternative is used in viapc, the microcontroller of the

ECU must be started in Bootstrap Loader Mode. This is achieved by placing the jumper, which is situated on the I/O Board of BaseNode 167, in the position indicated in Figure 16.

* When the "Application program" alternative is used in viapc , the microcontroller

of the ECU must be started in Normal Mode. This is achieved by placing the jumper, which is situated on the I/O Board of BaseNode 167, in the position indicated in Figure 16. The monitor part (Base Block) of the load program has to be present in the memory range 00000h - 07FFFh. This range corresponds, with a correct physical mapping of the ROM memory, to flash memory sector No. 0.

 

NOTE that the requirements of the microcontroller and the requirements of the O'Tool package (if this is used) are added to the requirements stated above.

 

Appendix E

E.1. Terminology used in this paper

 

Term used

Explanation

application building tool

 

 

Host computer program, which is used to build and debug applications.

application component

 

 

 

A source module, relocatable object file, relocatable link file, absolute object file, or library that constitutes a part of an application.

to build an application

 

 

 

 

 

The work of compilation, macro preprocessing, assembly, linkage, location, and formation that is performed to get a program, which can be loaded into the target computer.

capture input

 

Edge detection on digital port pin.

capture/compare I/O

 

 

 

 

 

Short for "capture input and compare output". These I/O functions are implemented as alternative functions of the same communication channel in the C167CW.

compare output

 

Pulse generation on digital port pin.

CPU interrupt level

 

 

Short for "interrupt priority level and group level" (interrupt levels which are defined by the interrupt system of the microcontroller).

ECU

 

Embedded Computation Unit

in-target-computer support software

 

 

 

 

 

Software that is meant to be merged and downloaded to the target computer together with the actual application. This software supplies services to the actual application.

I/O connection

 

 

I/O function and its corresponding pins on the chip or circuit board.

 

jumper

 

 

 

A prefabricated removable loop, which is used to electrically connect two pins on a circuit board.

microcontroller-based programming environment

 

 

The aspects of the programming environment that are related to the fact that a microcontroller is used.

microcontroller-based hardware environment

 

For example an ECU.

 

 

Appendix F

F.1. Makefile templates for simple applications

Two simple makefile templates are presented in this appendix. The first template is accurate when you want to debug the application using a debugger from BSO/Tasking (for example xvw166e v1.1). The second is appropriate when you want to load the application using the stand alone load program viapc. These templates can also be found in the directory CALLE\MAKEFILE.

F.1.1. Building for debugging with xvw166e v1.1

Warning! This makefile template may contain some syntax errors, because of the fact that one can not test a template...

 

####################################################################

#

# PROJECT xxx (Makefile template)

#

# FILE deb_mk.mak

#

# DESCRIPTION This is a makefile for building the fictitious project

# "xxx", which use O'Tool Executive and the fictitious

# I/O driver "yyy_dev" that is supported by O'Tool IOS.

# Since this makefile is just a template, adjustments have

# to be made when creating a real makefile. For example,

# all occurrences of ??? must be replaced.

#

# MAKE PROGRAM The make utility "mk166" from BSO/Tasking.

#

# DESIGNED BY Carl F Trefil

#

#### ----------------------------------------------------

# NOTE 1 - This file is based on ??? in directory C:\???\???.

#

# NOTE 2 - The memory model Large is used.

#

# - The result of this make is meant to be USED FOR DEBUGGING

# with xvw166e v1.1 debugger.

#

# - RESERVATIONS are made for

# * internal memory area, which is reserved by C167CW.

# * PEC source and destination pointer registers.

# * data buffers, control registers etc. of the CAN

# module.

# * areas needed by the monitor part (which is

# implemented in "mon167.abs") of the xvw166e v1.1

# debugger.

# * areas used by the load program from Mecel AB.

#-----------------------

# NOTE 3 - The versions of the files "simio.c" and "end.c" should be

# those that are made for xvw166e v1.1 !

#-----------------------

# NOTE 4 - This file includes the necessary instructions for building

# an application, which uses the O'TOOL EXECUTIVE...

# NOTE 5 - ...and the O'TOOL IOS.

#

#### ----------------------------------------------------

# HOW TO USE - To build the "xxx" project type: mk166 -f xxx_mk.mak

#

# - The 'cla' and 'clab' targets remove files generated from

# the Application Block. The files specific for this appl. are

# removed by 'cla'... Type: mk166 cla

# ...and the more general ones by 'clab'. Type: mk166 clab

#

# - The 'cld' target removes files generated from DEBUGGER

# related source files. Type: mk166 cld

#

# - The 'clabs' target removes the .ABS-file.

# Type: mk166 clabs

#

#### ----------------------------------------------------

# REVISION LOG

# Rev Date Sign Description

# 1.0 950628 CF

#

####################################################################

 

################

# Macro definitions...

#

 

#### ...for locating.

OTOOL_ROUTINES = C:\???\P16XL\P167L

 

LOC = xxx_mk.lno\

\

t_tick.lno\

\

$(OTOOL_ROUTINES)\ot_stkov.ll7\

$(OTOOL_ROUTINES)\ot_stkun.ll7\

$(OTOOL_ROUTINES)\ot_flush.ll7\

\

yyy_int1.lno\

yyy_int2.lno

 

#### ...for linking.

OTOOL_LIB = C:\???\P16XL\P167L

OTOOL_IOS_LIB = C:\???\P16XL\P167LIOS

C_LIB = C:\???\LIB\EXT

 

APPL = bn167_cs.obj\

\

end.obj\

simio.obj\

\

ot_cnf.obj\

\

xxx_exc.obj\

xxx_st.obj\

xxx_tsk.obj\

xxx_tick.obj\

\

yyy_ioc.obj\

yyy_dev.obj

 

 

#### ...for compiling.

# The options "-OZ -OO -g" must be used when you are building for the

# xvw166e v1.1 debugger. More options must be added, when floating point

# arithmetic is used.

#

CFLAGS = -Ot -N -x -Ml -e -err -OZ -g -OO

 

### Directories where source files can be found.

OTOOL_IOS_ROUTINES = C:\???\P16XL\P167LIOS

XVW166E_ROUTINES = C:\???\XVW166E

 

yyy_DRIVER_ROUTINES = C:\???\IO_C167\yyy_IOS\DRIVE_???

yyy_PROJECT_ROUTINES = C:\???\IO_C167\yyy_IOS

 

### Directories where include files can be found.

OTOOL_INC = -IC:\???\P16XL\P167L

OTOOL_IOS_INC = -IC:\???\P16XL\P167LIOS

 

yyy_DRIVER_INC = -IC:\???\IO_C167\yyy_IOS\DRIVE_???

 

#### ...for assembling.

AFLAGS = NOPRINT

 

BASENODE167_CSTART = C:\???\MECEL\CSTART

 

#### ...for macro preprocessing.

# More controls must be added, when floating point arithmetic or initialized

# bit variables are used.

MFLAGS = DEFINE(MODEL,LARGE) DEFINE(C167,1) DEFINE(C165,0)

 

#################

# Build a new suffixes list, which is used to check files that have not

# got any explicit targets specified.

 

# Clear suffixes list.

.SUFFIXES:

 

# New suffixes treated.

.SUFFIXES: .c .s

 

 

################

# mk166 initially checks this target.

#

 

ALL : xxx_mk.hex

#################

# Formation instructions

#

 

xxx_mk.abs : xxx_mk.out

 

ieee166 xxx_mk.out xxx_mk.abs

 

#################

# Location instructions

#

 

xxx_mk.out : $(LOC)

#### Feed inline temporary file to l166.

l166 @<<EOF

 

LOCATE

 

;### Specify the interrupt vectors and their corresponding

; relocatable link files, which contain the respective low level

; interrupt handlers (task procedures).

; No explicit task declaration is made for this relocatable

; link file, because it maybe contains several task procedures.

xxx_mk.lno

 

TASK INTNO= ???H ; If timer T5 is used as trigger

; source: INTNO = 25H

t_tick.lno

 

TASK INTNO=4H

$(OTOOL_ROUTINES)\ot_stkov.ll7

 

TASK INTNO=6H

$(OTOOL_ROUTINES)\ot_stkun.ll7

 

TASK INTNO=29H ;To be co-ordinated with interrupt defined

;in file ot_cnf.s

$(OTOOL_ROUTINES)\ot_flush.ll7

 

TASK INTNO= ???H

xxx_int1.lno

 

TASK INTNO= ???H

xxx_int2.lno

 

 

;#### Let ALL the following locator controls affect ALL the specified

; relocatable link files.

GENERAL

 

;#### Specify the IRAM size to be assumed larger than

; the default.

IRAMSIZE(2048)

 

;#### It is not necessary to specify the appearance of the

; physical memory space, because the RAM memory is mapped

; (by hardware) to the address range 00000h - 3FFFFh.

 

;#### Reserve critical memory areas.

; Reserve internal memory area, which is reserved by C167CW.

RESERVE (MEMORY (0F200H TO 0F5FFH))

 

; Reserve space for PEC source and destination pointer registers.

RESERVE (MEMORY (0FCE0H TO 0FCFFH))

 

; Reserve space for data buffers, control registers etc. of the

; CAN module.

RESERVE (MEMORY (0EF00H TO 0EFFFH))

 

; Reserve some memory ranges which can be used by the debug monitor

; The first two ranges are used by the RAM monitors for 80166

; and C167 (e.g. EPC166, EVA167). The third range is only

; used by the ROM monitor on the EVA166.

RESERVE MEMORY

(

00200h to 00FFFh ; Monitor code and data

0FCC0h to 0FCDFh ; Monitor register bank

0FD00h to 0FD4Bh ; Reserved area when using EVA166

)

 

;#### Map sections to suitable memory areas.

; Map critical RAM-sections to IRAM .

CLASSES('CINITIRAM'

; The section OLIRAM from O'Tool Executive must be placed

; in IRAM.

'OLIRAM' ( 0F600H TO 0FCDFH ) )

 

; Map sections of class OLCODE, which are generated from O'Tool

; Executive, to the same memory segment:

CLASSES( 'OLCODE' ( 10000H TO 1FFFFH ) )

 

;#### Adjust stack sizes.

; The size of the Internal System Stack can be decreased.

; If it is, the file "ot_cnf.s" must also be appropriately modified.

; CLASSES( SYSSTACK( 1 ) )

 

; Decrease the User Stack size.

SECSIZE(C166_US(100))

 

;#### Steer the general location process.

; NOCHECKCLASSES ; No classes check

HEADER ; Add a header page to the map file.

CASE ; Treat upper and lower case characters in symbol names

; as different.

 

TO xxx_mk.out

;#### End of inline temporary file .

EOF

 

 

####################

# Linkage instructions

#

 

xxx_mk.lno : $(APPL)

#### Feed inline temporary file to l166.

l166 @<<EOF

 

LINK

 

;#### Specify the relocatable object files, which shall be linked.

$(APPL)

 

;#### Specify suitable libraries.

$(OTOOL_LIB)\olt167l.lib

$(OTOOL_IOS_LIB)\olt167li.lib

 

$(C_LIB)\c166l.lib

 

;#### Steer the general link process.

CASE

HEADER

 

TO xxx_mk.lno

 

 

;#### End of inline temporary file .

EOF

 

 

#####################

# Instructions for building Siemens Interrupt Tasks

#

 

.s.lno :

m166 $< $(MFLAGS) TO $*.src

a166 $*.src $(AFLAGS) TO $*.obj

l166 $*.obj CASE TO $*.lno

 

 

# This file contains a low level interrupt handler for the trigger source,

# which is used to trigger the internal clock in O'Tool Executive.

t_tick.lno : $(OTOOL_ROUTINES)\t_tick.s macro.q model.q

 

# These files contain low level interrupt handlers for the I/O driver.

yyy_int1.lno : $(yyy_PROJECT_ROUTINES)\yyy_int1.s macro.q model.q

 

yyy_int2.lno : $(yyy_PROJECT_ROUTINES)\yyy_int2.s macro.q model.q

 

#####################

# Assembler modules

#

 

.s.obj :

 

m166 $< $(MFLAGS) TO $*.src

a166 $*.src $(AFLAGS) TO $*.obj

 

 

#### This file contains the C-start function for BaseNode 167 .

bn167_cs.obj : $(BASENODE167_CSTART)\bn167_cs.s

 

#### This file is a part of O'Tool Executive .

ot_cnf.obj : $(OTOOL_ROUTINES)\ot_cnf.s macro.q model.q

 

 

#####################

# Local C-modules

#

 

.c.obj :

#### Feed inline temporary file to c166 .

c166 -f <<EOF

$<

$(separate "\n" $(CFLAGS) )

$(separate "\n" $(OTOOL_INC) $(OTOOL_IOS_INC) )

$(separate "\n" $(yyy_DRIVER_INC) )

EOF

 

a166 $*.src $(AFLAGS) TO $*.obj

 

#### The actual application .

xxx_exc.obj : xxx_exc.c

 

xxx_st.obj : xxx_st.c xxx_def.h

 

xxx_tsk.obj : xxx_tsk.c xxx_def.h

 

xxx_tick.obj : xxx_tick.c

yyy_ioc.obj : $(yyy_DRIVER_ROUTINES)\yyy_ioc.c \

$(yyy_DRIVER_ROUTINES)\yyy_ioc.h

 

yyy_dev.obj : $(yyy_DRIVER_ROUTINES)\yyy_dev.c \

$(yyy_DRIVER_ROUTINES)\yyy_dev.h \

$(yyy_DRIVER_ROUTINES)\yyy_ioc.h

 

#### Files needed by the xvw166e v1.1 debugger :

end.obj : $(XVW166E_ROUTINES)\end.c

 

simio.obj : $(XVW166E_ROUTINES)\simio.c

 

####################

# If you hide the target "cla", these files will be erased immediately.

#

 

cla :

-del xxx_exc.src

-del xxx_st.src

-del xxx_tsk.src

-del xxx_tick.src

 

-del t_tick.src

 

-del xxx_exc.obj

-del xxx_st.obj

-del xxx_tsk.obj

-del xxx_tick.obj

 

-del t_tick.obj

 

-del xxx_mk.lno

-del t_tick.lno

 

-del xxx_mk.out

 

####################

# If you hide the target "clab", these files will be erased immediately.

#

 

clab :

-del ot_cnf.src

-del bn167_cs.src

 

-del yyy_ioc.src

-del yyy_dev.src

-del yyy_int1.src

-del yyy_int2.src

 

-del ot_cnf.obj

-del bn167_cs.obj

 

-del yyy_ioc.obj

-del yyy_dev.obj

-del yyy_int1.obj

-del yyy_int2.obj

 

-del yyy_int1.lno

-del yyy_int2.lno

 

####################

# If you hide the target "cld", these files will be erased immediately.

#

 

cld :

 

-del end.src

-del simio.src

 

-del end.obj

-del simio.obj

 

#####################

# These files are deleted separately.

#

 

clabs :

-del xxx_mk.abs

-del xxx_mk.map

 

F.1.2. Building for downloading with VIAPC

Warning! This makefile template may contain some syntax errors, because of the fact that one can not test a template...

 

####################################################################

#

# PROJECT xxx (Makefile template)

#

# FILE load_mk.mak

#

# DESCRIPTION This is a makefile for building the fictitious project

# "xxx", which use O'Tool Executive and the fictitious

# I/O driver "yyy_dev" that is supported by O'Tool IOS.

# Since this makefile is just a template, adjustments have

# to be made when creating a real makefile. For example,

# all occurrences of ??? must be replaced.

#

# MAKE PROGRAM The make utility "mk166" from BSO/Tasking.

#

# DESIGNED BY Carl F Trefil

#

#### ----------------------------------------------------

# NOTE 1 - This file is based on ??? in directory C:\???\???.

#

# NOTE 2 - The memory model Large is used.

#

# - The result of this make is meant to be LOADED WITH THE

# load program VIAPC from Mecel AB.

#

# - RESERVATIONS are made for

# * internal memory area, which is reserved by C167CW.

# * PEC source and destination pointer registers.

# * data buffers, control registers etc. of the CAN

# module.

# * areas used by the load program from Mecel AB.

#-----------------------

# NOTE 3 - This makefile must be USED TOGETHER WITH the modified

# version of "jmp.mac" ( = "jmp_mac.v3" ) !

#

# NOTE 4 - The source files of the load program from Mecel AB MUST

# BE PRESENT !

#-----------------------

# NOTE 5 - This file includes the necessary instructions for building

# an application, which uses the O'TOOL EXECUTIVE...

# NOTE 6 - ...and the O'TOOL IOS.

#-----------------------

# NOTE 7 - If the end-of-reception interrupt is used by the I/O

# driver, the files "rs232int.c" and "shutdown.c" must not

# be linked with the application, because this interrupt is

# used by the interrupt routine in "rs232int.c".

# In this case a new application have to be downloaded using

# the "Boot Programs" alternative in VIAPC.

#

#### ----------------------------------------------------

# HOW TO USE - To build the "xxx" project type: mk166 -f xxx_mk.mak

#

# - The 'cla' and 'clab' targets remove files generated from

# the Application Block. The files specific for this appl. are

# removed by 'cla'... Type: mk166 cla

# ...and the more general ones by 'clab'. Type: mk166 clab

#

# - The 'cll' target removes files generated from the Base

# Block of the load program. Type: mk166 cll

#

# - The 'clh' target removes the .HEX-file.

# Type: mk166 clh

#

#### ----------------------------------------------------

# REVISION LOG

# Rev Date Sign Description

# 1.0 950628 CF

#

####################################################################

 

################

# Macro definitions...

#

 

#### ...for locating.

OTOOL_ROUTINES = C:\???\P16XL\P167L

 

LOC = xxx_mk.lno\

\

t_tick.lno\

\

$(OTOOL_ROUTINES)\ot_stkov.ll7\

$(OTOOL_ROUTINES)\ot_stkun.ll7\

$(OTOOL_ROUTINES)\ot_flush.ll7\

\

yyy_int1.lno\

yyy_int2.lno

 

#### ...for linking.

OTOOL_LIB = C:\???\P16XL\P167L

OTOOL_IOS_LIB = C:\???\P16XL\P167LIOS

C_LIB = C:\???\LIB\EXT

 

APPL = bn167_cs.obj\

\

rs232int.obj\

shutdown.obj\

\

initboot.obj\

command.obj\

vciprot.obj\

flash.obj\

jmp.obj\

\

ot_cnf.obj\

\

xxx_exc.obj\

xxx_st.obj\

xxx_tsk.obj\

xxx_tick.obj\

\

yyy_ioc.obj\

yyy_dev.obj

 

 

#### ...for compiling.

# The option "-D_C167" is needed by the load program from Mecel AB.

# More options must be added, when floating point arithmetic is used.

CFLAGS = -Ot -N -x -Ml -e -err -D_C167

 

### Directories where source files can be found.

OTOOL_IOS_ROUTINES = C:\???\P16XL\P167LIOS

LOAD_INIT_ROUTINES = C:\???\MECEL\OWN_SRC

MECEL_ROUTINES = C:\???\MECEL\SOURCE

 

yyy_DRIVER_ROUTINES = C:\???\IO_C167\yyy_IOS\DRIVE_???

yyy_PROJECT_ROUTINES = C:\???\IO_C167\yyy_IOS

 

### Directories where include files can be found.

OTOOL_INC = -IC:\???\P16XL\P167L

OTOOL_IOS_INC = -IC:\???\P16XL\P167LIOS

 

MECEL_INC = -IC:\???\MECEL\INCLUDE

 

yyy_DRIVER_INC = -IC:\???\IO_C167\yyy_IOS\DRIVE_???

 

#### ...for assembling.

AFLAGS = NOPRINT

 

BASENODE167_CSTART = C:\???\MECEL\CSTART

 

#### ...for macro preprocessing.

# More controls must be added, when floating point arithmetic or initialized

# bit variables are used.

MFLAGS = DEFINE(MODEL,LARGE) DEFINE(C167,1) DEFINE(C165,0)

 

#################

# Build a new suffixes list, which is used to check files that have not

# got any explicit targets specified.

 

# Clear suffixes list.

.SUFFIXES:

 

# New suffixes treated.

.SUFFIXES: .c .s .mac

 

 

################

# mk166 initially checks this target.

#

 

ALL : xxx_mk.hex

#################

# Formation instructions

#

 

xxx_mk.hex : xxx_mk.out

 

ihex166 xxx_mk.out xxx_mk.hex

 

#################

# Location instructions

#

 

xxx_mk.out : $(LOC)

#### Feed inline temporary file to l166.

l166 @<<EOF

 

LOCATE

 

;### Specify the interrupt vectors and their corresponding

; relocatable link files, which contain the respective low level

; interrupt handlers (task procedures).

; No explicit task declaration can be made for this relocatable

; link file, because it contains several task procedures.

xxx_mk.lno

 

TASK INTNO= ???H ; If timer T5 is used as trigger

; source: INTNO = 25H

t_tick.lno

 

TASK INTNO=4H

$(OTOOL_ROUTINES)\ot_stkov.ll7

 

TASK INTNO=6H

$(OTOOL_ROUTINES)\ot_stkun.ll7

 

TASK INTNO=29H ;To be co-ordinated with interrupt defined

;in file ot_cnf.s

$(OTOOL_ROUTINES)\ot_flush.ll7

 

TASK INTNO= ???H

xxx_int1.lno

 

TASK INTNO= ???H

xxx_int2.lno

 

 

;#### Let ALL the following locator controls affect ALL the specified

; relocatable link files.

GENERAL

 

;#### Specify the IRAM size to be assumed larger than

; the default.

IRAMSIZE(2048)

 

;#### Specify the appearance of the physical memory space. This is

; not necessary, if the "CLASSES" control is used extensively.

;MEMORY (

; ROM( 0H TO 0EFFFH, 10000H TO 3FFFFH )

; RAM( 0F000H TO 0FFFFH, 40000H TO 7FFFFH )

; )

 

;#### Reserve critical memory areas.

; Reserve internal memory area, which is reserved by C167CW.

RESERVE (MEMORY (0F200H TO 0F5FFH))

 

; Reserve space for PEC source and destination pointer registers.

RESERVE (MEMORY (0FCE0H TO 0FCFFH))

 

; Reserve space for data buffers, control registers etc. of the

; CAN module.

RESERVE (MEMORY (0EF00H TO 0EFFFH))

 

; Reserve space for the application signature (needed by the

; load program).

RESERVE (MEMORY (0C000H TO 0C003H))

; Reserve space for the swap area for flash programming (needed by

; the load program).

RESERVE (MEMORY (4C000H to 4C1FFH))

 

 

;#### Map the interrupt vector table to the beginning of flash

; memory sector 1 (needed because of the load program).

VECTAB(08000H)

 

;#### Map sections to suitable memory areas.

; Map data and code of the load program to flash memory sector 0 .

CLASSES('CBASE' (00000H TO 06FFFH))

CLASSES('DBASE' (07000H TO 07FFFH))

 

; Prevent ROM-sections to be mapped to sector 0 .

CLASSES('CPROGRAM'

'CINITROM'

'CFARROM'

'EXCODE'

'CROM'

'CLIBRARY'

'SHAREDCLIB'

'RTLIBRARY' (08200H TO 0DFFFH, 10000H TO 3FFFFH))

 

CLASSES('SHAREDRTLIB' (08200H TO 0DFFFH, 10000H TO 3FFFFH,

 

; This range must be specified to prevent

; a conflict with the absolute mapping

; of section '__ICALL' bellow !!!

00200H TO 00209H

))

 

; Map critical RAM-sections to IRAM .

CLASSES('CINITIRAM'

; The section OLIRAM from O'Tool Executive must be placed

; in IRAM.

'OLIRAM' ( 0F600H TO 0FCDFH ) )

 

; Prevent these RAM-sections from being mapped to IRAM .

CLASSES( 'CNEAR'

'CFAR'

'CUSTACK'

'OLDATA' (040000h to 080000h))

; Map sections of class OLCODE, which are generated from O'Tool

; Executive, to the same memory segment:

CLASSES( 'OLCODE' ( 10000H TO 1FFFFH ) )

 

; Map critical sections to exact memory locations .

; The section "__ICALL" is a part of the load program.

ADDRESSES SECTIONS (__ICALL (0200H))

;#### Adjust stack sizes.

; The size of the Internal System Stack can be decreased.

; If it is, the file "ot_cnf.s" must also be appropriately modified.

; CLASSES( SYSSTACK( 1 ) )

 

; Decrease the User Stack size.

SECSIZE(C166_US(100))

 

;#### Steer the general location process.

; NOCHECKCLASSES ; No classes check

HEADER ; Add a header page to the map file.

CASE ; Treat upper and lower case characters in symbol names

; as different.

 

TO xxx_mk.out

;#### End of inline temporary file .

EOF

 

 

####################

# Linkage instructions

#

 

xxx_mk.lno : $(APPL)

#### Feed inline temporary file to l166.

l166 @<<EOF

 

LINK

 

;#### Specify the relocatable object files, which shall be linked.

$(APPL)

 

;#### Specify suitable libraries.

$(OTOOL_LIB)\olt167l.lib

$(OTOOL_IOS_LIB)\olt167li.lib

 

$(C_LIB)\c166l.lib

 

;#### Steer the general link process.

CASE

HEADER

 

TO xxx_mk.lno

 

 

;#### End of inline temporary file .

EOF

 

 

#####################

# Instructions for building Siemens Interrupt Tasks

#

 

.s.lno :

m166 $< $(MFLAGS) TO $*.src

a166 $*.src $(AFLAGS) TO $*.obj

l166 $*.obj CASE TO $*.lno

 

 

# This file contains a low level interrupt handler for the trigger source,

# which is used to trigger the internal clock in O'Tool Executive.

t_tick.lno : $(OTOOL_ROUTINES)\t_tick.s macro.q model.q

 

# These files contain low level interrupt handlers for the I/O driver.

yyy_int1.lno : $(yyy_PROJECT_ROUTINES)\yyy_int1.s macro.q model.q

 

yyy_int2.lno : $(yyy_PROJECT_ROUTINES)\yyy_int2.s macro.q model.q

 

#####################

# Assembler modules

#

 

.s.obj :

 

m166 $< $(MFLAGS) TO $*.src

a166 $*.src $(AFLAGS) TO $*.obj

 

.mac.obj :

 

m166 $< $(MFLAGS) TO $*.src

a166 $*.src $(AFLAGS) TO $*.obj

 

 

#### This file contains the C-start function for BaseNode 167 .

bn167_cs.obj : $(BASENODE167_CSTART)\bn167_cs.s

 

#### This file is a part of the load program .

jmp.obj : $(MECEL_ROUTINES)\jmp.mac

 

#### This file is a part of O'Tool Executive .

ot_cnf.obj : $(OTOOL_ROUTINES)\ot_cnf.s macro.q model.q

 

 

#####################

# Local C-modules

#

 

.c.obj :

#### Feed inline temporary file to c166 .

c166 -f <<EOF

$<

$(separate "\n" $(CFLAGS) )

$(separate "\n" $(OTOOL_INC) $(OTOOL_IOS_INC) )

$(separate "\n" $(MECEL_INC) )

$(separate "\n" $(yyy_DRIVER_INC) )

EOF

 

a166 $*.src $(AFLAGS) TO $*.obj

 

#### The actual application .

xxx_exc.obj : xxx_exc.c

 

xxx_st.obj : xxx_st.c xxx_def.h

 

xxx_tsk.obj : xxx_tsk.c xxx_def.h

 

xxx_tick.obj : xxx_tick.c

yyy_ioc.obj : $(yyy_DRIVER_ROUTINES)\yyy_ioc.c \

$(yyy_DRIVER_ROUTINES)\yyy_ioc.h

 

yyy_dev.obj : $(yyy_DRIVER_ROUTINES)\yyy_dev.c \

$(yyy_DRIVER_ROUTINES)\yyy_dev.h \

$(yyy_DRIVER_ROUTINES)\yyy_ioc.h

 

#### Application specific files needed for downloading a new application

# with the load program .

rs232int.obj : $(LOAD_INIT_ROUTINES)\rs232int.c

 

shutdown.obj : $(LOAD_INIT_ROUTINES)\shutdown.c

 

 

#### This files are parts of the load program .

initboot.obj : $(MECEL_ROUTINES)\initboot.c

 

command.obj : $(MECEL_ROUTINES)\command.c

 

vciprot.obj : $(MECEL_ROUTINES)\vciprot.c

 

flash.obj : $(MECEL_ROUTINES)\flash.c

 

 

####################

# If you hide the target "cla", these files will be erased immediately.

#

 

cla :

-del xxx_exc.src

-del xxx_st.src

-del xxx_tsk.src

-del xxx_tick.src

 

-del t_tick.src

 

-del rs232int.src

-del shutdown.src

 

-del xxx_exc.obj

-del xxx_st.obj

-del xxx_tsk.obj

-del xxx_tick.obj

 

-del t_tick.obj

 

-del rs232int.obj

-del shutdown.obj

 

-del xxx_mk.lno

-del t_tick.lno

 

-del xxx_mk.out

 

####################

# If you hide the target "clab", these files will be erased immediately.

#

 

clab :

-del ot_cnf.src

-del bn167_cs.src

 

-del yyy_ioc.src

-del yyy_dev.src

-del yyy_int1.src

-del yyy_int2.src

 

-del ot_cnf.obj

-del bn167_cs.obj

 

-del yyy_ioc.obj

-del yyy_dev.obj

-del yyy_int1.obj

-del yyy_int2.obj

 

-del yyy_int1.lno

-del yyy_int2.lno

 

####################

# If you hide the target "cll", these files will be erased immediately.

#

 

cll :

-del initboot.src

-del command.src

-del vciprot.src

-del flash.src

-del jmp.src

 

-del initboot.obj

-del command.obj

-del vciprot.obj

-del flash.obj

-del jmp.obj

 

#####################

# These files are deleted separately.

#

 

clh :

-del xxx_mk.hex

-del xxx_mk.map

 

Appendix G

G.1. A makefile example: the makefile of the adapted AICC application

This makefile example can be used to build the quite complex adapted AICC application. Since the application uses the ASC0 channel of the C167CW, the stand alone load program viapc must be used to load the application into the ECU. This makefile can also be found in the directory CALLE\AICC_NEW\APPLICTN.

 

####################################################################

#

# PROJECT Part of the AICC application, designed for the

# SAB C167C.

#

# FILE aicc_mk.mak

#

# DESCRIPTION - This is a makefile for building the "aicc_mk" project,

# which use O'Tool Executive and O'Tool IOS.

#

# MAKE PROGRAM The make utility "mk166" from BSO/Tasking.

#

# DESIGNED BY Carl F Trefil

#

#### ----------------------------------------------------

# NOTE 1 - This file is based on the makefiles of the test

# applications.

#

# NOTE 2 - The memory model Large is used.

#

# - The result of this make is meant to be LOADED WITH THE

# load program VIAPC from Mecel AB.

#

# - RESERVATIONS are made for

# * internal memory area, which is reserved by C167CW.

# * PEC source and destination pointer registers.

# * data buffers, control registers etc. of the CAN

# module.

# * areas used by the load program from Mecel AB.

#-----------------------

# NOTE 3 - This makefile must be USED TOGETHER WITH the modified

# version of "jmp.mac" ( = "jmp_mac.v3" ) !

#

# NOTE 4 - The source files of the Base Block of the load program

# MUST BE PRESENT !!! They are currently fetched from the

# directory CALLE\MECEL\SOURCE .

#-----------------------

# NOTE 6 - This file includes the necessary instructions for building

# an application, which uses the O'TOOL EXECUTIVE...

# NOTE 7 - ...and the O'TOOL IOS.

#-----------------------

# NOTE 5 - In this particular case the files "rs232int.c" and

# "shutdown.c" can't be linked with the application,

# because the end-of-reception interrupt, which is coupled to

# the interrupt routine in "rs232int.c", have to be used by

# the low level int. handler in "t_ascrx.s".

# A new application have to be DOWNLOADED USING THE

# "Boot_Programs" alternative in VIAPC.

#-----------------------

# NOTE 8 - The FLOATING POINT library "f166l.lib" is linked

# with the application.

# NOTE 9 - Usage of single precision floating point operations

# is promoted by using the compiler option -FR and

# linking the library "c166ls.lib" with the application

# instead of the library "c166l.lib".

#### ----------------------------------------------------

# HOW TO USE - To build the "aicc" project type: mk166 -f aicc_mk.mak

#

# - The 'cla' and 'clab' targets remove files generated from

# the Application Block. The files specific for this appl. are

# removed by 'cla'... Type: mk166 cla

# ...and the more general ones by 'clab'. Type: mk166 clab

#

# - The 'cll' target removes files generated from the Base

# Block of the load program. Type: mk166 cll

#

# - The 'clh' target removes the .HEX-file.

# Type: mk166 clh

#

#### ----------------------------------------------------

# REVISION LOG

# Rev Date Sign Description

# 1.0 950628 CF

#

####################################################################

 

################

# Macro definitions...

#

 

#### ...for locating.

OTOOL_ROUTINES = C:\USR\CALLE\P16XL\P167L

 

LOC = aicc_mk.lno\

\

t_tick.lno\

\

$(OTOOL_ROUTINES)\ot_stkov.ll7\

$(OTOOL_ROUTINES)\ot_stkun.ll7\

$(OTOOL_ROUTINES)\ot_flush.ll7\

\

ai_int.lno\

\

ao_int.lno\

\

t_ascrx.lno\

t_asctx.lno\

\

can_int.lno\

\

cap_ovfl.lno\

cap_p8_6.lno

 

 

#### ...for linking.

OTOOL_LIB = C:\USR\CALLE\P16XL\P167L

OTOOL_IOS_LIB = C:\USR\CALLE\P16XL\P167LIOS

C_LIB = C:\TASKING\LIB\EXT

 

APPL = bn167_cs.obj\

\

initboot.obj\

command.obj\

vciprot.obj\

flash.obj\

jmp.obj\

\

ot_cnf.obj\

\

aicc_exc.obj\

aicc_st.obj\

aicc_tsk.obj\

aicc_tck.obj\

\

aicc_ctl.obj\

aicc_act.obj\

aicc_pi.obj\

aicc_ini.obj\

aicc_io.obj\

\

ai_ioc.obj\

ai_dev.obj \

\

ao_ioc.obj\

ao_dev.obj \

\

asc_ioc.obj\

asc_dev2.obj\

\

can_ioc2.obj\

can_dev4.obj\

s_can167.obj\

\

cap_ioc.obj\

cap_dev.obj\

\

dio_ioc.obj\

dio_dev.obj\

\

trap.obj\

fpbreak.obj

#<<<#### USED FOR DEBUGGING ####

 

#### ...for compiling.

# The option "-D_C167" is needed by the load program from Mecel AB.

# More options must be added, when floating point arithmetic is used.

CFLAGS = -Ot -N -x -Ml -e -err -D_C167 -FR

 

### Directories where source files can be found.

OTOOL_IOS_ROUTINES = C:\USR\CALLE\P16XL\P167LIOS

LOAD_INIT_ROUTINES = C:\USR\CALLE\MECEL\OWN_SRC

MECEL_ROUTINES = C:\USR\CALLE\MECEL\SOURCE

 

FP_TRAP_ROUTINES = C:\USR\CALLE\FPTRAP

 

AI_DRIVER_ROUTINES = C:\USR\CALLE\IO_C167\AI_IOS\DRIVE_1

AI_PROJECT_ROUTINES = C:\USR\CALLE\IO_C167\AI_IOS

 

AO_DRIVER_ROUTINES = C:\USR\CALLE\IO_C167\AO_IOS\DRIVE_1

AO_PROJECT_ROUTINES = C:\USR\CALLE\IO_C167\AO_IOS

 

ASC_DRIVER_ROUTINES = C:\USR\CALLE\IO_C167\ASC_IOS

 

CAN_ROUTINES = C:\USR\CALLE\MECEL\SOURCE

CAN_IOC_ROUTINES = C:\USR\CALLE\IO_C167\CAN_IOS\DRIVE_3

CAN_DEV_ROUTINES = C:\USR\CALLE\IO_C167\CAN_IOS\DRIVE_4

CAN_PROJECT_ROUTINES = C:\USR\CALLE\IO_C167\CAN_IOS

 

CAP_DRIVER_ROUTINES = C:\USR\CALLE\IO_C167\CAP_IOS\DRIVE_1

CAP_PROJECT_ROUTINES = C:\USR\CALLE\IO_C167\CAP_IOS

 

DIO_DRIVER_ROUTINES = C:\USR\CALLE\IO_C167\DIO_IOS\DRIVE_1

DIO_PROJECT_ROUTINES = C:\USR\CALLE\IO_C167\DIO_IOS

 

### Directories where include files can be found.

OTOOL_INC = -IC:\USR\CALLE\P16XL\P167L

OTOOL_IOS_INC = -IC:\USR\CALLE\P16XL\P167LIOS

 

MECEL_INC = -IC:\USR\CALLE\MECEL\INCLUDE

 

AI_DRIVER_INC = -IC:\USR\CALLE\IO_C167\AI_IOS\DRIVE_1

AO_DRIVER_INC = -IC:\USR\CALLE\IO_C167\AO_IOS\DRIVE_1

ASC_DRIVER_INC = -IC:\USR\CALLE\IO_C167\ASC_IOS

 

CAN_INC = -IC:\USR\CALLE\MECEL\INCLUDE

CAN_IOC_INC = -IC:\USR\CALLE\IO_C167\CAN_IOS\DRIVE_3

CAN_DEV_INC = -IC:\USR\CALLE\IO_C167\CAN_IOS\DRIVE_4

CAN_PROJECT_INC = -IC:\USR\CALLE\IO_C167\CAN_IOS

 

CAP_DRIVER_INC = -IC:\USR\CALLE\IO_C167\CAP_IOS\DRIVE_1

DIO_DRIVER_INC = -IC:\USR\CALLE\IO_C167\DIO_IOS\DRIVE_1

 

#### ...for assembling.

AFLAGS = NOPRINT

 

BASENODE167_CSTART = C:\USR\CALLE\MECEL\CSTART

 

#### ...for macro preprocessing.

# More controls must be added, when floating point arithmetic or initialized

# bit variables are used.

MFLAGS = DEFINE(MODEL,LARGE) DEFINE(C167,1) DEFINE(C165,0) DEFINE(FLOAT,1)

 

#################

# Build a new suffixes list, which is used to check files that have not

# got any explicit targets specified.

 

# Clear suffixes list.

.SUFFIXES:

 

# New suffixes treated.

.SUFFIXES: .c .s .asm .mac

 

 

################

# mk166 initially checks this target.

#

 

ALL : aicc_mk.hex

#################

# Formation instructions

#

 

aicc_mk.hex : aicc_mk.out

 

ihex166 aicc_mk.out aicc_mk.hex

 

#################

# Location instructions

#

 

aicc_mk.out : $(LOC)

#### Feed inline temporary file to l166.

l166 @<<EOF

 

LOCATE

 

;### Specify the interrupt vectors and their corresponding

; relocatable link files, which contains the respective low level

; interrupt handlers (task procedures).

; No explicit task declaration should be made for this relocatable

; link file, when it contains several task procedures.

TASK INTNO= 0H

aicc_mk.lno

 

TASK INTNO= 25H ; If timer T5 is used as trigger

; source: INTNO = 25H

t_tick.lno

 

TASK INTNO=4H

$(OTOOL_ROUTINES)\ot_stkov.ll7

 

TASK INTNO=6H

$(OTOOL_ROUTINES)\ot_stkun.ll7

 

TASK INTNO=29H ;To be co-ordinated with interrupt defined

;in file ot_cnf.s

$(OTOOL_ROUTINES)\ot_flush.ll7

 

TASK INTNO=28H

ai_int.lno

 

TASK INTNO=3FH

ao_int.lno

 

TASK INTNO=2AH

t_asctx.lno

 

TASK INTNO=2BH

t_ascrx.lno

 

TASK INTNO=40H

can_int.lno

 

TASK INTNO=3EH

cap_ovfl.lno

 

TASK INTNO=36H

cap_p8_6.lno

 

 

 

;#### Let ALL the following locator controls affect ALL the specified

; relocatable link files.

GENERAL

 

;#### Specify the IRAM size to be assumed larger than

; the default.

IRAMSIZE(2048)

 

;#### Specify the appearance of the physical memory space. This is

; not necessary, if the "CLASSES" control is used extensively.

;MEMORY (

; ROM( 0H TO 0EFFFH, 10000H TO 3FFFFH )

; RAM( 0F000H TO 0FFFFH, 40000H TO 7FFFFH )

; )

 

;#### Reserve critical memory areas.

; Reserve internal memory area, which is reserved by C167CW.

RESERVE (MEMORY (0F200H TO 0F5FFH))

 

; Reserve space for PEC source and destination pointer registers.

RESERVE (MEMORY (0FCE0H TO 0FCFFH))

 

; Reserve space for data buffers, control registers etc. of the

; CAN module.

RESERVE (MEMORY (0EF00H TO 0EFFFH))

 

; Reserve space for the application signature (needed by the

; load program).

RESERVE (MEMORY (0C000H TO 0C003H))

; Reserve space for the swap area for flash programming (needed by

; the load program).

RESERVE (MEMORY (4C000H to 4C1FFH))

 

 

;#### Map the interrupt vector table to the beginning of flash

; memory sector 1 (needed because of the load program).

VECTAB(08000H)

 

;#### Map sections to suitable memory areas.

; Map data and code of the load program to flash memory sector 0 .

CLASSES('CBASE' (00000H TO 06FFFH))

CLASSES('DBASE' (07000H TO 07FFFH))

 

; Prevent ROM-sections to be mapped to sector 0 .

CLASSES('CPROGRAM'

'CINITROM'

'CFARROM'

'EXCODE'

'CROM'

'CLIBRARY'

'SHAREDCLIB'

'RTLIBRARY' (08200H TO 0DFFFH, 10000H TO 3FFFFH))

 

CLASSES('SHAREDRTLIB' (08200H TO 0DFFFH, 10000H TO 3FFFFH,

 

; This range must be specified to prevent

; a conflict with the absolute mapping

; of section '__ICALL' bellow !!!

00200H TO 00209H

))

 

; Map critical RAM-sections to IRAM .

CLASSES('CINITIRAM'

 

; The section OLIRAM from O'Tool Executive must be placed

; in IRAM.

'OLIRAM' ( 0F600H TO 0FCDFH ) )

 

; Prevent these RAM-sections from being mapped to IRAM .

CLASSES( 'CNEAR'

'CFAR'

'CUSTACK'

'OLDATA' (040000h to 080000h))

; Map sections of class OLCODE, which are generated from O'Tool

; Executive, to the same memory segment:

CLASSES( 'OLCODE' ( 10000H TO 1FFFFH ) )

 

; Map critical sections to exact memory locations .

; The section "__ICALL" is a part of the load program.

ADDRESSES SECTIONS (__ICALL (0200H))

;#### Adjust stack sizes.

; The size of the Internal System Stack can be decreased.

; If it is, the file "ot_cnf.s" must also be appropriately modified.

; CLASSES( SYSSTACK( 1 ) )

 

; Decrease the User Stack size.

SECSIZE(C166_US(100))

 

; The size of the floating point stack can increased from (the default)

; 10*14 to, for example, 20*14 bytes:

; FPSTACKSIZE( FP 20)

 

;#### Steer the general location process.

; NOCHECKCLASSES ; No classes check

HEADER ; Add a header page to the map file.

CASE ; Treat upper and lower case characters in symbol names

; as different.

 

TO aicc_mk.out

;#### End of inline temporary file .

EOF

 

 

####################

# Linkage instructions

#

 

aicc_mk.lno : $(APPL)

#### Feed inline temporary file to l166.

l166 @<<EOF

 

LINK

 

;#### Specify the relocatable object files, which shall be linked.

$(APPL)

 

;#### Specify suitable libraries.

$(OTOOL_LIB)\olt167l.lib

$(OTOOL_IOS_LIB)\olt167li.lib

 

$(C_LIB)\c166ls.lib ; Single precision version is used !!!

$(C_LIB)\f166l.lib ; Floating point library.

 

;#### Steer the general link process.

CASE

HEADER

 

TO aicc_mk.lno

 

 

;#### End of inline temporary file .

EOF

 

 

#####################

# Instructions for building Siemens Interrupt Tasks

#

 

.s.lno :

m166 @<<EOF

$<

$(separate "\n" $(MFLAGS) )

TO $*.src

 

;#### End of inline temporary file :

EOF

a166 $*.src $(AFLAGS) TO $*.obj

l166 $*.obj CASE TO $*.lno

 

# This file contains a low level interrupt handler for the trigger source,

# which is used to trigger the internal clock in O'Tool Executive.

t_tick.lno : $(OTOOL_ROUTINES)\t_tick.s macro.q model.q

 

 

# This file contains a low level interrupt handler for analog input :

ai_int.lno : $(AI_PROJECT_ROUTINES)\ai_int.s macro.q model.q

 

# This file contains a low level interrupt handler for analog output :

ao_int.lno : $(AO_PROJECT_ROUTINES)\ao_int.s macro.q model.q

 

# These files contain low level interrupt handlers for asynch.

# serial communication :

t_ascrx.lno : $(OTOOL_IOS_ROUTINES)\t_ascrx.s macro.q model.q

 

t_asctx.lno : $(OTOOL_IOS_ROUTINES)\t_asctx.s macro.q model.q

 

# This file contains low level interrupt handlers for CAN communication :

can_int.lno : $(CAN_PROJECT_ROUTINES)\can_int.s macro.q model.q

 

# This file contains low level interrupt handlers for capture input:

cap_ovfl.lno : $(CAP_PROJECT_ROUTINES)\cap_ovfl.s macro.q model.q

cap_p8_6.lno : $(CAP_PROJECT_ROUTINES)\cap_p8_6.s macro.q model.q

 

 

#####################

# Assembler modules

#

 

.asm.obj :

 

m166 @<<EOF

$<

$(separate "\n" $(MFLAGS) )

TO $*.src

;#### End of inline temporary file :

EOF

a166 $*.src $(AFLAGS) TO $*.obj

 

.s.obj :

 

m166 @<<EOF

$<

$(separate "\n" $(MFLAGS) )

TO $*.src

;#### End of inline temporary file :

EOF

a166 $*.src $(AFLAGS) TO $*.obj

 

.mac.obj :

 

m166 @<<EOF

$<

$(separate "\n" $(MFLAGS) )

TO $*.src

;#### End of inline temporary file :

EOF

a166 $*.src $(AFLAGS) TO $*.obj

 

#### This file contains the C-start function for BaseNode 167 .

bn167_cs.obj : $(BASENODE167_CSTART)\bn167_cs.s

 

#### This file is a part of the load program .

jmp.obj : $(MECEL_ROUTINES)\jmp.mac

 

#### Files with routines which is used for debugging :

trap.obj : $(FP_TRAP_ROUTINES)\trap.asm

 

#### This file is a part of O'Tool Executive .

ot_cnf.obj : $(OTOOL_ROUTINES)\ot_cnf.s macro.q model.q

 

 

#####################

# Local C-modules

#

 

.c.obj :

#### Feed inline temporary file to c166 :

c166 -f <<EOF

$<

$(separate "\n" $(CFLAGS) )

$(separate "\n" $(OTOOL_INC) $(OTOOL_IOS_INC) )

$(separate "\n" $(MECEL_INC) )

$(separate "\n" $(ASC_DRIVER_INC) )

$(separate "\n" $(CAN_INC) $(CAN_PROJECT_INC) )

$(separate "\n" $(CAN_IOC_INC) $(CAN_DEV_INC) )

$(separate "\n" $(AI_DRIVER_INC) $(AO_DRIVER_INC) )

$(separate "\n" $(CAP_DRIVER_INC) $(DIO_DRIVER_INC) )

EOF

 

a166 $*.src $(AFLAGS) TO $*.obj

#### The actual application .

aicc_exc.obj : aicc_exc.c

 

aicc_st.obj : aicc_st.c aicc_def.h

 

aicc_tsk.obj : aicc_tsk.c aicc_def.h

 

aicc_tck.obj : aicc_tck.c

aicc_ctl.obj : aicc_ctl.c

 

aicc_act.obj : aicc_act.c

 

aicc_pi.obj : aicc_pi.c

 

aicc_ini.obj : aicc_ini.c

 

aicc_io.obj : aicc_io.c

 

 

ai_ioc.obj : $(AI_DRIVER_ROUTINES)\ai_ioc.c \

$(AI_DRIVER_ROUTINES)\ai_ioc.h

 

ai_dev.obj : $(AI_DRIVER_ROUTINES)\ai_dev.c \

$(AI_DRIVER_ROUTINES)\ai_dev.h \

$(AI_DRIVER_ROUTINES)\ai_ioc.h

 

 

ao_ioc.obj : $(AO_DRIVER_ROUTINES)\ao_ioc.c \

$(AO_DRIVER_ROUTINES)\ao_ioc.h

 

ao_dev.obj : $(AO_DRIVER_ROUTINES)\ao_dev.c \

$(AO_DRIVER_ROUTINES)\ao_dev.h \

$(AO_DRIVER_ROUTINES)\ao_ioc.h

 

 

asc_ioc.obj : $(ASC_DRIVER_ROUTINES)\asc_ioc.c \

$(ASC_DRIVER_ROUTINES)\asc_ioc.h

 

asc_dev2.obj : $(ASC_DRIVER_ROUTINES)\asc_dev2.c \

$(ASC_DRIVER_ROUTINES)\asc_dev2.h

 

can_ioc2.obj : $(CAN_IOC_ROUTINES)\can_ioc2.c \

$(CAN_IOC_ROUTINES)\can_ioc2.h \

$(CAN_PROJECT_ROUTINES)\can_reg.h

 

can_dev4.obj : $(CAN_DEV_ROUTINES)\can_dev4.c \

$(CAN_DEV_ROUTINES)\can_dev4.h \

$(CAN_IOC_ROUTINES)\can_ioc2.h

 

s_can167.obj : $(CAN_ROUTINES)\s_can167.c

 

 

cap_ioc.obj : $(CAP_DRIVER_ROUTINES)\cap_ioc.c \

$(CAP_DRIVER_ROUTINES)\cap_ioc.h

 

cap_dev.obj : $(CAP_DRIVER_ROUTINES)\cap_dev.c \

$(CAP_DRIVER_ROUTINES)\cap_dev.h \

$(CAP_DRIVER_ROUTINES)\cap_ioc.h

 

dio_ioc.obj : $(DIO_DRIVER_ROUTINES)\dio_ioc.c \

$(DIO_DRIVER_ROUTINES)\dio_ioc.h

 

dio_dev.obj : $(DIO_DRIVER_ROUTINES)\dio_dev.c \

$(DIO_DRIVER_ROUTINES)\dio_dev.h \

$(DIO_DRIVER_ROUTINES)\dio_ioc.h

 

 

#### Application specific files needed for downloading a new application

# with the load program .

rs232int.obj : $(LOAD_INIT_ROUTINES)\rs232int.c

 

shutdown.obj : $(LOAD_INIT_ROUTINES)\shutdown.c

 

 

#### This files are parts of the load program .

initboot.obj : $(MECEL_ROUTINES)\initboot.c

 

command.obj : $(MECEL_ROUTINES)\command.c

 

vciprot.obj : $(MECEL_ROUTINES)\vciprot.c

 

flash.obj : $(MECEL_ROUTINES)\flash.c

 

#### Files with routines which is used for debugging :

fpbreak.obj : $(FP_TRAP_ROUTINES)\fpbreak.c

 

 

####################

# If you hide the target "cla", these files will be erased immediately.

#

 

cla :

-del aicc_exc.src

-del aicc_st.src

-del aicc_tsk.src

-del aicc_tck.src

 

-del t_tick.src

 

-del rs232int.src

-del shutdown.src

 

-del aicc_exc.obj

-del aicc_st.obj

-del aicc_tsk.obj

-del aicc_tck.obj

 

-del t_tick.obj

 

-del rs232int.obj

-del shutdown.obj

 

-del aicc_mk.lno

-del t_tick.lno

 

-del aicc_mk.out

 

####################

# If you hide the target "clab", these files will be erased immediately.

#

 

clab :

-del ot_cnf.src

-del bn167_cs.src

 

-del ai_ioc.src

-del ai_dev.src

-del ai_int.src

 

-del ao_ioc.src

-del ao_dev.src

-del ao_int.src

 

-del asc_ioc.src

-del asc_dev2.src

-del t_ascrx.src

-del t_asctx.src

 

-del can_ioc2.src

-del can_dev4.src

-del s_can167.src

-del can_int.src

 

-del cap_ioc.src

-del cap_dev.src

-del cap_ovfl.src

-del cap_p8_6.src

 

-del dio_ioc.src

-del dio_dev.src

 

-del fpbreak.src

-del trap.src

 

-del ot_cnf.obj

-del bn167_cs.obj

 

-del ai_ioc.src

-del ai_dev.src

-del ai_int.src

 

-del ao_ioc.obj

-del ao_dev.obj

-del ao_int.obj

 

-del asc_ioc.obj

-del asc_dev2.obj

-del t_ascrx.obj

-del t_asctx.obj

 

-del can_ioc2.obj

-del can_dev4.obj

-del s_can167.obj

-del can_int.obj

 

-del cap_ioc.obj

-del cap_dev.obj

-del cap_ovfl.obj

-del cap_p8_6.obj

 

-del dio_ioc.obj

-del dio_dev.obj

 

-del fpbreak.obj

-del trap.obj

 

-del ai_int.lno

-del ao_int.lno

-del t_ascrx.lno

-del t_asctx.lno

-del can_int.lno

-del cap_ovfl.lno

-del cap_p8_6.lno

 

 

####################

# If you hide the target "cll", these files will be erased immediately.

#

 

cll :

-del initboot.src

-del command.src

-del vciprot.src

-del flash.src

-del jmp.src

 

-del initboot.obj

-del command.obj

-del vciprot.obj

-del flash.obj

-del jmp.obj

 

#####################

# These files are deleted separately.

#

 

clh :

-del aicc_mk.hex

-del aicc_mk.map