ÔÔ Ô Ô
User's
Guide
Ô
Ô
Real-Time Operating System
User Manual
version 3.2.3
for all distributions
Salvo User Manual
i
Contents
Contents...............................................................................................................i
Figures ............................................................................................................xvii
Listings.............................................................................................................xix
Tables...............................................................................................................xxi
Release Notes................................................................................................xxiii
Introduction ..........................................................................................................................xxiii
What's New ..........................................................................................................................xxiii
Release Notes .......................................................................................................................xxiii
Third-Party Tool Versions....................................................................................................xxiii
Supported Targets and Compilers................................................................xxv
Preface ..........................................................................................................xxvii
Typographic Conventions ...................................................................................................xxvii
Standardized Numbering Scheme ......................................................................................xxviii
The Salvo Coding Mindset...................................................................................................xxix
Configurability Is King..................................................................................................xxix
Conserve Precious Resources ........................................................................................xxix
Learn to Love the Preprocessor .....................................................................................xxix
Document, But Don't Duplicate.....................................................................................xxix
We're Not Perfect............................................................................................................xxx
Chapter 1 • Introduction.....................................................................................1
Welcome....................................................................................................................................1
What Is Salvo?...........................................................................................................................2
Why Should I Use Salvo? .........................................................................................................2
What Kind of RTOS Is Salvo?..................................................................................................3
What Does a Salvo Program Look Like?..................................................................................3
What Resources Does Salvo Require? ......................................................................................5
How Is Salvo Different?............................................................................................................ 6
What Do I Need to Use Salvo?..................................................................................................7
Which Processors and Compilers does Salvo Support? ............................................................8
How Is Salvo Distributed? ........................................................................................................8
ii
Contents
Salvo User Manual
What Is in this Manual?.............................................................................................................8
Chapter 2 • RTOS Fundamentals.....................................................................11
Introduction .............................................................................................................................11
Basic Terms.............................................................................................................................12
Foreground / Background Systems .........................................................................................14
Reentrancy...............................................................................................................................15
Resources ................................................................................................................................16
Multitasking and Context Switching.......................................................................................16
Tasks and Interrupts ................................................................................................................17
Preemptive vs. Cooperative Scheduling..................................................................................18
Preemptive Scheduling .....................................................................................................19
Cooperative Scheduling....................................................................................................20
More on Multitasking..............................................................................................................21
Task Structure...................................................................................................................21
Simple Multitasking..........................................................................................................22
Priority-based Multitasking ..............................................................................................22
Task States........................................................................................................................23
Delays and the Timer........................................................................................................24
Event-driven Multitasking ................................................................................................26
Events and Intertask Communications ....................................................................................29
Semaphores.......................................................................................................................29
Event Flags.................................................................................................................29
Task Synchronization.................................................................................................31
Resources ...................................................................................................................33
Messages...........................................................................................................................35
Message Queues ...............................................................................................................37
Summary of Task and Event Interaction.................................................................................37
Conflicts ..................................................................................................................................38
Deadlock ...........................................................................................................................38
Priority Inversions.............................................................................................................39
RTOS Performance .................................................................................................................39
A Real-World Example...........................................................................................................39
The Conventional Superloop Approach............................................................................40
The Event-Driven RTOS Approach..................................................................................41
Step By Step......................................................................................................................43
Initializing the Operating System...............................................................................43
Structuring the Tasks..................................................................................................43
Prioritizing the Tasks..................................................................................................44
Interfacing with Events ..............................................................................................45
Adding the System Timer...........................................................................................45
Starting the Tasks.......................................................................................................45
Enabling Multitasking ................................................................................................ 46
Putting It All Together ...............................................................................................46
The RTOS Difference.......................................................................................................49
Chapter 3 • Installation.....................................................................................51
Introduction .............................................................................................................................51
Running the Installer ...............................................................................................................51
Salvo User Manual
Contents
iii
Network Installation .........................................................................................................57
Installing Salvo on non-Wintel Platforms.........................................................................57
A Completed Installation......................................................................................................... 58
Uninstalling Salvo ...................................................................................................................59
Uninstalling Salvo on non-Wintel Machines....................................................................59
Installations with Multiple Salvo Distributions.......................................................................59
Installer Behavior..............................................................................................................60
Installing Multiple Salvo Distributions.............................................................................60
Uninstalling with Multiple Salvo Distributions................................................................60
Copying Salvo Files ................................................................................................................60
Modifying Salvo Files.............................................................................................................60
Chapter 4 • Tutorial...........................................................................................63
Introduction .............................................................................................................................63
Part 1: Writing a Salvo Application ........................................................................................63
Initializing Salvo and Starting to Multitask......................................................................63
Creating, Starting and Switching tasks .............................................................................64
Adding Functionality to Tasks..........................................................................................68
Using Events for Better Performance ...............................................................................70
Delaying a Task ................................................................................................................74
Signaling from Multiple Tasks ......................................................................................... 78
Wrapping Up.....................................................................................................................82
Food For Thought .............................................................................................................82
Part 2: Building a Salvo Application.......................................................................................82
Working Environment ......................................................................................................83
Creating a Project Directory .............................................................................................83
Including salvo.h...............................................................................................................84
Configuring your Compiler...............................................................................................84
Setting Search Paths...................................................................................................85
Using Libraries vs. Using Source Files.............................................................................85
Using Libraries .................................................................................................................85
Using Source Files............................................................................................................86
Setting Configuration Options....................................................................................87
Linking to Salvo Object Files.....................................................................................90
Chapter 5 • Configuration ................................................................................93
Introduction .............................................................................................................................93
The Salvo Build Process..........................................................................................................93
Library Builds...................................................................................................................93
Source-Code Builds ..........................................................................................................96
Benefits of Different Build Types.....................................................................................98
Configuration Option Overview..............................................................................................98
Configuration Options for all Distributions ............................................................................99
OSCOMPILER: Identify Compiler in Use .....................................................................100
OSEVENTS: Set Maximum Number of Events.............................................................101
OSEVENT_FLAGS: Set Maximum Number of Event Flags ........................................102
OSLIBRARY_CONFIG: Specify Precompiled Library Configuration ......................... 103
OSLIBRARY_GLOBALS: Specify Memory Type for Global Salvo Objects in
Precompiled Library....................................................................................................104
- 1
- 2
- 3
前往页