Embedded Systems Programming Exam 20010-11 Answer all questions in Section A (60 marks) and 2 questions from Section B (40 marks) Section A answer all questions (60%) A1 Embedded Systems: ARM Appendix A is a brief data sheet from Intel for the StrongARM processor. Using that sheet as a reference point, outline the reasons that you might, or might not, select this processor for use in a hand-held or embedded system. (15 marks) A2 Embedded System: Operating Systems Recently there has been much discussion of platforms for mobile devices. Selection of an operating system or platform for an embedded system is an important task for a development team. Give a review of the pros and cons for selecting the Linux operating system for embedded system development. A3 Embedded System: Tools and Development Embedded systems developers have very specific requirements for their development tools and their methods. Outline the major issues and show some of the specific problems of development and debugging. Discuss in your answer the challenges of developing libraries and applications. (12 marks) A4 Embedded System: Device Drivers Developing and modifying device drivers for an embedded system is a common activity when producing embedded systems. Discuss how the UNIX/Linux interface allows access to device drivers, and show how this is used by developers. Comment in your answer on the new approaches of pseudo file systems for device driver interface and control. (13 marks) A5 Embedded Systems: Linux 2.6 kernel The Linux 2.6 series kernels offer a number of new features and facilities to developers. Outline these new features and show how they improve or otherwise on the 2.4 series kernels. 1
Section B answer 2 questions (40%) B1 Assembler and High Level Languages Developing code for a single board application requires the linking of high-level language programs with assembler level code. i) Discuss the circumstances under which a programmer would code in an assembler rather than a high level language. ii) Using code fragments and diagrams in your answer, show how the linkage of high-level language procedures and functions with assembler code is facilitated. Give particular emphasis to the role of local variable storage and the passing of parameters. B2 Libraries and applications i) Selecting a library, either in source code or binary form, for an embedded board is a common task. Outline the features and facilities that you would see as important in making such a selection. (8 marks) ii) Show how you would build and application like busybox for an embedded Linux platform. Go through the requirements and various stages of development and deployment. (12 marks) B3 Cross development tools Taking 5 tools from the list given below discuss how embedded systems developers might use these software development tools. B4 Memory arm-linux-gcc arm-linux-ld arm-linux-objdump arm-linux-nm arm-linux-as arm-linux-objcopy make gdb (20 marks) i) The embedded systems designer is confronted with a larger and larger array of memory device to choose from. Describe the range and types of devices available, outlining their strength and weaknesses. (12 marks) 2
ii) Describe in detail how flash memory devices work, highlighting the software drivers they require. (8 marks) B5 JTAG and Testing Developers of embedded systems will be frequently confronted with new pieces of hardware for which device drivers will have to be written or modified. i) Discuss the problems of testing modern embedded computer systems, and outline some of the approaches taken to address these problems. ii) Describe how JTAG IEEE 1149.1 works. Discuss its original design goals and how it has been developed and adapted. B6 Networking connectivity Embedded and mobile systems are commonly networked with other devices and servers. i) Discuss the features required at kernel, library and application level to support networked applications using TCP/IP. ii) Show the step you would go through to set up a networked embedded system with services such as ftp, telnet, and NFS. 3
Appendix A Selection from Intel s SA1110 brief datasheet 4
5
6
Points for credit A1 Talk through the design of SA1110 micro-controller system resources serial ports, usb, pcmcia, lcd etc. The ability to work with different memory devices. The support for OSes and HLL through the structure of the assembler and the use of the MMU. Use of GPIO lines for general purpose interfacing. Interrupt structure fast interrupts low number of vectors. Low power features unless features are initialised then then are turned off. Ability to slow the clock down, use of watchdogs etc. Slow clock speed made up for by the system design use of pipeline and caches. A2 - problems. Linux having copied Unix is not a real-time system, can't pre-empt processes. Was really developed for desktop PCs and main development is around the Pentium family. Over large kernel for very small boards (< 2MB). Requires file system. Has lots of kernel code that would be redundant on a SBC. Changes too rapidly? 2.4 problem pre-emption in 2.6. Pluses - open source - easy to change/customise. Good development community. large number of embedded and real-time extensions - RTAI, and so on. Later kernels allow pre-emption - but too early to say if other problems may make them less useful. UClinux allows MMUless CPU and smaller developments. Projects like uclibc, busybox and so on ar Linux based. Integrated with GNU. A3 a size versus functionality argument is required here. Very specialist systems dsp work etc will require thie own specili libraries ability to work with standard apps, OS and compilers is a major plus. Arguments around glibc, uclibc, slibc and newlib. Descriptive of the various steps paying attention to the use of libraries for host and target work. The decision whether to use static libraries or download dynamic ones. A4 The use of file operations on device driver through file nodes the use of mknod and major numbers, role of minor numbers. How file ops work types of driver character, block etc. Give example of reading and writing a parallel port show how the ioctl interface give extra functionality- the problem with that approach, very nonstandard, messy interfaces. The approach of /proc giving a run time display of drvier internals. Problems with proc over extended beyond original design goals. The approach of sysfs. A5 2.6 features. VM memory sub system. CPU scheduling new schedulers. IO scheduling features. Sysfs and udev sub systems, device handling. Response times and pre-emption. Threading model NTPL. ALSA. B1 i Use of HLL for portability, ease of maintenance, better for other colleagues. Can use more tools - IDE et al. LLL for speed, special instructions, size. Use of optimisation on system like ARM where good result can be achieved with HLL. ii Use of registers, parameter blocks, and stacks. Show how each work. The ARM strategy hybrid approach the ARM APCS and register usage 7
B2 Features required of libraries on embedded systems. Size is very important. Discuss glibc vs uclibc. Look at using libraries and scheduler newlibc as an example. Go through details of downloading and building a library. Building an application against a library for example mplayer. ii Describe busybox features and implementation. Limitations for example for setting up networks and devices. Show how to build busybox against uclibc. B3. Compiler, assembler output, cross assembler. Ability to turn off optimisation. Relocatable code. Linker ability to place segments in specified locations, creation of map file, linker control languages. Easy of loading different libraries esp. startup libs.static and dynamic linking. Gas ability to inline assemble, standard assembler, easy of linking alp & hll. Variety of processor families. Objcopy to produce various output format ie srecord intel hex, as well as coff elf et al. Production of libraries ability to easily maintain libs, extraction. Make ability to control complex builds, use of compiler flags, difficult command lines, ability to create various version ie production and debug. Gdb standard features single step, break points, trace, register/memory dumping, disassembly, remote debugging a la gbd. Elf2bin/eloadsvr convert from elf format (gcc output) to MSBin format for downloader, ability to download/upload binaries. B4 i Different memory chips: ROM, SRAM, DRAM, EPROM, EEPROM and flash. Give brief details of the use of each. ii Explain flash in general then NOR and NAND. Details on reading and writing, showing erase problems. Drivers have to take into account the write problems. Use of wear levelling and journalled file systems. Use on XIP and locking of boot sectors. B5 The 'bed of nails' problem. Early approaches of ICE, emulators and romulators. Difficulty of access pins on modern devices to many, too small, can be hidden. The early use of JTAG. Motorola BDM. JTAG Boundary scan register how device chains work, the TAP and state machine, simple command sets, EXTEST, BYPASS, etc. Run code through JTAG example of 'bricked' machine and reflashing over JTAG. EJTAG and JTAG extensions debugging systems, use of memory maps etc. B6 Networking: The provision of TCP/IP services in the kernel, a device driver to do the transport layer (or a protocol like PPP or slip to pass it through another device). TCP and even RPC services turned on in the library, applications such as ftp, ftpd etc built against the library. Assuming all of the above. The device would need initialising/loading. An ip address would have to be given or dhcp used. The route table would have to be set up and a default route to the device given. A server or gateway would have to be contacted. Various services would have to be started probably in /etc/rc.n/. For NFS there are a number of options. Loading an exported file system could be attempted assuming permissions on the server were granted. To setup a nfs mounted root requires more changes to the kernel build and a machine that will export the correct root file system. 8