Operating Systems

Download Report

Transcript Operating Systems

Processor Choice
Chapter 2
Decisions, Decisions, Decisions
• Preliminaries – consumer’s point of view
– Specifically, what the function(s) must the embedded
processor perform?
– Is there room for future expansion?
– What expectations might the consumer have for the
product?
– How much money is the consumer willing to spend for the
functionality?
• Not uncommon for an embedded system to span a family of
devices
– Equates to lots of sales
Decisions, Decisions, Decisions
• Preliminaries – developer’s point of view
– Is the processor available in a suitable form-factor?
– Is the processor powerful enough to perform the function(s)?
– Does the processor support a suitable real-time operating
system (RTOS)?
– Are there adequate tools to support development?
• Not uncommon for an embedded system to span a family of
devices
– We have to live with a long product life span so we must
make the right choices up front
Decisions, Decisions, Decisions
• The consumer’s point of view is the
responsibility of the marketing staff
– Thus, we won’t dig too deeply into it here
• Of greater interest to us is the
developer’s point of view
Microprocessor vs. Microcontroller
(to start the decision process rolling)
• Microprocessor
– More powerful CPU
– Minimal I/O support
– Requires additional
“glue” chips to
complete design
– Low level of
integration
• Microcontroller
– Less powerful CPU
– Much I/O support
– Minimal “glue” chips
required
– High level of
integration
• The high level of integration gives the microcontroller a great cost advantage
• CPU power increases as microprocessors are converted into microcontrollers
(after the developers have made their money from the desktop markets)
• If your design requires state-of-the-art processing, you’ll pay for it!
Suitable Implementation
• Is the processor available in a suitable
form-factor?
– Integration of functions
• Single chip solutions to achieve optimal speed
– Their development time/cost may be large
• Multi-chip solutions may be cost effective
– Their performance may be sub-par
Suitable Implementation
• Is the processor available in a suitable form-factor?
– Packaging of the processor
• Plastic package
– May have heating issues
• Ceramic package
– May be more expensive
• Raw die
– You package it yourself
• Multi-chip module
– Multiple chips in a single package may be an intermediate, cost
effective solution
• Mil-spec (military standard) requirements
– Tend to be very expensive but operate in extreme environments
– The mountain of paperwork to support the claims makes up a
large portion of the cost
Packaging
• Goal is to minimize number of devices
– System On a Chip (SOC) or System On
Silicon (SOS) solutions
– This can be achieved by not buying
microprocessor or microcontroller devices, but
by licensing their designs
• You then combine these designs with your own to
form a single chip
Freely Available Designs
• www.opencores.org offers many “cores”
(designs) for free download and incorporation
into your project
–
–
–
–
–
–
–
Microprocessors
Math coprocessors
Communications
Memory
Digital signal processors
Cryptography
…
Suitable Performance
• Is the processor powerful enough to perform
the function(s)?
– Processors may be asked to perform various tasks
• e.g. a digital camera processor must perform UI and pixel
processing
– Difficult to predict (specify) performance
requirements in an ever-changing market
– Available benchmark numbers may not be
representative of the required task
• This is precisely why the benchmarks exist,
but…
Suitable Performance
• …unscrupulous compiler developers can
(and do?) optimize their software and
hardware to generate very good benchmark
metrics
– When it comes to your code, “results may vary”
• And, the speed of the “glue” chips must also
be factored in
– Buying a 2GHz Pentium with a very slow bus
doesn’t do you much good if you’re doing a lot of
I/O functions
Measuring Performance
• The standard used to be the “VAX MIP”
– Digital Equipment Corporation’s VAX was
the first (?) million-instruction/second
machine thus it set the standard
– But, what’s an instruction?
• CISC vs. RISC
• 5 RISC instructions may be required to achieve
the same result as 1 CISC instruction
Measuring Performance
• Benchmarking
– The process of running a series of “standardized” tests to rank
processors against one another
– Dhrystone Benchmark
• Control structures, integer, and string operations
• Measures the efficiency of
– The hardware
– The compiler (code generator)
– Whetstone Benchmark
• Concentration on floating point operations
• Measures efficiency of the hardware
• These are fine if you’re doing this kind of operations
• And, again, vendors may optimize their products to execute
these benchmarks
Suitable Performance
• Benchmarking
– You must analyze the processor in the
environment in which it will be operating
– You must consider real-time constraints
• Interrupt handling
• Task switching (context switching)
• As well as raw processing power
– The Embedded Microprocessor
Benchmark Consortium
Suitable Performance
• The Embedded Microprocessor Benchmark
Consortium
– Five basic categories
•
•
•
•
•
Automotive/Industrial
Consumer
Networking
Office Automation
Telecommunications
– These consist of “real world” algorithms
• (JPEG, FFT, lookup tables, correlation, convolution, …)
• These are things that designers actually use in their
designs
Suitable Performance
• The Embedded Microprocessor Benchmark
Consortium
– Benchmarks report
• Processor speed (time to compute)
• Code size (memory usage)
– Data can be used to compare to applications
needs rather than to other processors
• Fastest may not always be the desired result
• It often equates to “most expensive”, “most memory
usage”, and “most power consumption”
Suitable Performance
• Running benchmarks
– Typically run on an evaluation board
• Similar to the Stamp BOE boards that we are using
– These can be extremely useful
• You can put your own software on them for
benchmarking
• You can use them to develop your software
• You can use them to evaluate toolsets
– But beware, the boards may not be representative
of your target design in terms of hardware
Suitable Operating System
• Does the processor support a suitable
real-time operating system (RTOS)?
– Is your task sufficiently complex to require
the use of an RTOS?
– Can the project afford an RTOS?
– Can the project afford not to use an
RTOS?
– Do you have the expertise to write an
RTOS or port an existing one to the
processor?
Suitable Operating System
•
•
Wind River – VxWorks
– Probably expensive given that the website doesn’t give the price
anywhere!
• You will pay for development tools
• You will pay license fees based on number of products sold (or
negotiated rate)
– Looks like it does absolutely everything (see VxWorks spec sheet)
– Little expertise required to get it going
– Works with Eclipse environment to support development
• Familiar to many engineers thus short learning curve
MicroC/OS
– Freely downloadable
– You get a “readme.txt” file or you can buy books written about the
OS
– You’ll need to know what you’re doing to use it
RTOS Considerations
• Microprocessor/microcontroller support
– Does the RTOS run on the processor you’ll
be using?
– Or, conversely, can you use one of the
processors on which the RTOS runs?
• Language support
– What compilers are available for use with
the RTOS?
– C is typical, C++ is getting popular
RTOS Considerations
• Tool Compatibility
– Will the RTOS work with tools such as in-circuit
emulators, software building, performance
analysis, …?
– Many tools are packaged with the RTOS purchase
(see VxWorks spec sheet)
• Provided Services
– Does the RTOS do everything you want to do?
– Task scheduling, task synchronization,
communication, file management, …
– Does the RTOS provide stuff you’ll never use but
are paying for?
RTOS Considerations
• Footprint
– How much of your embedded resources (memory)
is the RTOS going to consume?
– Can you tailor the RTOS to fit your specific needs?
(include some parts, exclude others)
• Performance
– Refer to the vendor benchmarks and relate them
to your task at hand
– Things like dynamic memory allocation are nice
but may be very, very slow
RTOS Considerations
• Software components
– Does it provide packaged components that you
can use or will you have to write your own?
– Similar to “services” but at a higher level
– Graphics, protocol stacks, database support, file
system management, …
• Device drivers
– Does it supply drivers for common peripheral
devices?
• Similar to “services” and “software components”
RTOS Considerations
• Standards compatibility
– Does your product have to conform to any standards? (milspec, FCC regulations, …)
– If so, does the operating system support these?
– Is the RTOS certified? (this may be directly related to the
reliability of the RTOS)
• Source code availability
– Do you need to modify the RTOS to suite a specific, unique
requirement?
– Do you trust the RTOS to be bug-free?
– Do you have the expertise to work with the RTOS source
code if necessary?
RTOS Considerations
• Licensing
– Are you allowed to sell your product with copies of
the RTOS loaded onto it?
– Is there a “per-device” charge or a single product
license?
– Can you install multiple copies of the development
tools?
• Technical support
– Will the vendor be there when problems arise?
– Are there alternative sources of support, such as
newsgroups or consultants?
RTOS Considerations
• Bottom line…
– The RTOS can make or break the success
of a system
– If you really, really need one, don’t be
fooled into thinking you can write it yourself
– If you don’t really need one (i.e. a state
machine will do the trick), don’t be bullied
into buying one
Suitable Tools
• Are there adequate tools to support
development?
– How good are your developers?
– How complex is your system?
– Minimum
• Cross-compiler
• In-circuit emulator (ICE)
Suitable Tools
• Tool [un]availability can mean missing or
making a critical deadline
• You’ve already seen it in trying to develop
simple projects on the Stamp boards
– Both the Basic and Javelin IDEs help in debugging
the software side
– But what about the hardware?
• Staring at the hardware wondering why the LEDs don’t
flash rarely solves the problem
• Multi-meters, oscilloscopes, logic analyzers, in-circuit
emulators…all would make our lives much easier
Suitable Tools
• How “good” is the compiler?
–
–
–
–
Is the code efficient (small and fast)?
Can it handle inline assembly code?
Can you hand-edit the resultant assembly code?
Does it have real-time extensions (interrupt
handlers, synchronization primitives, task
management, …)?
– How closely matched is it to the target hardware?
• How “good” are the software libraries?
– Produce satisfactory results?
– Optimized for speed/size?
Suitable Tools
• What about when the system “works”
but is too slow?
– Profilers coupled with in-circuit emulators
may help to identify bottle-necks in the
system
• Are the available tools integrated?
– Can the user learn one IDE interface and
use all the tools efficiently or must they
learn (and switch between) various UIs?
And…
• Can you reuse prior designs?
– Direct reuse of software or hardware?
– Indirect reuse of knowledge acquired from
prior projects?
– Can you take advantage of a vendor’s
“family development” approach?
• 8086 → 80186 → 80286 → 80386 → 80486 →
Pentium → Itanium → ????
And…
• Are you forced into any choices?
– e.g. must use a mil-spec part and this is
the only one available
– At one time military software had to be
written in Ada (long since relaxed or
omitted from many contracts)
• Navy used to use something called Jovial
– So, you’re chosen the whiz-bang processor
XYZ but it’s only programmable in
COBOL…can you live with that?
And…
• Realistically, how much time do you
have to develop this product?
– Is it’s useful lifespan short?
– Is someone else competing with you?
– Must it meet a specific shopping season?
– Is there room for upgrades later? (planned
obsolescence)
Digital Camera project
• For the cell phone camera we went without
an operating system
– Pure custom software similar to what you’re doing
in the Stamp work
• For a higher end digital cinema camera we’re
using VxWorks
– Many features required by the camera are
supported in VxWorks reducing development time
Summary
• Choosing an embedded processor is more than
looking at clock speeds…
– …way more
• You won’t get everything you want (whether you’re a
software developer, a hardware developer, a systems
engineer, a QA manager, a marketing manager, …)
• All involved in product development should have a
say in the processor selection
• You’re likely to live with this decision for a long time
so give it the consideration it deserves
To do
• Parallax offers four different Basic Stamp Modules
–
–
–
–
Basic Stamp 2px
Basic Stamp 2p
Basic Stamp 2pe
Basic Stamp 2e
• Locate/read the spec sheets for each
(www.parallax.com)
– Summarize the primary differences among them
– Describe an application that would be best implemented by
each of the different devices and justify your choice based
on the specifications of the device
To do
• Discuss differences between VxWorks (Wind River –
http://www.windriver.com/products/vxworks/ ) and
Windows or Mac OS
– Applications of the OS
– Features provided by the OS
– Support provided by the OS
• User support
• Developer support
– etc.