1
Introduction
Purpose
The course describes library configuration and usage in the High
Performance Embedded Workshop (HEW), which speeds development
of software for embedded systems.
Objectives
Learn the steps involved in creating a user library. Understand how libraries are used in applications.
Content
24 pages
3 Questions
Learning Time
2
© 2008, Renesas Technology America, Inc., All Rights Reserved
Collection of functions that provide useful
services in an application
Shared among different applications
Can protect intellectual property (IP)
Classified as user or system
Created by the optimizing linkage editor
Combines multiple object programs output by the compiler or
assembler to produce a library file
Generates and edits library files
Deletes debugging information from library and
load-module files
Library Module
3
Allows a single instance of a function to be called recursively multiple
times without affecting the operation of the function
Enables library to maintain portability and independence
Fn( ) { … ….Fn( ) } Fn( ) { … ….Fn( ) } Fn( ) { … ….Fn( ) } Fn( ) { … ….Fn( ) } . . .
Re-entrancy Requirement
In user libraries, try to avoid using global variables or standard library functions that are not re-entrant.
4
© 2008, Renesas Technology America, Inc., All Rights Reserved
Application Application Demo1( ) Demo2( ) Demo3( ) Demo4( ) Demo5( ) Library Files Source Files pass argument return value
Clearly defined function interface
Library Creation and Usage
Stage 1 Create a new library
Stage 2 Create an application that calls the library functions Stage 3 Further modify and debug the application
5
Creating Library Space
Create a new project
1
Add the library filename
2
Click Next
3
Click Finish
4
Stage 1 Stage 2 Stage 3
Settings must correspond to the intended application or device.
6
© 2008, Renesas Technology America, Inc., All Rights Reserved
Adding Library Files
Select Add Files
Select a source file
1
2
Library source is added to directory
3
7
Configuring the Build
Access HEW Standard Toolchain
Choose type of output
Check CPU settings
3 2
1
8
© 2008, Renesas Technology America, Inc., All Rights Reserved
Building the Library
Build the project
1
Check for any build errors
2
9
Click here
Library Information
View Library information via
Librarian Interface
Information about generated
library can be viewed inside
library listing file (*.lbp) under
project directory
1
View library module
3
Stage
1
Stage 2 Stage 3
Browse to library file
PROPERTIES
On passing, 'Finish' button: Goes to Next Slide
On failing, 'Finish' button: Goes to Slide
Allow user to leave quiz: After user has completed quiz
User may view slides after quiz: After passing quiz
11
Creating an Application
Create new project1 3 Option settings
Device settings
2
Click Finish
4
Stages 1 and 2 use different workspaces and their settings must be compatible when the workspaces are interfaced.
Library settings and device settings in your program must match.
12
© 2008, Renesas Technology America, Inc., All Rights Reserved
Adding Source Code
Or type in your code Add other source file
1
2
All library function prototypes must be defined and function names must correspond to the library contents.
13
Library Linkage
Click Add
1
Browse to add user library
2
Click OK
3
14
© 2008, Renesas Technology America, Inc., All Rights Reserved
Building/Setting Debugger
Click Build All
Set debug settings
3
Correct errors, if any
2
1
Click OK
4
Application program needs only clearly defined function prototype interfaces to know what functions are available in the libraries.
15
Application Debugging
Download module
1
Stage 1 Stage 2 Stage 3
Add breakpoint
2
Add watch window
16
© 2008, Renesas Technology America, Inc., All Rights Reserved
Select Reset Go
3
Executing Application
Stage 1 Stage 2 Stage 3
Step Over one by one
4
Check results
PROPERTIES
On passing, 'Finish' button: Goes to Next Slide
On failing, 'Finish' button: Goes to Slide
Allow user to leave quiz: After user has completed quiz
18
© 2008, Renesas Technology America, Inc., All Rights Reserved
Click OK 2
Further Development
Check configuration Insert a project 1 4Library project added
3
19
Modifying Code
Stage 1 Stage 2 Stage 3
New library function
20
© 2008, Renesas Technology America, Inc., All Rights Reserved
Adding a New Call
New call added to library
3
Remember to add library function’s prototype into application source file.
Stage 1 Stage 2 Stage 3
Set current project
21
Further Debugging
Stage 1 Stage 2 Stage 3
22
© 2008, Renesas Technology America, Inc., All Rights Reserved
Project Dependency
Dependents are built first
5
Select Dependent Projects
1
Select User Library
2
Click OK
3
Dependent added
4
PROPERTIES
On passing, 'Finish' button: Goes to Next Slide
On failing, 'Finish' button: Goes to Slide
Allow user to leave quiz: After user has completed quiz
24
© 2008, Renesas Technology America, Inc., All Rights Reserved
Creating library module with different functions
Adding library calls in an application
Modifying and debugging library module within the
application
Course Summary
Download a free evaluation copy of HEW at: