ISSN ONLINE(2278-8875) PRINT (2320-3765)

All submissions of the EM system will be redirected to Online Manuscript Submission System. Authors are requested to submit articles directly to Online Manuscript Submission System of respective journal.

Development and analysis of Keil compiler constructs for an Embedded application for ARM Architecture

Mr Santhosh T.P1, Prof T.S. Bharath Kumar2 and Dr M.Z.Kurian3
  1. PG Student (VLSI and Embedded systems), Sri Siddhartha Institute of Technology, Tumkur, Karnataka,India
  2. Professor, Dept of ECE, Sri Siddhartha Institute of Technology Tumkur,Karnataka,India
  3. Dean & HOD, Dept of ECE, Sri Siddhartha Institute of Technology, Tumkur, Karnataka,India
Related article at Pubmed, Scholar Google

Visit for more related articles at International Journal of Advanced Research in Electrical, Electronics and Instrumentation Engineering

Abstract

In recent years the supremacy of embedded system has increased tremendously in such a way that it has impinged into all the mobile and multimedia applications. While designing an embedded system application, apart from execution speed, the most important factor that has to be considered is the total cost of the system. Most of the application that run on embedded platform faces a common problem with the availability of restricted or very small memory area available for storing the application program. The cost of the embedded system mostly depends on the amount of memory used. Reducing the code size is a straight forward solution to minimize the memory used by the application program. This paper is an implementation of a compiler using Keil tool for an ARM7TDMI-S microprocessor for an embedded application which will reduce the code size to approximately 5% of a code which has already passed through all the levels of optimization embedded in the Keil compiler. A compiler is said to be retargetable, if it can be applied to a range of different target processors, by re-using most of the code. This means that target model cannot be an implicit part, but must be specified explicitly.

Keywords

ARM7TDMI-S, Keil compiler, LPC 2148, Beverage vending machine (BVM)

I. INTRODUCTION

Embedded systems are revolving around us into various products. Every 18 months the transistor density increases as per Moore’s law and we able to have better features of the peripherals within the microcontroller. When computer architecture had been built it needs to support the compiler constructs to support the higher language constructs. Compiler developers are team of people who understands the architecture to build the efficient compilers. But it is too hard to have compilers to meet all the features of the architecture. The market of embedded systems is spreading faster than that of information technology. Mostly, the segments of embedded systems are consumer markets, with very short product lifetimes and short market windows. Hence, time-to-market is an important factor. Cutting down the time to market for products that became more and more complex is possible through “re-use”. Another important characteristics of the embedded system market is the ease of incorporating late design changes, i.e. flexibility of the target technology, this led to the use of processors in embedded systems. This in turn led to the use of embedded software. Over the past 15 years, the ARM reduced instruction set computing (RISC) processor has evolved to offer a family of chips that range up to a full-blown multiprocessor. Embedded applications demand for increasing levels of performance and the added efficiency of key new technologies have driven the ARM architecture’s evolution.
Keil compiler is an 8051 and ARM compiler which support the various applications. A programmer when programming always try to follow the conventional constructs of the higher level language which certain cases doesn’t digested by the compiler due its own methods of syntax and constructs. If the embedded programmer uses the extensive syntax and constructs of the compiler then the application code can perform better and add code optimality.

II.RELATED WORK

The ARM7TDMI-S processor uses a pipeline to increase the speed of the flow of instructions to the processor. This enables several instructions to run continuously, and the processing, and memory systems to operate continuously. [1]
The Systems Architecture Laboratory designed and implemented the first phase C programming language compiler for the ARM7TDMI architecture. It consists of two parts viz analysis and synthesis [2]
The optimized code produced by the compiler after passing through nine levels of optimization could be reduced further. Simulation has shown that a further reduction of approximately 5% could be achieved by using this algorithm. The proposed algorithm will be tested for Thumb instructions also which already reduces 30% of the code when compared to ARM.[3]
A retargetable compiler in Visual Basic is capable of generating MIPS and ARM code. This compiler is a user retargetable compiler. The retargetable efforts are intermediate. Some of the information is entered as parameters through the graphical user interface and rest is used at the time of coding. The following can be provided to the CPU: size of the register file, name of registers and details of functional units. It is observed that the code is good in terms of code size, cycle count and compilation times. [4]

II. SYSTEM DESIGN

The system block diagram is shown in fig 1.This block diagram shows the proposed implementation of keil compiler constructs for an embedded application. In this paper an example of Beverage vending machine (BVM) is considered. The main function of Beverage vending machine (BVM) is to deliver beverage products like coffee, tea etc after undergoing different processes likes accepting the cash, selecting the beverage, dispensing the change and several other optimizations. For this vending machine several code optimizations required. Here an attempt is made to develop embedded c code using keil compiler constructs.
image
Processor is the main part of any embedded system, here in BVM it uses LPC 2148 (ARM7TDMI), the ARM7TDMI core is a member of the ARM family of 32 bit Microprocessor. It is widely used across a range of applications. The ARM7 family is a range of low-power 32-bit RISC microprocessor cores optimized for cost and power-sensitive consumer applications. The ARM7 incorporates the Thumb 16-bit instruction set - enabling 32-bit performance at 8/16-bit system cost. The ARM architecture is based on Reduced Instruction Set Computer (RISC) architecture. The RISC instruction set and related decode mechanism are much simpler than those of Complex instruction set computer (CISC) designs.
Stepper Motor: A stepper motor is a brushless electric motor that can divide a full rotation into a large number of steps. The motor's position can be controlled precisely without any feedback mechanism, as long as the motor is carefully sized to the application. Stepper motor consists of a permanent magnet rotating shaft called the rotor and the electromagnets which are surrounded to the shaft is called the stator. The electromagnets are energized by an external control circuit, such as a ARM controller. To make the motor shaft turn, first, one electromagnet is given power.
Solenoid valve: In BVM Solenoid Valve is used to control the flow of hot water for the preparation of coffee, tea and black tea. A solenoid valve is an electromechanical valve for use with liquid. The valve is controlled by an electric current through a solenoid in the case of a two-port valve the flow is switched on or off; in the case of a three-port valve, the outflow is switched between the two outlet ports.
LCD screen: In BVM we use All-Weather weatherproof LCD screen that is installed at the front face of the machine as a user interface. The screen provides an interactive user interface for user to select a desired product. The LCD screen alternately will display preloaded advertisement videos one at a time when there is no interface with the user. The video will be cleared when a user want to buy something from the machine by simply pressing the right switch.
Money box: A vending machine consists of a money box comprising of currency detector and currency dispenser. It accepts payment and dispenses the change to the customer. The process involves examining the currency that has been inserted, and by using various tests, determine if the currency is counterfeit. In operation, if the item is accepted it is retained by the machine and placed in a storage device. If the item is rejected, the machine returns the item. Later based on customer’s selection of beverage the operation is preceded.
Sequence of operations carried out to make beverages:
Initially the LCD display will be displaying some advertisements like” WELCOME TO BEVERAGE VENDING MACHINE”. It gets cleared when the user press the switch to get the beverage. Below the LCD display there will be switches for tea, Black tea, coffee,.
After pressing the right key it will display the cost for respective beverages. It is shown below
TEA10/- BLACK TEA10/- COFFEE10/-
And it asks to enter the amount. Then the amount is inserted into the coin acceptor/detector.
Then it detects the amount entered is valid or not. Also it scans Paper Money by automated denomination recognition. If it’s not a valid amount then it is returned back.
Once it detects the valid amount, corresponding motor will run and does appropriate mixing to get the required beverages.

III. SYSTEM IMPLEMENTATION

Flow chart which shows the stepwise implementation of proposed system is given in fig 2.First the machine will display welcome message. Then it will ask to enter the amount .if the detected cash is valid it dispense the change and asks to select beverages. If it’s not valid the program terminates and goes back from first step. After user selects the beverage the specific motors will run and mix it with hot water with proper temperature which is as programmed. After delivering the beverage it will terminates and again goes back to the first step
image
Implementation of the vending machine using ARM based processor along with its peripherals is done by developing the embedded C code. Most of the operational models are dynamic, discrete-change and stochastic, which invariably need a computing facility to see the result within a given time. The software is programmed through Keil compiler. The extensive utilization of the embedded Kiel compiler for the embedded application using the microcontroller will be made to meet the performance and optimality using Keil compiler and analyse the performance of the developed application code. Figure 3 is an example of Simulation of Keil compiler. In this figure after entering into particular amount and after validation it gives the remaining amount and then it asks for the beverage which is to be selected. In this example the user selected Tea
image
Then Stepper motor, milk powder motor and tea powder will run and mix these in appropriate ratio as programmed. Then it shows the temperature and final message after delivering the tea through proper channels. Then it displays the message as Tea is ready to slip and after this step the loop goes back to initial stage and it displays the message “Welcome to Beverage Vending machine”. This is as shown in figure 4.
image
Analysis: Development of code is a continuous process. The main aim of this paper is to reduce the code size, time consumption and to increase the performance of an embedded application. In this work an embedded code has been developed using keil compiler constructs and using ARM7 microprocessor. This code is developed for a Beverage Vending machine .After developing the code it will be compared with other constructs with respect to code size, time consumption and performance. This can be analysed and suitable modification can be further possible in order for better performance and optimality, since these codes are re-usable one cannot predict this code is for this particular applications only. An analysis of consumption of time and performance analysis is schematically shown in figure 5.In this figure the time consumption of different modules has been shown. This result has been achieved after reducing and modifying the code size by removing unnecessary consumption of different modules. If any changes have been made, through this channel it can be compared with previous results which gives a brief idea about any further improvements can be made. These can be made to check the working of different peripherals associated with ARM7 processor. The extensive utilization of the embedded Keil compiler for the embedded application using the microcontroller will be made to meet the performance and optimality using Keil compiler and analyse the performance of the developed application code.
image

IV. CONCLUSION

The optimized code produced by the compiler after passing through nine levels of optimization could be reduced further of approximately 5% could be achieved by using Keil compiler algorithm. This provides a backbone for the implementation of this paper. The compiler if provided additional optimizations improves the performance of embedded system. Thumb instructions are useful in embedded systems and one of the goals is to be able to support these. This compiler is able to produce thumb instructions for single core and dual core processor by adding a new code generator. These thumb instructions also benefit from the additional optimizations implemented. This paper enhances the extreme usage of ARM7 and Keil compiler constructs .An embedded software has been developed to run a Beverage vending machine taking tea, coffee, black tea as example.

References

  1. Sherry Joy Alvionne V. Sebastian, Implementation of the Phase II Compiler for the ARM7TDMI-S Dual-Core Microprocessor on 2011 Second International Conference on Intelligent Systems, Modelling and Simulation © 2011 IEEE DOI 10.1109/ISMS.2011.46
  2. Sendhilraj Thangaraj, Sudhakar Gummadi, Shanmugasundaram Radhakrishnan, Enhancement in ARM Code Optimization for Memory Constrained Embedded Systems 1-4244-0716-8/06/$20.00 ©2006 IEEE.
  3. Dr. Manoj Kumar Jain, Veena Ramnani, Developing a Retargetable Compiler For Mips32k and ARM7TDMI-S ,ISSN-2229-371X, Volume 3, No. 2, February 2012 Journal of Global Research in Computer Science
  4. Dimanarig, Mendoza, Moscoso, Recla, Power Optimization of the ARM7TDMI-S Microprocessor in 90nm CMOS Process. Undergraduate Student Project, Electrical and Electronics Engineering Institute, University of the Philippines, Diliman, October 2009
  5. Delas Alas, Santos, Torralba, Umbal, Compiler Implementation for the Dual-Core ARM7 Microprocessors.Undergraduate Student Project, Electrical and Electronics Engineering Institute, University of the Philippines, Diliman
  6. Rainer Leupers and Peter Marwedel, “Function inlining under code size constraints for embedded processors”, in Proceedings of the 1999 IEEE/ACM International Conference on Computer-Aided Design, pp. 253-256.