111111 White Paper Bluetooth Protocol Stack technology from IAR Systems Issue 1.0 2001-05-22
CONTENT INTRODUCTION 3 WHAT IS A BLUETOOTH PROTOCOL STACK? 3 HOW TO SELECT A BLUETOOTH PROTOCOL STACK? 5 Tool vendor 5 Stack size 5 Stack portability 6 Stack configurability 7 Stack reliability 9 Stack documentation 9 PROFESSIONAL TOOLS OR IN-HOUSE DEVELOPMENT? 9 ONE-STOP-SHOPPING 11 SUMMARY 11 LITERATURE 11 Introductory 11 Technical 11 The BLUETOOTH trademarks are owned by their proprietor and licensed to IAR Systems AB Page 2
Introduction Bluetooth wireless technology is one of the most important new technologies for embedded systems development. Thousands of products are likely to incorporate Bluetooth wireless technology for short-range voice and data communications. All products that incorporate Bluetooth wireless technology must follow the communications guidelines that are documented in the Bluetooth specification. The Bluetooth specification is a highly technical document (well over 1500 pages) that describes all the functionalities that must be implemented in order to build a product that complies with the Bluetooth specification. Product A Product B Software Software Application Application Bluetooth Protocol Stack Radio link Bluetooth Protocol Stack Bluetooth Module Antenna Antenna Bluetooth Module Two products communicating over a wireless Bluetooth radio link A Bluetooth Protocol Stack is a software library that implements the communication protocols defined in the Bluetooth specification. The deep technical expertise and huge development resources needed to implement a Bluetooth protocol stack makes it impossible for most companies to develop their own stack. The stack must also be verified to pass the official Bluetooth test suites, as defined by the Bluetooth SIG (Special Interest Group). The vast majority of product developers will incorporate Bluetooth capabilities by purchasing a Bluetooth Protocol Stack from a 3 rd party tools vendor, as the resources needed to implement a stack in-house cannot be justified. What is a Bluetooth Protocol Stack? A Bluetooth Protocol Stack is a software library that implements the communication protocol as defined in the Bluetooth specification. The stack communicates with the Bluetooth hardware and the remote Bluetooth device, and presents an easy-to-use API (Application Programming Interface) to the application program. Page 3
Software Application Hardware Antenna RTOS API Profile implementation RFCOMM TCS BIN SDP L2CAP HCI Transport layer UART or USB drivers Bluetooth Protocol Stack from IAR Sys tems UART or US B Bluetooth Module Microcontroller A Bluetooth Protocol Stack in an embedded system A Bluetooth Protocol Stack can be divided into two parts; the core and profiles. The stack core consist of the following layers: HCI The Host Controller Interface layer provides a standard communications protocol between the stack and the Bluetooth module. HCI communication packets can be transmitted using UART, RS232 or USB interface. L2CAP The Logical Link Control and Adaptation Protocol layer allows multiple channels to share a single Bluetooth link. It also handles segmentation and assembly of long messages, group management and quality of service functionalities. RFCOMM The RFCOMM layer implements the functionalities of a virtual RS232 link. Most of the application Profiles uses RFCOMM as a means of transmitting and receiving data. SDP The Service Discovery Protocol layer provides functionalities to publish supported Bluetooth functionalities (SDP server), as well as for querying remote Bluetooth devices for supported functionalities (SDP client). The Bluetooth specification also defines how Bluetooth should be used within specific application fields (each application usage is described in a Profile). Several profiles are defined already; and more are expected to be developed over time. Some of the most important Bluetooth profiles are: GAP The Generic Access Profile is mandatory and is used to manage connections between Bluetooth devices. GAP exposes a high-level API that the application program can use to configure the stack and manage connections to remote devices. SDAP The Service Discovery Application Profile is mandatory and is used to query remote Page 4
Bluetooth devices for supported services. SDAP exposes a high-level API that the application program can use to find out the services available in remote devices. SPP The Serial Port Profile provides emulated virtual serial ports over the Bluetooth interface. SPP exposes a high-level API that the application program can use to transmit and receive data in a way that is very similar to a standard serial port. Once you have a Bluetooth protocol stack, you only need to write an application program that uses the desired stack functionalities by calling the exposed API. The stack takes care of all the complex rules for communications that are defined in the specification. How to select a Bluetooth protocol stack? You will find many Bluetooth protocol stacks on the market; very few of them are however optimized for real embedded systems. Many stacks are initially developed for large host systems, and require huge resources from the system. It is not uncommon with stacks that require 50KB ROM or more! Some items to consider when choosing a Bluetooth Protocol Stack: Tool vendor Stack size Stack portability Stack configurability Stack reliability Stack documentation Tool vendor Select a vendor with a quality reputation and a proven track record. You should also look for a supplier with local presence, a professional support organization and certified Bluetooth competence. IAR Systems was established in 1983 and is a public company listed on the Stockholm stock exchange. In 1986, we introduced the first embedded C compiler in the world, and we now have a complete range of development tools for embedded systems programming. We currently have 10 offices in the USA, Canada, England, Germany, Sweden, Denmark and Japan. We also have some 40 distributors worldwide that provide sales and support for local markets. Our development team is highly skilled, which is proven by the fact that IAR Systems is a Certified Bluetooth Solutions Provider, appointed by Ericsson Microelectronics AB. Stack size The size of the Bluetooth protocol stack is not vital for personal computers. But for most embedded systems, a compact stack with a minimal memory footprint is very important, as it can reduce the production cost by large numbers. Page 5
The Bluetooth protocol stack from IAR Systems is one of the most compact stack solutions in the world, and even works in most 8-bit microcontrollers! IAR Systems is one of the most well known developers of optimizing C/EC++ compilers, and our expertise in compiler technology research have been fully utilized, as the stack source code is written using C language constructs that compiles to very compact machine code. Stack portability A stack intended for use in embedded systems must be designed from the ground up with portability in mind. The most obvious issues then it comes to portability is adaptations for different platform environments, such as real-time operating systems, UARTs and Bluetooth modules. Our Bluetooth protocol stack isolates all the platform dependent functionalities in abstraction layer files. Adaptations for different real-time operating systems, UART drivers or Bluetooth modules can be made quite easily by the developer himself, or completely automatically for the supported platforms in IAR MakeApp, our stack configuration tool. Less obvious portability issues of far greater importance are architectural dependencies. These are less well known but might make a stack completely useless on certain CPU architectures. It does not help that the stack is written in ANSI-C, as the data representation can get a different meaning then the stack is compiled on a new CPU architecture. If a stack is implemented with architectural dependencies, then portability can become a nightmare. Common issues that may cause severe portability problems for embedded microcontroller software are: CPU architectures with big- or little-endian byte order CPU architectures with 16- or 32-bit aligned address accesses only Compilers with no structure packing (16- or 32-bit alignment of struct members) The Bluetooth Protocol Stack from IAR Systems is designed from the ground up for professional embedded use, and of course handles all the issues above. As the stack is implemented in ANSI-C, it works with different types of C compilers too. Furthermore, when you invest in a Bluetooth protocol stack, you would like to be compatible with future projects you might start. It becomes important that the stack can be used in different types of use-cases. The Bluetooth protocol stack from IAR Systems works equally well for the following system architectures: Page 6
Stack configurability It is very important that the stack can be configured in a way that suits your application. The stack should be adapted and optimized for use in your project, otherwise you will get a stack that waste memory and becomes slower, as redundant code sections might have to be executed. A stack that is adapted and optimized for your application only implements the functionalities needed in your product. A stack that is not adapted and optimized for your application will have to implement all functionalities that any application might need, thus resulting in both code size and execution time overhead in your application. It thus becomes essential that the stack can be configured and optimized for your product very quickly and easily, at low cost without need for spending time and money on training courses or hiring expensive consultants that adapt and optimize the stack for your product. IAR Systems is proud to offer the first configuration and code generation tool in the world for Bluetooth protocol stacks! IAR MakeApp for the Bluetooth Protocol Stack is a state-of-the-art development tool that takes Bluetooth development to a new level! Page 7
IAR MakeApp the world s first Bluetooth protocol stack generator tool! By using IAR MakeApp for the Bluetooth Protocol Stack, you get a graphical development tool that provides an intuitive user interface for configuration of the stack, and a code generator that creates optimized stack source code in ANSI-C automatically! The main benefits of this tool are: The stack core and profiles can be configured on a high abstraction level in minutes without any knowledge of the stack internals or its internal implementation. Stack features (such as client/server mode, message size, profile capabilities and so on) can be configured using a very simple point-and-click mechanism in the user interface. An optimized stack implementation is generated automatically as ANSI-C source code! The stack becomes highly adapted and optimized for your project, as all unused features and profiles are removed automatically during code generation. The tool can generate platform adaptations (real-time operating system adaptation files, UART drivers and support for various Bluetooth modules) automatically. The tool can even generate complete device driver libraries (Bus and Interrupt controller, DMA, UART, Timers etc) for many microcontroller families! Without a professional configuration and optimization tool like IAR MakeApp, you will have to spend many engineering hours trying to make the stack adapted and optimized for your application. IAR MakeApp saves you considerable development time during the adaptation stage, while at the same time optimizing the stack for minimum code size! IAR MakeApp for the Bluetooth Protocol Stack provides property lists for configuration of the stack, as well as an API selection functionality, there you can chose to delete API functions you do not intend to use for even more compact stack size. Page 8
Configuration property lists Select API s to use Stack reliability The Bluetooth protocol stack from IAR Systems is carefully designed and well tested. The stack passes the official Bluetooth SIG test suites. The stack has also been tested on various compilers and hardware platforms, both on PCs and embedded microcontrollers. Stack documentation The implementation of the stack source code (ANSI-C) is well documented and follows strict coding guidelines and the API is well defined too. The product is shipped with the following documentation: IAR MakeApp development tool users guide Bluetooth Protocol Stack programmer s guide The development tool even includes a project report generator that generates project reports in HTML format. A built-in report viewer can be used to view the project reports from within the IAR MakeApp development tool environment! The built-in HTML viewer Professional tools or in-house development? It is a well-known fact that many engineers convince their managers to develop or adapt software functionalities manually in-house, due to a reluctance to rely on external tools (the infamous not invented here syndrome), or because it is a technical challenge to do it internally. Page 9
However, this attitude can be very costly indeed. Time to market is vital to maximize product profitability over the product lifetime, and a delay in product launch can have severe impact on the revenue generated. Product Life Cycle S A L E S Planned intro Lost sales Maturity Fixed in time Slip Time Even if you are developing the right product, the time to market is critical Source: McKinsey & Co. As the illustration above indicates, a slip in product launch results in lost sales that may reduce your profits significantly. By purchasing professional tools, you can by far increase the likelihood of a timely project schedule and successful product launch at an early stage of the market window. The cost of professional tools might seem high at first, but research indicates the opposite if profitability over the product lifetime is considered. Sensitivity of Profits Over Product Life Cycle % diff. profit ship 6 mths late prod. cost 9% high 50% dev. cost overrun 0-5 -3.5 % -10-15 -20-25 -22 % -30-35 -33 % -40-45 Source: McKinsey & Co. As the graph above indicates, a 6 month delay in product launch might result in a 33% loss of profit over the product lifetime, while a 50% overrun on development costs only affect the profitability with a 3.5% loss over the product lifetime! It is clear that purchasing professional tools that reduce development time increases the total product profitability, even if the cost of the tools might seem high at first. Translated into the world of Bluetooth Protocol Stacks, this means that you should select a Bluetooth Protocol Stack with good tool support that requires no or very little manual adaptations of the stack. Page 10
By using a configuration and code generation tool like IAR MakeApp, you will be able to get a tailor made and optimized stack solution for your development project, with minimum development efforts on your part! One-stop-shopping IAR Systems is the only tool vendor that can offer a complete set of development tools for Bluetooth software development: Bluetooth Protocol Stacks Bluetooth Starter Kits USB drivers for Bluetooth modules C/EC++ compilers Assemblers Debuggers UML state/event development tools Device driver generation tools SUMMARY IAR MakeApp is the world s first configuration and code generation tool for Bluetooth Protocol Stacks. By using this tool it becomes far easier to configure and adapt a Bluetooth protocol stack for your project. This reduces your costs for manual adaptations and optimizations, and increases the likelihood of a timely product launch. Furthermore, an optimized stack implementation is generated automatically as ANSI-C source code, resulting in a stack with a minimum memory footprint! Our stack is highly compact, and is designed to work equally well on 8-, 16- or 32-bit microcontrollers. The stack is designed from the ground up for embedded systems, and is portable to almost any CPU architecture. LITERATURE If you are interested in learning more on the Bluetooth wireless technology, we can recommend the following books: Introductory BLUETOOTH REVEALED Prentice Hall ISBN 0-13-090294-2 Technical BLUETOOTH, CONNECT WITHOUT CABLES Prentice Hall ISBN 0-13-089840-6 Page 11