35
Introduction to Processor SDK RTOS Part 2 SoC (System on Chip) Drivers

Processor SDK RTOS Intro P2 - Texas Instrumentssoftware-dl.ti.com/.../external_files/Processor_SDK_RTOS_P2_Slides.pdf · processor sdk rtos 09 13processor_sdk_rtos_09_13\pdk am57xpdk_am57xx_1_0_0x100\packages\ti\csl

  • Upload
    others

  • View
    20

  • Download
    3

Embed Size (px)

Citation preview

Page 1: Processor SDK RTOS Intro P2 - Texas Instrumentssoftware-dl.ti.com/.../external_files/Processor_SDK_RTOS_P2_Slides.pdf · processor sdk rtos 09 13processor_sdk_rtos_09_13\pdk am57xpdk_am57xx_1_0_0x100\packages\ti\csl

Introduction to Processor SDK RTOS Part 2

SoC (System on Chip) Drivers

Page 2: Processor SDK RTOS Intro P2 - Texas Instrumentssoftware-dl.ti.com/.../external_files/Processor_SDK_RTOS_P2_Slides.pdf · processor sdk rtos 09 13processor_sdk_rtos_09_13\pdk am57xpdk_am57xx_1_0_0x100\packages\ti\csl

Agenda• Drivers Overview• Chip Support Library (CSL) Layer• Low Level Driver (LLD) LayerLow Level Driver (LLD) Layer• OS Abstraction Layer (OSAL)• Board Library• Secondary Boot Loader (SBL)Secondary Boot Loader (SBL)• Board Diagnostics 

Page 3: Processor SDK RTOS Intro P2 - Texas Instrumentssoftware-dl.ti.com/.../external_files/Processor_SDK_RTOS_P2_Slides.pdf · processor sdk rtos 09 13processor_sdk_rtos_09_13\pdk am57xpdk_am57xx_1_0_0x100\packages\ti\csl

SoC Drivers Interfaces 

Page 4: Processor SDK RTOS Intro P2 - Texas Instrumentssoftware-dl.ti.com/.../external_files/Processor_SDK_RTOS_P2_Slides.pdf · processor sdk rtos 09 13processor_sdk_rtos_09_13\pdk am57xpdk_am57xx_1_0_0x100\packages\ti\csl

SoC Drivers and Operating System

• TI‐RTOS h

TI RTOS

exposes the physical drivers to the

LINUX

to the applications.

• Linux does not.Linux does not. Standard API

Hardware Drivers(Device and platform drivers)

Page 5: Processor SDK RTOS Intro P2 - Texas Instrumentssoftware-dl.ti.com/.../external_files/Processor_SDK_RTOS_P2_Slides.pdf · processor sdk rtos 09 13processor_sdk_rtos_09_13\pdk am57xpdk_am57xx_1_0_0x100\packages\ti\csl

CSL Layer

Introduction to Processor SDK RTOS Part 2

Page 6: Processor SDK RTOS Intro P2 - Texas Instrumentssoftware-dl.ti.com/.../external_files/Processor_SDK_RTOS_P2_Slides.pdf · processor sdk rtos 09 13processor_sdk_rtos_09_13\pdk am57xpdk_am57xx_1_0_0x100\packages\ti\csl

LLD Structure and Chip Support Library (CSL)p pp y ( )• Low Level Drivers 

(LLD) hide the detailsApplication Layer (LLD) hide the details of CSL from the application.

• Some IP and

Application Layer

• Some IP and peripherals do not have LLD. The 

li i CSLapplication uses CSL directly

• Some LLD can access 

LLD Layer

the hardware directly (and not via CSL)CSL Functions layer

CSL #define Layer

Hardware 

Page 7: Processor SDK RTOS Intro P2 - Texas Instrumentssoftware-dl.ti.com/.../external_files/Processor_SDK_RTOS_P2_Slides.pdf · processor sdk rtos 09 13processor_sdk_rtos_09_13\pdk am57xpdk_am57xx_1_0_0x100\packages\ti\csl

CSL (Chip Support Library) Overview• (Almost) All peripherals are controlled by Memory Mapped Registers (MMR)

LLD or Application

Registers (MMR).• The MMR may have different addresses for different (future) SOCs.

• The CSL has two layers:The first layer assigns a

CSL Software

―The first layer assigns a standard name to MMR.

―The second layer is a set of f i i l

CSL functions

functions to manipulate these registers.

• The application or LLD needs only CSL #define registers Name

pp yto know the API of the CSL functions.

Hardware Registersg

Page 8: Processor SDK RTOS Intro P2 - Texas Instrumentssoftware-dl.ti.com/.../external_files/Processor_SDK_RTOS_P2_Slides.pdf · processor sdk rtos 09 13processor_sdk_rtos_09_13\pdk am57xpdk_am57xx_1_0_0x100\packages\ti\csl

CSL Registers #define

• The MMR address depends on the SoC family. • The include file and SoC‐specific CSL support files are located in a directory like the onefiles are located in a directory like the one shown:processor sdk rtos 09 13\pdk am57xx 1 0 0\packages\ti\cslprocessor_sdk_rtos_09_13\pdk_am57xx_1_0_0\packages\ti\csl

• SoC‐specific CSL support files are located in one f h di i ( lid )of the src directories (see next slide).

Page 9: Processor SDK RTOS Intro P2 - Texas Instrumentssoftware-dl.ti.com/.../external_files/Processor_SDK_RTOS_P2_Slides.pdf · processor sdk rtos 09 13processor_sdk_rtos_09_13\pdk am57xpdk_am57xx_1_0_0x100\packages\ti\csl

CSL Registers #defineSoC‐dependent

E h S C h di t th t t i ll th S C ifi CSL filEach SoC has a src directory that contains all the SoC‐specific CSL files

Page 10: Processor SDK RTOS Intro P2 - Texas Instrumentssoftware-dl.ti.com/.../external_files/Processor_SDK_RTOS_P2_Slides.pdf · processor sdk rtos 09 13processor_sdk_rtos_09_13\pdk am57xpdk_am57xx_1_0_0x100\packages\ti\csl

Example cslr_soc_ipu_baseaddress.hp _ _ p _C:\ti\processor_sdk_rtos_09_13\pdk_am57xx_1_0_0\packages\ti\csl\soc\am572x\src 

Gives the location of the IPU interrupt registers’ block

Page 11: Processor SDK RTOS Intro P2 - Texas Instrumentssoftware-dl.ti.com/.../external_files/Processor_SDK_RTOS_P2_Slides.pdf · processor sdk rtos 09 13processor_sdk_rtos_09_13\pdk am57xpdk_am57xx_1_0_0x100\packages\ti\csl

Interrupt Interface Functions: CSL_cpIntAux.h

Page 12: Processor SDK RTOS Intro P2 - Texas Instrumentssoftware-dl.ti.com/.../external_files/Processor_SDK_RTOS_P2_Slides.pdf · processor sdk rtos 09 13processor_sdk_rtos_09_13\pdk am57xpdk_am57xx_1_0_0x100\packages\ti\csl

Interrupt Interface Structures & Constant: CSL_cpInt.h

Page 13: Processor SDK RTOS Intro P2 - Texas Instrumentssoftware-dl.ti.com/.../external_files/Processor_SDK_RTOS_P2_Slides.pdf · processor sdk rtos 09 13processor_sdk_rtos_09_13\pdk am57xpdk_am57xx_1_0_0x100\packages\ti\csl

LLD Layer

Introduction to Processor SDK RTOS Part 2

Page 14: Processor SDK RTOS Intro P2 - Texas Instrumentssoftware-dl.ti.com/.../external_files/Processor_SDK_RTOS_P2_Slides.pdf · processor sdk rtos 09 13processor_sdk_rtos_09_13\pdk am57xpdk_am57xx_1_0_0x100\packages\ti\csl

Understanding the LLDg

• LLDs are hardware drivers that talk directly or via CSL to the hardware registers. 

• LLDs are used to abstract hardware implementation p(or CSL) details from the user.

• The Real‐Time Software Component (RTSC) systemThe Real Time Software Component (RTSC) system enforces a fixed structure to all the LLD modules.

• Most (but not all) LLD code and pre build libraries are• Most (but not all) LLD code and pre‐build libraries  are located in the pdk (platform development kit) directorydirectory.

Page 15: Processor SDK RTOS Intro P2 - Texas Instrumentssoftware-dl.ti.com/.../external_files/Processor_SDK_RTOS_P2_Slides.pdf · processor sdk rtos 09 13processor_sdk_rtos_09_13\pdk am57xpdk_am57xx_1_0_0x100\packages\ti\csl

Core‐dependent  LLD Drivers in the pdkDi t (S C d d t)Directory (SoC‐dependent) 

Page 16: Processor SDK RTOS Intro P2 - Texas Instrumentssoftware-dl.ti.com/.../external_files/Processor_SDK_RTOS_P2_Slides.pdf · processor sdk rtos 09 13processor_sdk_rtos_09_13\pdk am57xpdk_am57xx_1_0_0x100\packages\ti\csl

Example Directory Structure: GPIO (1)

The top level directory includes: • S b directories• Sub‐directories• Files that are visible to the application• XDC files that help with XDC building (auto‐building) projects using configuration file

Page 17: Processor SDK RTOS Intro P2 - Texas Instrumentssoftware-dl.ti.com/.../external_files/Processor_SDK_RTOS_P2_Slides.pdf · processor sdk rtos 09 13processor_sdk_rtos_09_13\pdk am57xpdk_am57xx_1_0_0x100\packages\ti\csl

Example Directory Structure: GPIO (2)

• build contains make files to build the generic librariesgeneric libraries.

• docs contains all user documentation:– Software manifests (licensing export control– Software manifests (licensing, export control, etc.)

– Release notes– User guides– Module‐specific documentsThe Doxygen subdirectory contains a– The Doxygen subdirectory contains a collection of  linked HTML documentation files that are generated from the code.

• example contains code that support the example projects.

Page 18: Processor SDK RTOS Intro P2 - Texas Instrumentssoftware-dl.ti.com/.../external_files/Processor_SDK_RTOS_P2_Slides.pdf · processor sdk rtos 09 13processor_sdk_rtos_09_13\pdk am57xpdk_am57xx_1_0_0x100\packages\ti\csl

Example Directory Structure: GPIO (3)

• lib contains libraries for different cores.• package contains files that are used during the XDC building of the moduleg g

• src contains the SOC‐independent source and include filessource and include files. 

• soc contains the SOC‐dependent source and include files.

• test contains files that are part of the pexample test.

Page 19: Processor SDK RTOS Intro P2 - Texas Instrumentssoftware-dl.ti.com/.../external_files/Processor_SDK_RTOS_P2_Slides.pdf · processor sdk rtos 09 13processor_sdk_rtos_09_13\pdk am57xpdk_am57xx_1_0_0x100\packages\ti\csl

Example GPIO Include File: gpio.h 

The include file gpio.h has all the external information needed by the application:• #define of all values that may be needed by#define of all values that may be needed by application in order to use GPIO

• Defines all structures that may be used by the application

• Defines the APIs for all the functions

Page 20: Processor SDK RTOS Intro P2 - Texas Instrumentssoftware-dl.ti.com/.../external_files/Processor_SDK_RTOS_P2_Slides.pdf · processor sdk rtos 09 13processor_sdk_rtos_09_13\pdk am57xpdk_am57xx_1_0_0x100\packages\ti\csl

gpio.h Functions API gp

Page 21: Processor SDK RTOS Intro P2 - Texas Instrumentssoftware-dl.ti.com/.../external_files/Processor_SDK_RTOS_P2_Slides.pdf · processor sdk rtos 09 13processor_sdk_rtos_09_13\pdk am57xpdk_am57xx_1_0_0x100\packages\ti\csl

Developing Application Using LLD Code

• Get a resource (open, create).• Configure the resource.

– Understand the structure of the parameters of the configuration function (example to follow)function (example to follow)

• If there are dependencies, configure dependencies.U i i• Use in run time.– Refer to the Processor SDK examples to understand what 

d b dneeds to be done.

Page 22: Processor SDK RTOS Intro P2 - Texas Instrumentssoftware-dl.ti.com/.../external_files/Processor_SDK_RTOS_P2_Slides.pdf · processor sdk rtos 09 13processor_sdk_rtos_09_13\pdk am57xpdk_am57xx_1_0_0x100\packages\ti\csl

API Flow for Generic LLD: UART (1/2)( / )

Configure the board specific interface parameters from the SOC directory For UART, UART_soc.c file set the RX 

and TX pin for communication 

UART_init() From directory

Use init function to create an handle for the instance of the LLD

pdk_am57xx_1_0_0\packages\ti\drv\uart\src

UART_Params_init() From directorydk 57 1 0 0\ k \ti\d \Configure the parameters of the LLD pdk_am57xx_1_0_0\packages\ti\drv\

uart\src

Page 23: Processor SDK RTOS Intro P2 - Texas Instrumentssoftware-dl.ti.com/.../external_files/Processor_SDK_RTOS_P2_Slides.pdf · processor sdk rtos 09 13processor_sdk_rtos_09_13\pdk am57xpdk_am57xx_1_0_0x100\packages\ti\csl

API Flow for Generic LLD: UART (2/2)

UART open(instance param)Open an Instance of LLD, make it ready to 

start working

UART_open(instance, param) Open the handle for the UART instance

UART read(UART handle handle , voidRun time functions 

Read, Write 

UART_read(UART_handle handle , void *buffer, size_t size) 

UART_write(UART_handle handle , void *buffer, size_t size) 

Close the LLD instanceUART_close(UART_handle handle)

Page 24: Processor SDK RTOS Intro P2 - Texas Instrumentssoftware-dl.ti.com/.../external_files/Processor_SDK_RTOS_P2_Slides.pdf · processor sdk rtos 09 13processor_sdk_rtos_09_13\pdk am57xpdk_am57xx_1_0_0x100\packages\ti\csl

Building the LLD LibraryEach LLD for each SOC and each core has a makefile that builds the LLD librarybuilds the LLD library.In the make file, use –g and no optimization to debug driver code and use optimization for production build.driver code and use optimization for production build. 

Page 25: Processor SDK RTOS Intro P2 - Texas Instrumentssoftware-dl.ti.com/.../external_files/Processor_SDK_RTOS_P2_Slides.pdf · processor sdk rtos 09 13processor_sdk_rtos_09_13\pdk am57xpdk_am57xx_1_0_0x100\packages\ti\csl

Operating System AbstractionOperating System AbstractionLayer (OSAL)y ( )Introduction to Processor SDK RTOS Part 2

25

Page 26: Processor SDK RTOS Intro P2 - Texas Instrumentssoftware-dl.ti.com/.../external_files/Processor_SDK_RTOS_P2_Slides.pdf · processor sdk rtos 09 13processor_sdk_rtos_09_13\pdk am57xpdk_am57xx_1_0_0x100\packages\ti\csl

OSAL: Makes Driver OS‐independent

• When a driver requires an operating system utility• When a driver requires an operating system utility, OSAL provides a standard interface to any OS.

• Operating system can be TI‐RTOS or any generic OSOperating system can be TI RTOS or any generic OS … or even bare metal.

Page 27: Processor SDK RTOS Intro P2 - Texas Instrumentssoftware-dl.ti.com/.../external_files/Processor_SDK_RTOS_P2_Slides.pdf · processor sdk rtos 09 13processor_sdk_rtos_09_13\pdk am57xpdk_am57xx_1_0_0x100\packages\ti\csl

OSAL: Makes Driver OS‐independent (2/2)

• Starting point for systems that use a different operating system.  E l f tiliti• Examples of utilities:– Interrupt Handling– Semaphore HandlingSemaphore Handling

Page 28: Processor SDK RTOS Intro P2 - Texas Instrumentssoftware-dl.ti.com/.../external_files/Processor_SDK_RTOS_P2_Slides.pdf · processor sdk rtos 09 13processor_sdk_rtos_09_13\pdk am57xpdk_am57xx_1_0_0x100\packages\ti\csl

Board Library

Introduction to Processor SDK RTOS Part 2

Page 29: Processor SDK RTOS Intro P2 - Texas Instrumentssoftware-dl.ti.com/.../external_files/Processor_SDK_RTOS_P2_Slides.pdf · processor sdk rtos 09 13processor_sdk_rtos_09_13\pdk am57xpdk_am57xx_1_0_0x100\packages\ti\csl

Board Library

• The Board Library is a thin utilityThe Board Library is a thin utility layer on top of  CSL. 

• It provides uniform APIs  for configuration of all supported g ppboards.

• It aims to assist the user to quickly write portable applications for the 

d b dsupported boards.• Provides a standard interface to 

basic board configuration values like Pinmux clocking DDRlike Pinmux, clocking, DDR features, PLL, etc.

Page 30: Processor SDK RTOS Intro P2 - Texas Instrumentssoftware-dl.ti.com/.../external_files/Processor_SDK_RTOS_P2_Slides.pdf · processor sdk rtos 09 13processor_sdk_rtos_09_13\pdk am57xpdk_am57xx_1_0_0x100\packages\ti\csl

Boot Support:Boot Support:Secondary Boot Loader (SBL)y ( )Introduction to Processor SDK RTOS Part 2

Page 31: Processor SDK RTOS Intro P2 - Texas Instrumentssoftware-dl.ti.com/.../external_files/Processor_SDK_RTOS_P2_Slides.pdf · processor sdk rtos 09 13processor_sdk_rtos_09_13\pdk am57xpdk_am57xx_1_0_0x100\packages\ti\csl

Secondary Boot Loader (SBL)

• SBL includes tools and utilities to support multi‐core deployment pp p yof applications from boot.

• Provides SoC‐dependent functions to initialize the SOC and perform slave core boot‐up functions. 

Page 32: Processor SDK RTOS Intro P2 - Texas Instrumentssoftware-dl.ti.com/.../external_files/Processor_SDK_RTOS_P2_Slides.pdf · processor sdk rtos 09 13processor_sdk_rtos_09_13\pdk am57xpdk_am57xx_1_0_0x100\packages\ti\csl

Diagnostics

Introduction to Processor SDK RTOS Part 2

Page 33: Processor SDK RTOS Intro P2 - Texas Instrumentssoftware-dl.ti.com/.../external_files/Processor_SDK_RTOS_P2_Slides.pdf · processor sdk rtos 09 13processor_sdk_rtos_09_13\pdk am57xpdk_am57xx_1_0_0x100\packages\ti\csl

Diagnostics Software

Diagnostics application:• Used to test EVM 

(Evaluation Module) or any customer board hardware for manufacturing and component defects 

• Can be loaded and executed over JTAG or run directly from an SD card in system boot

Page 34: Processor SDK RTOS Intro P2 - Texas Instrumentssoftware-dl.ti.com/.../external_files/Processor_SDK_RTOS_P2_Slides.pdf · processor sdk rtos 09 13processor_sdk_rtos_09_13\pdk am57xpdk_am57xx_1_0_0x100\packages\ti\csl

Diagnostics SoftwareDiagnostics application:• Instructions on how to build the 

diagnostics code are in a SoC wiki:

User Interface

diagnostics code are in a SoC wiki: http://ap‐fpdsp‐swapps.dal.design.ti.com/index.php/Processor_SDK_RTOS_Software_Developer_Guide#Board_Library_and_Diagnostic_Examples

I t ti h t t b d• Instructions on how to connect board to CCS and run diagnostic are in a SoCwiki like this one (for AM572X): http://ap‐fpdsp‐p // p p pswapps.dal.design.ti.com/index.php/GSG:_AM572x_General_Purpose_EVM_Hardware_Setup

Page 35: Processor SDK RTOS Intro P2 - Texas Instrumentssoftware-dl.ti.com/.../external_files/Processor_SDK_RTOS_P2_Slides.pdf · processor sdk rtos 09 13processor_sdk_rtos_09_13\pdk am57xpdk_am57xx_1_0_0x100\packages\ti\csl

For More Information• TI‐RTOS Tool Folder• TI‐RTOS Wiki• TI‐RTOS Kernel WorkshopTI RTOS Kernel Workshop• For questions regarding topics covered in this t i i i it th t f t th TI E2Etraining, visit the support forums at the TI E2E Community website.