Software Development for Embedded...
Transcript of Software Development for Embedded...
![Page 1: Software Development for Embedded Systemscse.unl.edu/~witty/class/embedded/material/note/software.pdfHardware Trends • Proliferation of complex embedded systems • powerful processors](https://reader034.fdocuments.us/reader034/viewer/2022042311/5ed8cd636714ca7f476897b4/html5/thumbnails/1.jpg)
Software Development for Embedded Systems
Witawas Srisa-anCSCE 496: Embedded Systems Design and
Implementation
1
![Page 2: Software Development for Embedded Systemscse.unl.edu/~witty/class/embedded/material/note/software.pdfHardware Trends • Proliferation of complex embedded systems • powerful processors](https://reader034.fdocuments.us/reader034/viewer/2022042311/5ed8cd636714ca7f476897b4/html5/thumbnails/2.jpg)
Reminder
• Homework on Gaussian Filter is due on Wednesday before 11:59 pm
• if you are having difficulties reading the provided image file, be sure to read the help page on fopen in the Stretch IDE
• Any questions about malloc?
2
2
![Page 3: Software Development for Embedded Systemscse.unl.edu/~witty/class/embedded/material/note/software.pdfHardware Trends • Proliferation of complex embedded systems • powerful processors](https://reader034.fdocuments.us/reader034/viewer/2022042311/5ed8cd636714ca7f476897b4/html5/thumbnails/3.jpg)
Hardware Trends• Proliferation of complex
embedded systems
• powerful processors
• feature-rich (e.g. Cell, Stretch, ARM)
• advanced runtime support
• similar features found in processors for desktop and server systems (e.g. MMU, multi-core, fast bus, etc.)
3
3
![Page 4: Software Development for Embedded Systemscse.unl.edu/~witty/class/embedded/material/note/software.pdfHardware Trends • Proliferation of complex embedded systems • powerful processors](https://reader034.fdocuments.us/reader034/viewer/2022042311/5ed8cd636714ca7f476897b4/html5/thumbnails/4.jpg)
Hardware Trends
• We are reaping the major benefit of Moore’s law
• old processors don’t go away
• powerful enough for day-to-day applications
• very low cost
4
4
![Page 5: Software Development for Embedded Systemscse.unl.edu/~witty/class/embedded/material/note/software.pdfHardware Trends • Proliferation of complex embedded systems • powerful processors](https://reader034.fdocuments.us/reader034/viewer/2022042311/5ed8cd636714ca7f476897b4/html5/thumbnails/5.jpg)
Hardware Trends
• We are reaping the major benefit of Moore’s law
• old processors don’t go away
• powerful enough for day-to-day applications
• very low cost
4
4
![Page 6: Software Development for Embedded Systemscse.unl.edu/~witty/class/embedded/material/note/software.pdfHardware Trends • Proliferation of complex embedded systems • powerful processors](https://reader034.fdocuments.us/reader034/viewer/2022042311/5ed8cd636714ca7f476897b4/html5/thumbnails/6.jpg)
Hardware Trends
• We are reaping the major benefit of Moore’s law
• old processors don’t go away
• powerful enough for day-to-day applications
• very low cost
4
4
![Page 7: Software Development for Embedded Systemscse.unl.edu/~witty/class/embedded/material/note/software.pdfHardware Trends • Proliferation of complex embedded systems • powerful processors](https://reader034.fdocuments.us/reader034/viewer/2022042311/5ed8cd636714ca7f476897b4/html5/thumbnails/7.jpg)
Hardware Trends
• We are reaping the major benefit of Moore’s law
• old processors don’t go away
• powerful enough for day-to-day applications
• very low cost
4
4
![Page 8: Software Development for Embedded Systemscse.unl.edu/~witty/class/embedded/material/note/software.pdfHardware Trends • Proliferation of complex embedded systems • powerful processors](https://reader034.fdocuments.us/reader034/viewer/2022042311/5ed8cd636714ca7f476897b4/html5/thumbnails/8.jpg)
Software Trends
• Complex software systems
• why not? The hardware can handle it!
• Avionic Software for Boeing ScanEagle UAV > 300,000 line of code
5
5
![Page 9: Software Development for Embedded Systemscse.unl.edu/~witty/class/embedded/material/note/software.pdfHardware Trends • Proliferation of complex embedded systems • powerful processors](https://reader034.fdocuments.us/reader034/viewer/2022042311/5ed8cd636714ca7f476897b4/html5/thumbnails/9.jpg)
Software Trends
• Feature-rich runtime support
• full-fledged desktop/server operating systems in embedded devices
• capability to run more complex software systems on these machines
6
6
![Page 10: Software Development for Embedded Systemscse.unl.edu/~witty/class/embedded/material/note/software.pdfHardware Trends • Proliferation of complex embedded systems • powerful processors](https://reader034.fdocuments.us/reader034/viewer/2022042311/5ed8cd636714ca7f476897b4/html5/thumbnails/10.jpg)
Software Trends• Leverage mobile/
embedded devices to provide services
• Telesensing from Lucent
• prevent Sudden Infant Death Syndrome, detect sleep apnea, etc.
• Full-fledged web browsers, calendars, file servers, etc.
7
7
![Page 11: Software Development for Embedded Systemscse.unl.edu/~witty/class/embedded/material/note/software.pdfHardware Trends • Proliferation of complex embedded systems • powerful processors](https://reader034.fdocuments.us/reader034/viewer/2022042311/5ed8cd636714ca7f476897b4/html5/thumbnails/11.jpg)
Software Trends
• Assume heterogeneous platforms
• the billionth handset shipped in 2006
• build for portability
• build for generic input/output devices
• about 20+ operating systems for these devices
• build to interface with underlying runtime support features
8
8
![Page 12: Software Development for Embedded Systemscse.unl.edu/~witty/class/embedded/material/note/software.pdfHardware Trends • Proliferation of complex embedded systems • powerful processors](https://reader034.fdocuments.us/reader034/viewer/2022042311/5ed8cd636714ca7f476897b4/html5/thumbnails/12.jpg)
Software Trends
• Summary
• large software systems now and larger in the future
• more software reuse?
• assume heterogeneous platforms
• must be portable
• providing similar runtime features to much more complex systems
9
9
![Page 13: Software Development for Embedded Systemscse.unl.edu/~witty/class/embedded/material/note/software.pdfHardware Trends • Proliferation of complex embedded systems • powerful processors](https://reader034.fdocuments.us/reader034/viewer/2022042311/5ed8cd636714ca7f476897b4/html5/thumbnails/13.jpg)
Enabling Technologies
• Modern programming languages (e.g. Java, C#, VB.NET)
• Object-oriented paradigm
• promote code reuse
• Virtual Machine (VM) based systems
• achieve portability but require complex runtime support
• now available in many embedded devices
10
10
![Page 14: Software Development for Embedded Systemscse.unl.edu/~witty/class/embedded/material/note/software.pdfHardware Trends • Proliferation of complex embedded systems • powerful processors](https://reader034.fdocuments.us/reader034/viewer/2022042311/5ed8cd636714ca7f476897b4/html5/thumbnails/14.jpg)
Virtual Machines
“A virtual machine is software that creates a virtualized environment between the computer platform and its operating system, so that the end user can operate software on an abstract machine.”
Wikipedia
11
11
![Page 15: Software Development for Embedded Systemscse.unl.edu/~witty/class/embedded/material/note/software.pdfHardware Trends • Proliferation of complex embedded systems • powerful processors](https://reader034.fdocuments.us/reader034/viewer/2022042311/5ed8cd636714ca7f476897b4/html5/thumbnails/15.jpg)
Java Virtual Machines
“A Java Virtual Machine (JVM) is virtual machine that interprets and executes Java bytecode. This code is most often generated by Java language compilers...”
Wikipedia
12
12
![Page 16: Software Development for Embedded Systemscse.unl.edu/~witty/class/embedded/material/note/software.pdfHardware Trends • Proliferation of complex embedded systems • powerful processors](https://reader034.fdocuments.us/reader034/viewer/2022042311/5ed8cd636714ca7f476897b4/html5/thumbnails/16.jpg)
Java Virtual Machines
• We’ll look at the ones developed mainly by Sun Microsystems
• HotSpot
• CLDC HotSpot
• KVM (Kilo Virtual Machine)
• second most used VM in the world
13
13
![Page 17: Software Development for Embedded Systemscse.unl.edu/~witty/class/embedded/material/note/software.pdfHardware Trends • Proliferation of complex embedded systems • powerful processors](https://reader034.fdocuments.us/reader034/viewer/2022042311/5ed8cd636714ca7f476897b4/html5/thumbnails/17.jpg)
Java Virtual Machines
• We’ll look at the ones developed mainly by Sun Microsystems
• HotSpot
• CLDC HotSpot
• KVM (Kilo Virtual Machine)
• second most used VM in the world
14
Trivia: What is the most used VM developed by Sun?
14
![Page 18: Software Development for Embedded Systemscse.unl.edu/~witty/class/embedded/material/note/software.pdfHardware Trends • Proliferation of complex embedded systems • powerful processors](https://reader034.fdocuments.us/reader034/viewer/2022042311/5ed8cd636714ca7f476897b4/html5/thumbnails/18.jpg)
Java Virtual Machines
• KVM vs. HotSpot
• KVM is interpretation based
• maximum portability
• HotSpot combines interpretation and dynamic compilation
• platform dependent
15
15
![Page 19: Software Development for Embedded Systemscse.unl.edu/~witty/class/embedded/material/note/software.pdfHardware Trends • Proliferation of complex embedded systems • powerful processors](https://reader034.fdocuments.us/reader034/viewer/2022042311/5ed8cd636714ca7f476897b4/html5/thumbnails/19.jpg)
Sidebar: Dynamic Compilation
• Interpreter is a big while loop with many case statements
• each bytecode is translated to a predefine C/C+ function (e.g. new operator)
• Dynamic compiler takes each method and generates native code
• can be optimized or non-optimized
16
16
![Page 20: Software Development for Embedded Systemscse.unl.edu/~witty/class/embedded/material/note/software.pdfHardware Trends • Proliferation of complex embedded systems • powerful processors](https://reader034.fdocuments.us/reader034/viewer/2022042311/5ed8cd636714ca7f476897b4/html5/thumbnails/20.jpg)
Sidebar: Dynamic Compilation
• Compilation strategies
• always compile (e.g. .NET Compact Framework, Jikes RVM)
• only compile frequently used methods
• Code size
• a compiled method can be 6 to 8 times larger than its bytecode representation
17
17
![Page 21: Software Development for Embedded Systemscse.unl.edu/~witty/class/embedded/material/note/software.pdfHardware Trends • Proliferation of complex embedded systems • powerful processors](https://reader034.fdocuments.us/reader034/viewer/2022042311/5ed8cd636714ca7f476897b4/html5/thumbnails/21.jpg)
Sidebar: Dynamic Compilation
• Storage
• these compiled methods are stored in a dynamic memory region
• separate code-cache or intermingled with objects in the heap
• Management strategies
• flush when full, GC, etc.
18
18
![Page 22: Software Development for Embedded Systemscse.unl.edu/~witty/class/embedded/material/note/software.pdfHardware Trends • Proliferation of complex embedded systems • powerful processors](https://reader034.fdocuments.us/reader034/viewer/2022042311/5ed8cd636714ca7f476897b4/html5/thumbnails/22.jpg)
Java Virtual Machines
• KVM vs. HotSpot
• KVM uses simple mark-sweep-compact garbage collection
• simple but long execution pauses
• HotSpot uses generational garbage collection
• more complex with higher runtime overhead, but shorter pauses
19
19
![Page 23: Software Development for Embedded Systemscse.unl.edu/~witty/class/embedded/material/note/software.pdfHardware Trends • Proliferation of complex embedded systems • powerful processors](https://reader034.fdocuments.us/reader034/viewer/2022042311/5ed8cd636714ca7f476897b4/html5/thumbnails/23.jpg)
Sidebar: Garbage Collection
“Garbage Collection (GC) is a form of automatic memory management. The garbage collector attempts to reclaim garbage, or memory used by objects that will never again be accessed or mutated by the application.”
Wikipedia20
20
![Page 24: Software Development for Embedded Systemscse.unl.edu/~witty/class/embedded/material/note/software.pdfHardware Trends • Proliferation of complex embedded systems • powerful processors](https://reader034.fdocuments.us/reader034/viewer/2022042311/5ed8cd636714ca7f476897b4/html5/thumbnails/24.jpg)
Sidebar: Garbage Collection
• Copying collector
• split the heap in half, only one half is used each time
• when the half is full, migrate surviving objects to the other half then allocate new objects from there
A
BC
D
TO
FROM
ROOT SET
21
21
![Page 25: Software Development for Embedded Systemscse.unl.edu/~witty/class/embedded/material/note/software.pdfHardware Trends • Proliferation of complex embedded systems • powerful processors](https://reader034.fdocuments.us/reader034/viewer/2022042311/5ed8cd636714ca7f476897b4/html5/thumbnails/25.jpg)
Sidebar: Garbage Collection
• Copying collector
• split the heap in half, only one half is used each time
• when the half is full, migrate surviving objects to the other half then allocate new objects from there
A
BC
D
FROM
TO
ROOT SET
21
21
![Page 26: Software Development for Embedded Systemscse.unl.edu/~witty/class/embedded/material/note/software.pdfHardware Trends • Proliferation of complex embedded systems • powerful processors](https://reader034.fdocuments.us/reader034/viewer/2022042311/5ed8cd636714ca7f476897b4/html5/thumbnails/26.jpg)
Sidebar: Garbage Collection
• Copying collector
• split the heap in half, only one half is used each time
• when the half is full, migrate surviving objects to the other half then allocate new objects from there
A
BC
D
A
FROM
TO
ROOT SET
21
21
![Page 27: Software Development for Embedded Systemscse.unl.edu/~witty/class/embedded/material/note/software.pdfHardware Trends • Proliferation of complex embedded systems • powerful processors](https://reader034.fdocuments.us/reader034/viewer/2022042311/5ed8cd636714ca7f476897b4/html5/thumbnails/27.jpg)
Sidebar: Garbage Collection
• Copying collector
• split the heap in half, only one half is used each time
• when the half is full, migrate surviving objects to the other half then allocate new objects from there
A
BC
D
A B
FROM
TO
ROOT SET
21
21
![Page 28: Software Development for Embedded Systemscse.unl.edu/~witty/class/embedded/material/note/software.pdfHardware Trends • Proliferation of complex embedded systems • powerful processors](https://reader034.fdocuments.us/reader034/viewer/2022042311/5ed8cd636714ca7f476897b4/html5/thumbnails/28.jpg)
Sidebar: Garbage Collection
• Copying collector
• split the heap in half, only one half is used each time
• when the half is full, migrate surviving objects to the other half then allocate new objects from there
A
BC
D
A B C
FROM
TO
ROOT SET
21
21
![Page 29: Software Development for Embedded Systemscse.unl.edu/~witty/class/embedded/material/note/software.pdfHardware Trends • Proliferation of complex embedded systems • powerful processors](https://reader034.fdocuments.us/reader034/viewer/2022042311/5ed8cd636714ca7f476897b4/html5/thumbnails/29.jpg)
Sidebar: Garbage Collection
• Copying collector
• split the heap in half, only one half is used each time
• when the half is full, migrate surviving objects to the other half then allocate new objects from there
A
BC
D
A B DC
FROM
TO
ROOT SET
21
21
![Page 30: Software Development for Embedded Systemscse.unl.edu/~witty/class/embedded/material/note/software.pdfHardware Trends • Proliferation of complex embedded systems • powerful processors](https://reader034.fdocuments.us/reader034/viewer/2022042311/5ed8cd636714ca7f476897b4/html5/thumbnails/30.jpg)
Sidebar: Garbage Collection
• Copying collector
• split the heap in half, only one half is used each time
• when the half is full, migrate surviving objects to the other half then allocate new objects from there
A
BC
D
A B DC
FROM
TO
ROOT SET
21
21
![Page 31: Software Development for Embedded Systemscse.unl.edu/~witty/class/embedded/material/note/software.pdfHardware Trends • Proliferation of complex embedded systems • powerful processors](https://reader034.fdocuments.us/reader034/viewer/2022042311/5ed8cd636714ca7f476897b4/html5/thumbnails/31.jpg)
Sidebar: Garbage Collection
• Mark-sweep collector
• collect the entire heap each time
• when the heap is full, identify live objects (marking), then free dead objects (sweeping)
A B C D E F G
ROOT SET
HEAP
22
22
![Page 32: Software Development for Embedded Systemscse.unl.edu/~witty/class/embedded/material/note/software.pdfHardware Trends • Proliferation of complex embedded systems • powerful processors](https://reader034.fdocuments.us/reader034/viewer/2022042311/5ed8cd636714ca7f476897b4/html5/thumbnails/32.jpg)
Sidebar: Garbage Collection
• Mark-sweep collector
• collect the entire heap each time
• when the heap is full, identify live objects (marking), then free dead objects (sweeping)
A B C D E F G
ROOT SET
HEAP
22
22
![Page 33: Software Development for Embedded Systemscse.unl.edu/~witty/class/embedded/material/note/software.pdfHardware Trends • Proliferation of complex embedded systems • powerful processors](https://reader034.fdocuments.us/reader034/viewer/2022042311/5ed8cd636714ca7f476897b4/html5/thumbnails/33.jpg)
Sidebar: Garbage Collection
• Mark-sweep collector
• collect the entire heap each time
• when the heap is full, identify live objects (marking), then free dead objects (sweeping)
A B C D E F G
ROOT SET
HEAP
22
22
![Page 34: Software Development for Embedded Systemscse.unl.edu/~witty/class/embedded/material/note/software.pdfHardware Trends • Proliferation of complex embedded systems • powerful processors](https://reader034.fdocuments.us/reader034/viewer/2022042311/5ed8cd636714ca7f476897b4/html5/thumbnails/34.jpg)
Sidebar: Garbage Collection
• Mark-sweep collector
• collect the entire heap each time
• when the heap is full, identify live objects (marking), then free dead objects (sweeping)
A B C D E F G
ROOT SET
HEAP
22
22
![Page 35: Software Development for Embedded Systemscse.unl.edu/~witty/class/embedded/material/note/software.pdfHardware Trends • Proliferation of complex embedded systems • powerful processors](https://reader034.fdocuments.us/reader034/viewer/2022042311/5ed8cd636714ca7f476897b4/html5/thumbnails/35.jpg)
Sidebar: Garbage Collection
• Mark-sweep collector
• collect the entire heap each time
• when the heap is full, identify live objects (marking), then free dead objects (sweeping)
A B C D E F G
ROOT SET
HEAP
22
22
![Page 36: Software Development for Embedded Systemscse.unl.edu/~witty/class/embedded/material/note/software.pdfHardware Trends • Proliferation of complex embedded systems • powerful processors](https://reader034.fdocuments.us/reader034/viewer/2022042311/5ed8cd636714ca7f476897b4/html5/thumbnails/36.jpg)
Sidebar: Garbage Collection
• Mark-sweep collector
• collect the entire heap each time
• when the heap is full, identify live objects (marking), then free dead objects (sweeping)
A B E G
HEAP
ROOT SET
Free List
23
23
![Page 37: Software Development for Embedded Systemscse.unl.edu/~witty/class/embedded/material/note/software.pdfHardware Trends • Proliferation of complex embedded systems • powerful processors](https://reader034.fdocuments.us/reader034/viewer/2022042311/5ed8cd636714ca7f476897b4/html5/thumbnails/37.jpg)
Sidebar: Garbage Collection
• Mark-sweep-compact collector
• collect the entire heap each time
• similar to mark-sweep collector except that heap is compacted after sweeping
A B E G
HEAP
ROOT SET
Free List
24
24
![Page 38: Software Development for Embedded Systemscse.unl.edu/~witty/class/embedded/material/note/software.pdfHardware Trends • Proliferation of complex embedded systems • powerful processors](https://reader034.fdocuments.us/reader034/viewer/2022042311/5ed8cd636714ca7f476897b4/html5/thumbnails/38.jpg)
Java Virtual Machines• But typical JVMs are not ready for
deployment in realtime embedded systems
• lacking real-time support
• unpredictable execution of operations
• no support for real-time threads
• no priority inversion avoidance
• unbounded garbage collection
25
25
![Page 39: Software Development for Embedded Systemscse.unl.edu/~witty/class/embedded/material/note/software.pdfHardware Trends • Proliferation of complex embedded systems • powerful processors](https://reader034.fdocuments.us/reader034/viewer/2022042311/5ed8cd636714ca7f476897b4/html5/thumbnails/39.jpg)
Java Virtual Machines• But typical JVMs are not ready for
deployment in realtime embedded systems
• lacking real-time support
• unpredictable execution of operations
• no support for real-time threads
• no priority inversion avoidance
• unbounded garbage collection
26
These topics will be the focus of the next few lectures
26