
Embedded Systems RTOS, Libraries and Drivers Peter Thorwartl 08_so_emb_rtos_libraries_drivers.odp Date Oct 31, 2009 Page SO-LOGIC electronic consulting Lustkandlg 52, Vienna, Austria, Europe, World www.so-logic.net +43-1-315 77 77 The Designer’s Challenge • What do I need to program? • What libraries are available? Does the design need an operating system? 08_so_emb_rtos_libraries_drivers.odp Date Oct 31, 2009 Page SO-LOGIC electronic consulting Lustkandlg 52, Vienna, Austria, Europe, World www.so-logic.net +43-1-315 77 77 Objectives Examine the Xilinx libraries for required services and features Examine a processor’s services for required functions and features Evaluate an IP device driver for appropriate functionality and design Use the Board Support Package (BSP) to access system services from the software application Determine whether your embedded system application requires a standalone system or an operating system Describe how a Real-Time Operating System (RTOS) differs from a conventional OS 08_so_emb_rtos_libraries_drivers.odp Date Oct 31, 2009 Page SO-LOGIC electronic consulting Lustkandlg 52, Vienna, Austria, Europe, World www.so-logic.net +43-1-315 77 77 Re-Inventing the Wheel Custom hardware typically requires custom software Standard hardware often has existing software support Uart General-purpose I/O Ethernet Certain processor functions can be complex and software support may already exist Setting up the interrupt structure Cache enabling Exception processing Memory Management Unit (MMU) 08_so_emb_rtos_libraries_drivers.odp Date Oct 31, 2009 Page SO-LOGIC electronic consulting Lustkandlg 52, Vienna, Austria, Europe, World www.so-logic.net +43-1-315 77 77 Minimal Required Services C language standard services: C language construct services stdin and stdout Math library malloc Processor support requires these services: Interrupt Cache Language environment support 08_so_emb_rtos_libraries_drivers.odp Date Oct 31, 2009 Page SO-LOGIC electronic consulting Lustkandlg 52, Vienna, Austria, Europe, World www.so-logic.net +43-1-315 77 77 Language services are necessary when running a software application written in C. Operating Systems Operating systems are a collection of software routines that comprise a unified and standard set of system services The Standalone option is used when no operating system is desired Provides a minimal amount of processor and library services as previously illustrated Can be considered a minimal, non-standard operating system Variety of third-party operating systems are available Linux – many flavors RTOS – real-time operating system; also has many flavors XilKernel – provided by Xilinx; small and simple Operating systems are installed and become part of the Board Support Package (BSP) 08_so_emb_rtos_libraries_drivers.odp Date Oct 31, 2009 Page SO-LOGIC electronic consulting Lustkandlg 52, Vienna, Austria, Europe, World www.so-logic.net +43-1-315 77 77 What an Operating System Provides Operating system services GUI support TCP/IP services** Task management Resource management** Familiar programming services and tasks Easy connection to already written applications Ability to reload and change applications Full file system services** ** Also available as additions to the Standalone BSP 08_so_emb_rtos_libraries_drivers.odp Date Oct 31, 2009 Page SO-LOGIC electronic consulting Lustkandlg 52, Vienna, Austria, Europe, World www.so-logic.net +43-1-315 77 77 Do I Need an Operating System? The Standalone BSP includes the previously discussed items Standalone system design considerations All services needed are included in the BSP The application is static—it never changes Application fits in block RAM Application is single-task based Interrupts may or may not be used 08_so_emb_rtos_libraries_drivers.odp Date Oct 31, 2009 Page SO-LOGIC electronic consulting Lustkandlg 52, Vienna, Austria, Europe, World www.so-logic.net +43-1-315 77 77 OS vs Standalone for Embedded Applications Operating System Standalone System Requires off-FPGA memory Application can fit into FPGA block OS cost and license RAM More complex project No license costs More programming flexibility Simple software model Some OS services available – TCP/IP stack – File system 08_so_emb_rtos_libraries_drivers.odp Date Oct 31, 2009 Page SO-LOGIC electronic consulting Lustkandlg 52, Vienna, Austria, Europe, World www.so-logic.net +43-1-315 77 77 Real-Time Operating System Many applications require peripheral servicing on a regular basis or with very low latency The abstraction level of many traditional OS services can have a latency that is too great to service needed tasks Communications Hardware control An RTOS is an operating system that specifically addresses these items Heartbeat timer via an interrupt Low instruction latency for device driver services Functionality of RTOS system services fall between those of a Standalone BSP and an OS 08_so_emb_rtos_libraries_drivers.odp Date Oct 31, 2009 Page SO-LOGIC electronic consulting Lustkandlg 52, Vienna, Austria, Europe, World www.so-logic.net +43-1-315 77 77 Board Support Package (BSP) All libraries, processor services, device drivers, and the operating system are compiled into a library The set of software modules are combined into the libxil.a library The software modules, routines, processes, and services can be directly called from your application Allows you to use low-level processor core functions Enable, disable, and flush caches Read/write time-base registers Allows you to use IP peripheral device drivers GPIO, IIC controller, PCI controller, UART Offers glue functionality to link code against standard libraries Time, sleep Files Memory 08_so_emb_rtos_libraries_drivers.odp Date Oct 31, 2009 Page SO-LOGIC electronic consulting Lustkandlg 52, Vienna, Austria, Europe, World www.so-logic.net +43-1-315 77 77 Board Support Package Arbiter Primary Bus Bridge Secondary Bus Arbiter libxil.a XEmac_mWriteReg ( … ); DDR 10/100 SPI UART Timer Intc XEmac_SendFrame ( … ); SDRAM Ethernet EEPROM ... XSpi_mSendByte ( … ); XSpi_GetStatusReg ( … ); ... xtmrctr.h XUartLite_SendByte ( … ); xemac.h XUartLite_GetStats ( … ); XTmrCtr_mWriteReg ( … ); ... XEmac_mWriteReg ( … ); XTmrCtr_IsExpired ( … ); XTmrCtr_mWriteReg ( … ); XEmac_SendFrame ( … ); ... XIntc_mEnableIntr ( … ); XTmrCtr_IsExpired ( … ); ... uartlite.h ... … XIntc_mEnableIntr ( … ); xspi.h XUartLite_SendByte ( … ); ... XUartLite_GetStats ( … ); XSpi_mSendByte ( … ); ... XSpi_GetStatusReg ( … ); ... 08_so_emb_rtos_libraries_drivers.odp Date Oct 31, 2009 Page SO-LOGIC electronic consulting Lustkandlg 52, Vienna, Austria, Europe, World www.so-logic.net +43-1-315 77 77 BSPs are collections of parameterized drivers for a specific processor system. Support Libraries 08_so_emb_rtos_libraries_drivers.odp Date Oct 31, 2009 Page SO-LOGIC electronic consulting Lustkandlg 52, Vienna, Austria, Europe, World www.so-logic.net +43-1-315 77 77 The EDK libraries and device drivers provide standard C library functions, as well as functions to access peripherals. The Library Generator utility (LibGen) automatically configures the EDK libraries for every project based on the MSS file. These libraries and include files are saved in the current project’s lib and include directories, respectively. The libc library is included automatically. The -lm option should be specified for programs that access libm math functions. The Xilinx LibXil library provides block access to file systems and devices using standard calls, such as open, close, read, and write. The Memory File System (MFS) component, LibXil MFS, provides the capability for managing program memory in the form of file handles. Creating directories and including files within each directory is possible. The file system can be accessed from the high-level C language through function calls specific to the file system. The Networking library, lwIP, allows a processor to connect to the Internet. LibXilNet includes functions for handling the TCP/ IP stack protocols. It provides a simple set of Application Programming Interface (API) functions for enabling network programming. C Support Libraries Xilinx provides three C libraries Math library (libm) The math library is an improvement over the newlib math library The -lm option is used for libm functions Standard C language support (libc) The functions of this library are automatically available Xilinx processor support library (libxil.a) Interrupt/exception handler Program initialization 08_so_emb_rtos_libraries_drivers.odp Date Oct 31, 2009 Page SO-LOGIC electronic consulting Lustkandlg 52, Vienna, Austria, Europe, World www.so-logic.net +43-1-315 77 77 The EDK libraries and device drivers provide standard C library functions, as well as functions to access peripherals. The Library Generator utility (LibGen) automatically configures the EDK libraries for every project based on the MSS file. These libraries and include files are saved in the current project’s lib and include directories, respectively. System Access Libraries Xilinx provides four system access libraries Xilinx memory file system: LibXil Mfs Xilinx Compact Flash support: LibXil FATfs Xilinx System ACE™ interface required Xilinx networking support: LibXil lwIP TCP /IP stack library Intel parallel flash support: LibXil flash 08_so_emb_rtos_libraries_drivers.odp Date Oct 31, 2009 Page SO-LOGIC electronic consulting Lustkandlg 52, Vienna, Austria, Europe, World www.so-logic.net +43-1-315 77 77 The Memory File System (MFS) component, LibXil MFS, provides the
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages83 Page
-
File Size-