Lecture VIII Advanced Embedded Systems Software - PowerPoint PPT Presentation

1 / 37
About This Presentation
Title:

Lecture VIII Advanced Embedded Systems Software

Description:

Serious Stuff: Events and Names. Now I want to show how an action module 'produces' an event. ... Mode-Is-Raw-Capture - Return Open-File Write-Itp Close-File ... – PowerPoint PPT presentation

Number of Views:66
Avg rating:3.0/5.0
Slides: 38
Provided by: peterco6
Category:

less

Transcript and Presenter's Notes

Title: Lecture VIII Advanced Embedded Systems Software


1
Lecture VIII Advanced Embedded Systems Software
  • Introduction to Libero (from iMatix)
  • What is Libero? Why Code Generation?
  • Components of Libero States, Events, Modules
  • Using Libero to describe Telephone Operation
  • State Transitions Code Generation
  • Advanced Features of Libero
  • Digital Camera Firmware Design with Libero
  • Main Dialog and Associated States
  • Take Picture Dialog and Associated States
  • Overview of Generated C-Code

2
  • Introduction to Libero
  • Libero generates code in these languages C,
    C, Java, Perl, Awk, 80x86 assembler, COBOL, MS
    Visual Basic, MS Test Basic, UNIX C Shell, UNIX
    Korn Shell, UNIX Bourne Shell, GNU Bash Shell,
    Rexx, PL/SQL, and PHP. You can extend Libero
    support to other languages via external schema
    files.
  • Libero is a Programmer's Tool and Code
    Generator. You define the high-level logic of a
    problem as a diagram Libero generates the code
    to implement this logic. Your applications are
    easier to write, more robust, easier to
    understand. Libero uses a finite-state machine as
    the underlying model.
  • Libero runs on UNIX (tested on Linux, HP/UX,
    SunOS, Irix, AIX, Solaris), MS-DOS, MS-Windows,
    Digital Open-VMS, OS/2. It is in theory portable
    to any ANSI C compiler the Libero sources are
    part of the package.

3
Rationale Why Code Generator? Laziness The
quality that makes you go to great effort to
reduce overall energy expenditure. It makes you
write labour-saving programs that other people
will find useful, and document what you wrote so
you don't have to answer so many questions about
it. Hence the first great virtue of a
programmer." Larry Wall Programming Perl, Larry
Wall and Randal. L. Schwartz, 1992 O'Reilly
Associates, Inc., page 426.
Example of Using a Telephone Slide 6
4
  • The Component Parts of Libero
  • You need to write a functional description of
    your application in a special form, known as a
    Libero Dialog we will present a simple example
    shortly. There is even a Visual Basic program
    provided with Libero which helps you construct
    dialog files for your application. However it is
    even easier to do in a simple text editor!
  • The Libero Dialog describes how the elements of
    a Libero state machine are tied together to
    implement your application. The main elements
    are
  • States your application must be in one of a
    finite set of states.
  • Events each state can react to a set of
    events some events are common to all states and
    are handled by a Defaults module.
  • Modules Libero executes a number of program
    modules in response to an event it generates
    stub code you need to write the function which
    implements each module.
  • Transitions after a set of modules runs in
    response to a particular event, Libero makes a
    transition into a new state.

5
  • The Dialog File Syntax
  • The dialog file defines a series of states the
    first state in the dialog is the starting state,
    and the remaining states can come in any order.
    You cannot define the same state twice. A state
    carries a name, which is purely for your (the
    reader's) information. A state allows one or more
    events. The ordering of events within a state is
    not important. Each event looks like this
  • (--) Event-Name -gt
    Next-State-Name
  • Module-To-Execute
  • Module-To-Execute
  • ...
  • The module list is executed when that event
    occurs in the state. The module list can be
    empty.
  • The next state name can be blank, meaning 'the
    current state'. Otherwise the next state name
    refers to another state within the dialog,
    excluding the initial starting state.
  • The module names correspond to functions, blocks,
    procedures, etc. in the program.
  • The program always refers to events by adding the
    suffix '-Event'. Thus, if a dialog refers to an
    event 'Ok', the program will refer to 'Ok-Event'.
  • An event name 'other' is taken to mean 'all
    other events'. This is shorthand for typing all
    other events in the dialog any event you did not
    already handle in the state gets the 'other'
    handling.

6
Example of Using a Telephone Slide 1 In a more
technical example, we'll model the steps we take
in using making a telephone call. By convention,
the first state is After-Init. Another convention
is to use Terminate-The-Program to halt the
dialog. After initialisation (I would recommend a
good coffee or a decent beer, depending on the
time of day), we pick-up the handset, and listen
to the dialing tone. After-Init (--) Ok
-gt Want-Dialing-Tone
Pick-Up-Telephone-Handset
Listen-For-Dialing-Tone (--) Error
-gt Terminate-The-Program
7
  • Example of Using a Telephone Slide 2
  • This leads us to the state Want-Dialing-Tone.
    Here we handle each of the possible events
    produced by Listen-For-Dialing-Tone. Let's look
    at these in detail
  • Ok We have a dialing tone, so we can dial the
    number. This is the normal, expected event.
  • Silent, no tone The telephone exchange is having
    a hard day, or someone unplugged the phone. Or
    maybe a ninja attack team has cut the phone
    cables and is at this moment sneaking up the
    stairs and AAAARGH... In this simple example we
    loop forever in a real program we would allow a
    limited number of attempts.
  • Voices on the line Some other member of the
    household is making the phone company richer. We
    apologise and forget it.
  • Modem noise - the young bro' is downloading some
    more bootleg GIF's.

8
Example of Using a Telephone Slide 3a We give
each of these events a short snappy name and list
them in a reasonable order. Like a 'case'
statement, the actual order makes no difference
to the machine, but helps the person reading the
dialog. Typically we put the most frequent or
expected events first, with the more bizarre ones
at the end. Each event provokes one or more
actions that correspond to modules of code. A
module can be a function, procedure, subroutine,
paragraph, etc., depending on the programming
language. A module is where you do the real work.
9
Example of Using a Telephone Slide 3b So now
our Want-Dialing-Tone state looks like
this Want-Dialing-Tone (--) Ok
-gt Want-Ringing-Tone
Dial-Required-Number
Listen-For-Ringing-Tone (--) Silent
-gt Want-Dialing-Tone
Put-Down-Telephone-Handset
Pick-Up-Telephone-Handset
Listen-For-Dialing-Tone (--) Voices
-gt Apologise-Telephone-Busy
Put-Down-Telephone-Handset
Terminate-The-Program (--) Modem
-gt Put-Down-Telephone-Hands
et Apologise-Cutting-Modem
Terminate-The-Program
10
Example of Using a Telephone Slide 4 Here we
are waiting for a ringing tone. We can reuse some
of the event names - Ok, Silence, Voices - from
the previous state. This makes the generated code
smaller, and is nice for the reader, since there
are fewer names to remember Want-Ringing-Tone
(--) Ok -gt
Want-Answer Listen-For-Answer
(--) Silence -gt
Want-Dialing-Tone Put-Down-Telephone-H
andset Pick-Up-Telephone-Handset
Listen-For-Dialing-Tone (--) Engaged
-gt After-Engaged
Put-Down-Telephone-Handset
Consider-Trying-Again (--) Voices
-gt Want-Dialing-Tone
Complain-Crossed-Connection
Put-Down-Telephone-Handset
Pick-Up-Telephone-Handset
Listen-For-Dialing-Tone
11
Example of Using a Telephone Slide 5 The next
state has an event, Doorbell, that is not
produced by any previous module, but that can
happen at any time. We call this an exception
event, and we add the handling for it in the
state where it can happen Want-Answer (--)
Ok -gt
Have-Conversation Put-Down-Telephone-H
andset Terminate-The-Program (--)
Wrong-Number -gt
Apologise-Wrong-Number
Put-Down-Telephone-Handset
Terminate-The-Program (--) Impatient
-gt Put-Down-Telephone-Handset
Terminate-The-Program (--)
Answering-Machine -gt Have-Answering-Mach
ine Consider-Leaving-Message (--)
Modem-Or-Fax Put-Down-Telephone-Handse
t Terminate-The-Program (--)
Doorbell -gt
End-Conversation-Quickly
Put-Down-Telephone-Handset
Terminate-The-Program
12
Example of Using a Telephone Slide 6 There
are two final states we need to describe for
completeness After-Engaged (--) Ok
-gt Want-Ringing-Tone
Dial-Required-Number
Listen-For-Ringing-Tone (--) Impatient
-gt Put-Down-Telephone-Hands
et Terminate-The-Program Have-Answeri
ng-Machine (--) Message
-gt Leave-The-Message
Put-Down-Telephone-Handset
Terminate-The-Program (--) Impatient
-gt Put-Down-Telephone-Handset
Terminate-The-Program
13
Example of Using a Telephone Slide 7
Finally, the Defaults state is special we
never come here explicitly. Rather, the state
holds events that are implicitly valid in any
other state. Here we say that whenever the
Doorbell event strikes, we put the phone down and
beat it doorwards. Note that the Doorbell event
is handled explicitly in Want-Answer - the action
in that state is a little different from the
other states. Defaults (--) Doorbell
-gt Put-Down-Telephone-Hands
et Terminate-The-Program
14
  • Serious Stuff Events and Names
  • Now I want to show how an action module
    'produces' an event.
  • Libero provides a standard variable called
    The-Next-Event. An event like 'Ok' is actually
    called Ok-Event in the program (Libero tacks-on
    '-Event' for you). This is how you would set
    The-Next-Event in various languages
  • C/C the_next_event ok_event
  • 80x86 assembler mov the_next_event,ok_event
  • UNIX Korn Shell the_next_eventok_event
  • Perl the_next_event ok_event
  • COBOL MOVE OK-EVENT TO THE-NEXT-EVENT
  • Visual Basic the_next_event ok_event
  • Libero applies this rule at least one of the
    action modules for an event must supply a value
    for The-Next-Event. If no value for
    The-Next-Event is supplied, the dialog halts with
    some kind of error message.

15
Generating Source Code For Phone.c When I take
the above dialog (called phone.l), and give it to
Libero, this is what happens C\CTOOLS\LIBEROgtlr
phone LIBERO v2.11 (c) 1991-96 by Pieter A.
Hintjens lr I processing 'phone.l'... lr I
creating skeleton program phone.c... lr I
building phone.d... lr I building phone.i...
lr I Building stub for have dialed digit lr I
Building stub for reset dialed number lr I
Building stub for send outgoing release lr I
Building stub for send outgoing request lr I
Building stub for start busy tone lr I Building
stub for start dial tone lr I Building stub for
start released tone lr I Building stub for
start ringing local lr I Building stub for
start ringing remote lr I Building stub for
stop local tones lr I Building stub for stop
ringing local lr I Building stub for stop
ringing remote lr I Building stub for wait for
incoming message C\CTOOLS\LIBEROgt
16
Comments on Source Code Generation Libero
assumes that I want to make a program called
phone.c. Since this file does not exist, it
creates a skeleton program for me. This only
happens the first time. Once the program is
created, Libero will add missing pieces to it, at
the end, but will never change it again
otherwise. I get two other files as well,
phone.d and phone.i. These are the data and
interpreter for my dialog. I need these files to
compile phone.c. Each time I run Libero, it
recreates these two files. If I was working in
another language, I would get different files,
with different extensions. The default language
is C. (We will do a complete example for a
digital camera, shortly)
17
  • Advanced Features Supported by Libero
  • 1. Exception Events (like Software Interrupts)
  • The dialog normally executes all the action
    modules for an event-in-state, one by one, then
    switches to the next state for the event.
  • An exception interrupts this flow. The dialog
    handles exceptions in two steps
  • It checks Exception-Raised after executing each
    module. It this variable has become 'true', it
    stops and checks the value of The-Exception-Event.
  • It looks for The-Exception-Event in the current
    state (or Defaults), then executes the action
    modules for that event. These modules can in turn
    raise an exception.
  • When a module raises an exception, the dialog
    does not care what the next state was supposed to
    be. This is no longer important, since the
    exception event will determine its own next state.

18
2. The Defaults State (Handling Common
Events) You can define a single Defaults state in
any dialog. You use this state to simplify
dialogs. Often, the same event can happen in
many states, with the same effect. Typically, you
want to handle a fatal error at any point by
displaying a message and halting the program.
Rather than repeating the event and its
(identical) actions in every state where the
fatal error may happen, place it in Defaults. If
the event ever happens, Libero looks in the
current state first. If it cannot find the event
there it looks in the Defaults state. The
Defaults state is ideal for error exception
events that require central handling. After
processing the actions for the event, the dialog
sets the next state as follows if the specified
next state is empty, it returns to the original
state. If some next state is specified, it goes
to that state. When you use a Defaults state,
the generated code for your dialog does not get
smaller. It will actually get a little larger.
But your dialog source code can usually be
simplified, and this is always a good idea.
19
3 Using Get-External-Event The
Get-External-Event module is empty in most types
of program, and very important in other ones.
This module lets you centralise any kind of
interface to the outside world that collects
events. In the context of Digital Camera firmware
design this could be the interface between the
microcontroller and the main DSP CPU. Thus we
could put the code which handles events generated
by this external interface into the
Get-external-event module in a Libero state
machine. 4 Sub-Dialogs Libero supports a simple
state call/return mechanism. This lets you build
sub-dialogs that are called from other places in
the dialog. In the 'calling' state, use the
action Dialog-Call to call the sub-dialog
state Calling-State (--) Ok
-gt Sub-State
Do-Some-Normal-Work Dialog-Call
(--) Return -gt Next-State
Continue-After-Call The Return event
controls what happens when the sub-state returns.
The Return event can be in the same state, or in
the Defaults state.
20
A Simple Camera Design with Libero In this
section we present a simple camera design, based
loosely on the PD3 state machine design. Some
modifications, including the addition of a
low-level Take Picture are intended to illustrate
how a multi-level state machine design might be
effected using Libero. Note that the goal here
is not to present a real working camera design,
but rather to get the reader thinking about how
Libero might be used to express such a camera
design. Thus the example is not a very thorough
or robust design and is likely to have some
obvious faux-pas.
21
The Main Dialog The Main Libero dialog file for
this design is presented in Appendix A1 and the
additional Take Picture dialog is in Appendix A2.
The Main dialog was modified from the principle
PD3 state machine to explicitly take account of
the mode the camera is in. Thus the starting, or
After-Init state will already have a camera-mode
event generated by the initialization code
After-Init (--) Mode-Is-Record
-gt Normal-Record-Mode
Display-Status Set-Default-Resolution
Blank-Display (--)
Mode-Is-Playback -gt
Normal-Playback-Mode
Display-Last-Image Display-No-Of-Last-
Image (--) Mode-Is-Erase
-gt Main-Erase-Menu Display-Erase-Menu
(--) Mode-Is-Setup -gt
Normal-Setup-Mode Load-Current-Setting
s Display-Setup-Menu (--)
Mode-Is-Pc -gt
Normal-Pc-Mode Display-Mode-Select-Men
u (--) Mode-Is-Unknown -gt
Terminate-The-Program Note that some
modes go directly to the appropriate menus but
the main record and playback modes go into active
states which display pictures on the LCD. As the
list of menus and sub-menus is quite extensive we
have not written all of these explicitly.
22
Normal-Record-Mode (--) Shutter-Keypress
-gt Normal-Record-Mode
Take-Picture Decrement-Image-Number
(--) Up-Keypress -gt
Normal-Record-Mode Toggle-Live-Image-M
ode Display-Live-Image-Mode-If-Active
(--) Down-Keypress -gt
Normal-Record-Mode Toggle-Zoom-Mode
Display-Zoom-Mode-If-Active
Display-Normal-Mode-If-Inactive (--)
Enter-Keypress -gt
Main-Record-Menu Show-Record-Menu
(--) Mode-Change -gt
Reset-Current-Image-No Main-Record-Menu
(--) Zoom-In-Keypress -gt
Main-Record-Menu Highlight-Next-Lower-
Menu-Item (--) Zoom-Out-Keypress
-gt Main-Record-Menu
Highlight-Next-Highter-Menu-Item (--)
Down-Keypress -gt
Normal-Record-Mode Undisplay-Record-Me
nu (--) Enter-Keypress -gt
Record-Submenu Select-Menu-Item
(--) Mode-Change -gt
Reset-Current-Image-No
23
Normal-Playback-Mode (--) Zoom-In-Keypress
-gt Normal-Playback-Mode
Decrement-Image-No
Display-Current-Image (--) Zoom-Out-Keypress
-gt Normal-Playback-Mode
Increment-Image-No
Display-Current-Image (--) Down-Keypress
-gt Normal-Playback-Mode
Toggle-Display-Format (--) Mode-Change
-gt
Reset-Current-Image-No Main-Erase-Menu (--)
Zoom-In-Keypress -gt
Main-Erase-Menu Set-Erase-Current-Imag
e (--) Zoom-Out-Keypress -gt
Main-Erase-Menu Set-Erase-All-Images
(--) Enter-Keypress-In-Erase-All-Mode -gt
Erase-All-Menu Display-Erase-All-Menu
(--) Enter-Keypress-In-Erase-Current -gt
Erase-Current-Menu Display-Erase-Curre
nt-Menu (--) Mode-Change
-gt Reset-Current-Image-No
24
Defaults (--) Mode-Change-To-Record
-gt Normal-Record-Mode
Display-Status Set-Default-Resolution
Blank-Display (--)
Mode-Change-To-Playback -gt
Normal-Playback-Mode
Display-Last-Image Display-No-Of-Last-
Image (--) Mode-Change-To-Erase
-gt Main-Erase-Menu Display-Erase-Menu
(--) Mode-Change-To-Setup -gt
Normal-Setup-Mode Load-Current-Setting
s Display-Setup-Menu (--)
Mode-Change-To-Pc -gt
Normal-Pc-Mode Display-Mode-Select-Men
u (--) Exception-Cf-Not-Formatted -gt
Normal-Record-Mode Format-Cf (--)
Exception-Lens-Cap-Not-Removed -gt
Normal-Record-Mode Display-Lens-Cap-Wa
rning (--) Exception-Media-Not-Ready
-gt Normal-Record-Mode
Display-No-Media-Warning (--) Other-Exception
-gt
Take-Required-Actions
25
The Take Picture Dialog This dialog was added to
try and illustrate how more low-level processes
might also be designed using a state-machine
approach. As the authors are still becoming
familiar with the operation of the existing
Raptor firmware much of this dialog design is
speculative. However engineers who are more
familiar with the exact sequence of the
picture-taking process should easily be able to
implement a more accurate dialog. Again, the goal
is to get people thinking. The Take Picture
program module appears in the Main dialog as part
of the Normal-Record-Mode state see below. It
is activated when a Shutter-Keypress event
occurs. Normal-Record-Mode (--)
Shutter-Keypress -gt
Normal-Record-Mode Take-Picture
Decrement-Image-Number (--) Up-Keypress
-gt Normal-Record-Mode
Toggle-Live-Image-Mode
Display-Live-Image-Mode-If-Active (--)
Down-Keypress -gt
Normal-Record-Mode Toggle-Zoom-Mode
Display-Zoom-Mode-If-Active
Display-Normal-Mode-If-Inactive (--)
Enter-Keypress -gt
Main-Record-Menu Show-Record-Menu
(--) Mode-Change -gt
Reset-Current-Image-No However the Take
Picture process could also be describe using a
Libero sub-dialog as mentioned in Section 2.3.4
above. This is why we have expanded this program
module into a much more granular Take Picture
dialog, Appendix A2.
26
Simple Camera Take-Picture Dialog The first step
is to do pre-capture initialization the camera
will already have a parameter set to indicate
what picture-taking mode it is operation in
full Auto, Flash, No Flash or a pre-selected
Scene mode. In Auto mode the camera must enter a
special state to estimate optimum parameter
settings in all other modes it can proceed
directly to the Caputring-Image
state Pre-Capture-Initializaton (--)
Auto-Capture -gt
Determine-Auto-Cap-Params
Reset-Frame-Count Get-Frame (--)
Flash-Capture -gt Capturing-Image
Enable-Strobe (--)
No-Flash-Capture -gt Capturing-Image
Disable-Strobe (--) Scene-Capture
-gt Capturing-Image
Load-Scene-Capture-Parameters
27
Determine-Auto-Cap-Params (--)
Poor-Luminence -gt
Determine-Auto-Cap-Params
Correct-Luminence Increment-Frame-Coun
t Get-Frame (--)
Poor-White-Balance -gt
Determine-Auto-Cap-Params
Correct-White-Balance
Increment-Frame-Count Get-Frame
(--) Poor-Gamma -gt
Determine-Auto-Cap-Params
Correct-Gamma Increment-Frame-Count
Get-Frame (--) Poor-Histogram
-gt Determine-Auto-Cap-Params
Correct-Histogram Increment-Frame-Coun
t Get-Frame (--) Image-Quality-Ok
-gt Capturing-Image
Set-Auto-Cap-Params (--) Frame-Count-Exceeded
-gt Return Raise-Frame-Count-E
xceeded-Exception
28
Capturing-Image (--) Params-Ok
-gt Pre-Processing-Image
Power-Up-Peripherals Load-Ptg-Map
Load-Fcp Fire-Strobe-If-Enable
d Get-Image
Check-White-Balance Check-Gamma
Check-Histogram Pre-Processing-Image
(--) White-Balance-Is-Poor -gt
Pre-Processing-Image
Adjust-White-Balance (--) Gamma-Is-Poor
-gt Pre-Processing-Image
Adjust-Gamma (--) Histogram-Is-Poor
-gt Pre-Processing-Image
Adjust-Histogram (--) Image-Quality-Is-Bad
-gt Capturing-Image
Increment-Capture-Count
Adjust-Params-To-Compensate (--)
Image-Quality-Is-Ok -gt
Post-Processing-Image Power-Up-Itp
Load-Itp
29
Post-Processing-Image (--)
Mode-Is-Raw-Capture -gt Return
Open-File Write-Itp
Close-File (--) Mode-Is-Jpeg-Capture
-gt Return Itp-Convert-To-Jpeg
Open-File
Write-Jpeg-Headers Write-Thumbnail
Write-Itp Close-File
(--) Mode-Is-Auto-Red-Eye -gt
Return Itp-Auto-Red-Eye
Itp-Convert-To-Jpeg Open-File
Write-Jpeg-Headers
Write-Thumbnail Write-Itp
Close-File
30
And Dont Forget Return Defaults States!
Return (--) Capture-Ok
-gt Go-Back-To-Calling-State Defau
lts (--) Max-Capture-Count-Exceeded
-gt Return Display-Error-Message
31
Libero Code Generation Data File - States
enum _LR_defaults_state 11,
_LR_STATE_after_init 0, _LR_STATE_normal_rec
ord_mode 1, _LR_STATE_main_record_menu
2, _LR_STATE_record_submenu 3,
_LR_STATE_record_sub_submenu 4,
_LR_STATE_normal_playback_mode 5,
_LR_STATE_main_erase_menu 6,
_LR_STATE_erase_all_menu 7,
_LR_STATE_erase_current_menu 8,
_LR_STATE_normal_setup_mode 9,
_LR_STATE_normal_pc_mode 10,
_LR_STATE_defaults 11
32
Libero Code Generation Data File -Events
enum terminate_event -1,
down_keypress_event 0, enter_keypress_event
1, enter_keypress_in_erase_all_mode_event
2, enter_keypress_in_erase_current_event
3, exception_cf_not_formatted_event 4,
exception_lens_cap_not_removed_event 5,
exception_media_not_ready_event 6,
mode_change_event 7, mode_change_to_erase_ev
ent 8, mode_change_to_pc_event 9,
mode_change_to_playback_event 10,
mode_change_to_record_event 11,
mode_change_to_setup_event 12,
mode_is_erase_event 13, mode_is_pc_event
14, mode_is_playback_event 15,
mode_is_record_event 16, mode_is_setup_event
17, mode_is_unknown_event 18,
null_event_event 19, other_exception_event
20, shutter_keypress_event 21,
up_keypress_event 22, zoom_in_keypress_event
23, zoom_out_keypress_event 24
33
Libero Code Generation Data File -Modules
ifndef MODULE define MODULE static void
/ Libero dialog modules
/ endif local raise_exception
(event_t event) MODULE initialise_the_program
(void) MODULE get_external_event
(void) MODULE blank_display
(void) MODULE cancel_erase_action
(void) MODULE decrement_current_image_no
(void) MODULE decrement_image_no
(void) MODULE decrement_image_number
(void) MODULE decrement_menu_variable_if_exists
(void) MODULE display_current_image
(void) MODULE display_last_image
(void) MODULE display_lens_cap_warning
(void) MODULE display_live_image_mode_if_active
(void) MODULE display_mode_select_menu
(void) MODULE display_no_media_warning
(void) MODULE display_no_of_last_image
(void) MODULE display_normal_mode_if_inactive
(void) MODULE display_record_menu
(void) MODULE display_setup_menu
(void) MODULE display_status
(void) MODULE display_zoom_mode_if_active
(void) MODULE erase_all_images
(void) MODULE erase_current_image
(void) MODULE format_cf
(void) ETC, ETC .
34
Libero Code Generation Data File -State Map
static dbyte _LR_nextst 25
0,0,0,0,0,0,0,0,0,0,0,0,0,6,10,5,1,9,0,0,0,0,0,0,0
, 1,2,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,
0,1,1,0,0 , 1,3,0,0,0,0,0,2,0,0,0,0,0,0,0,0
,0,0,0,0,0,0,0,2,2 , 2,4,0,0,0,0,0,3,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,3,3 ,
3,4,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,4
, 5,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,0,0
,0,0,5,5 , 0,0,7,8,0,0,0,6,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,6,6 , 0,0,0,0,0,0,0,7,0,0,0,0
,0,0,0,0,0,0,0,0,0,0,0,6,6 ,
6,8,0,0,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,8
, 0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,9,0
,0,0,0,0 , 0,0,0,0,0,0,0,10,0,0,0,0,0,0,0,0
,0,0,0,9,0,0,0,0,0 , 0,0,0,0,1,1,1,0,6,10,5
,1,9,0,0,0,0,0,0,0,11,0,0,0,0
35
Libero Code Generation Data File - Module
Execution Map
static dbyte _LR_action 25
0,0,0,0,0,0,0,0,0,0,0,0,0,3,5,2,1,4,6,0,0,0,0,0,0
, 9,10,0,0,0,0,0,11,0,0,0,0,0,0,0,0,0,0,0,0
,0,7,8,0,0 , 14,15,0,0,0,0,0,11,0,0,0,0,0,0
,0,0,0,0,0,0,0,0,0,12,13 ,
18,19,0,0,0,0,0,11,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1
6,17 , 18,19,0,0,0,0,0,11,0,0,0,0,0,0,0,0,0
,0,0,0,0,0,0,16,17 , 22,0,0,0,0,0,0,11,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,20,21 ,
0,0,25,26,0,0,0,11,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2
3,24 , 0,0,0,0,0,0,0,11,0,0,0,0,0,0,0,0,0,0
,0,0,0,0,0,27,28 , 28,31,0,0,0,0,0,11,0,0,0
,0,0,0,0,0,0,0,0,0,0,0,0,29,30 ,
0,0,0,0,0,0,0,11,0,0,0,0,0,0,0,0,0,0,0,32,0,0,0,0,
0 , 0,0,0,0,0,0,0,11,0,0,0,0,0,0,0,0,0,0,0,
32,0,0,0,0,0 , 0,0,0,0,33,34,35,0,3,5,2,1,4
,0,0,0,0,0,0,0,36,0,0,0,0
36
/------------------------------------------------
------------------- camera02.i - LIBERO
dialog interpreter for camera02.c.
Generated by LIBERO 2.30 on 7 Aug, 2002, 1447.
------------------------------
-------------------------------------/
_LR_state 0
/ First state is
always 0 / initialise_the_program ()
while (the_next_event ! terminate_event)
_LR_event the_next_event if
(_LR_event gt 25 _LR_event lt 0)
printf ("State d - event d is out of
range\n", _LR_state,
_LR_event) break
_LR_savest _LR_state _LR_index
_LR_action _LR_state_LR_event / If
no action for this event, try the defaults state
/ if (_LR_index 0)
_LR_state _LR_defaults_state
_LR_index _LR_action _LR_state_LR_event
if (_LR_index 0)
printf ("State d - event d is not
accepted\n", _LR_state,
_LR_event) break
the_next_event _LR_NULL_EVENT
the_exception_event _LR_NULL_EVENT
exception_raised FALSE
_LR_vecptr _LR_vector _LR_index
Libero Code Generation Dialog Interpreter
FOREVER if ((_LR_vecptr
_LR_STOP) (exception_raised))
break (_LR_module
_LR_vecptr) () if
(exception_raised) if
(the_exception_event ! _LR_NULL_EVENT)
_LR_event the_exception_event
the_next_event _LR_event
else _LR_state _LR_nextst
_LR_state_LR_event if (_LR_state
_LR_defaults_state) _LR_state
_LR_savest if (the_next_event
_LR_NULL_EVENT)
get_external_event () if
(the_next_event _LR_NULL_EVENT)
printf ("No event set after
event d in state d\n",
_LR_event, _LR_state) break
return
(feedback)
37
Where Does Libero Fit in Big Picture?
  • Not an RTOS, but very flexible
  • Not hard real-time, although could be modified
    for such a purpose it can generate 8086
    assembly language code, for example
  • If you read a bit more about iMatix tools you
    will learn about
  • SMT Symmetric Multi-Threading Kernel is a
    user-space kernel this make it really
    cross-platform although not hard real-time
  • SFL Standard Function Library is a large library
    of cross-platform functions optimized, but
    completely platform independent designed for use
    with SMT and Libero
  • When combined with Libero these provides a very
    sophisticated form of Functional Queue Scheduling
    system.
  • Using code-generation reduces error in large
    projects and allows engineers to see, and
    understand, the Big Picture.
  • Note that iMatix is not really an Embedded
    Systems consultancy more focussed on Enterprise
    Systems however toolset is flexible enough to be
    suitable for complex Embedded Systems designs.
Write a Comment
User Comments (0)
About PowerShow.com