EMBEDDED SYSTEMS EMBEDDED SYSTEMS (SECOND EDITION) D P KOTHARI Ex-Visiting Professor Royal Melbourne Institute of Technology Melbourne, AUSTRALIA SHRIRAM K VASUDEVAN Technical Manager - Learning and Development Amrita University, Coimbatore, INDIA SUNDARAM R M D Technical Leader, Wipro Technologies, INDIA MURALI N Lecturer, Nizwa College of Technology, OMAN New Academic Science Limited 27 Old Gloucester Street, London, WC1N 3AX, UK www.newacademicscience.co.uk ACANDEEWMIC e-mail: [email protected] SCIENCE Copyright © 2015 by New Academic Science Limited 27 Old Gloucester Street, London, WC1N 3AX, UK www.newacademicscience.co.uk • e-mail: [email protected] ISBN : 978 1 781830 83 3 All rights reserved. No part of this book may be reproduced in any form, by photostat, microfilm, xerography, or any other means, or incorporated into any information retrieval system, electronic or mechanical, without the written permission of the copyright owner. British Library Cataloguing in Publication Data A Catalogue record for this book is available from the British Library Every effort has been made to make the book error free. However, the author and publisher have no warranty of any kind, expressed or implied, with regard to the documentation contained in this book. Dedications Kothari, D.P.—To son-in-laws Pankaj and Rahul Shriram K Vasudevan—To Parents and Sister Sundaram R M D—To Mom and Dad Murali N.—To Friends and Parents Preface Embedded Systems, present almost everywhere, have occupied an inevitable place in the market. We, the consumers, live with Embedded Systems all the way, be watches, mobile phones, refrigerators, cars, music systems and what not… Even the medical field is fully supported with the modern equipments which, too, are embedded systems. Embedded Systems occupy a vital place in military as well, where weapons mostly come under this category. Automobile industry will become handicapped without Embedded Systems. In this book, every topic has been supported with practical examples. In addition, the programming concepts have been fully supported with simple and elegant C codes which have been executed in Linux OS as well. After every chapter, the reader is presented with a set of interesting quiz questions, which will make the reader think for sure. In short, it will be good and friendly learning experience for the reader. We have covered the basics of Embedded Systems in Chapter-1 followed by building blocks (components) of the system. Then the book moves towards the design methodologies and modeling of Embedded Systems in Chapter-3. Layered approach is being followed in building an Embedded System. This approach has been discussed in Chapter-4. Chapters-5 and 6 cover the basics of operating system and programming with C in Linux. Chapter-7 is on networks for Embedded Systems. Then microcontrollers are discussed in the next two chapters which include 8051 to latest ARM controllers. A practical example is also indepth discussed in Chapter-11 after discussing the coding guidelines in Chapter-10. viii Preface We wish to thank all the good hearts who have helped us in this project. In particular, we wish to thank Subashri V, Sriram Karthik, Sivaraman R, and Sunandhini M for their immense help and support in bringing the book to a good shape. D.P. Kothari Shriram K Vasudevan Sundaram R M D Murali N. Contents Preface vii 1. Embedded Systems—An Introduction 1—10 1.1 Basic Idea on System 1 1.2 Embedded Systems—Definitions 1 1.3 Characteristics of Embedded Systems—An Overview with Examples 2 1.4 Challenges in Designing an Embedded System 6 1.5 Categorization of Embedded Systems 7 1.6 Examples of Embedded Systems 8 1.7 Quiz 9 2. Components of Embedded Systems 10—30 2.1 Understanding of Microprocessor and Microcontroller 11 2.2 Functional Building Blocks of Embedded Systems 12 2.3 Processor and Controller 13 2.4 Memory, Ports and Communication Devices 14 2.4.1 Memory 15 2.4.2 Ports 16 2.4.3 Communication Devices 16 2.5 CISC vs. RISC Processors 17 2.6 General Purpose Processor and DSP Processor 18 2.7 Direct Memory Access 19 2.8 Cache memory and its types 22 2.9 Co-design of Hardware and Software 23