Introduction to Tizen Platform - SKKU ESLAB | Embedded...
Transcript of Introduction to Tizen Platform - SKKU ESLAB | Embedded...
50
1
Embedded Software Lab. @ SKKU
전공핵심실습1:운영체제론Lecture 2. Tizen and Tizen Native App
Sungkyunkwan University
Embedded Software Lab.
Dongkun Shin
50
2
Embedded Software Lab. @ SKKU
1. Install Tizen SDK
2. Introduction to Tizen
1. Tizen Features, History, How to Contribute
2. Native/Web Framework
3. Tizen Kernel, Tizen Graphics/UI Framework (EFL)
3. Tizen SDK
1. Tizen IDE, Emulator, Simulator, SDB
2. Install Tizen SDK
4. Tizen Native App Development
1. Hello World
Contents
50
4
Embedded Software Lab. @ SKKU
• Samsung USB Driver
1. Go to Download Page and download Samsung USB Driver
1. http://developer.samsung.com/technical-doc/view.do?v=T000000117#none
• Java SDK 8
1. Go to Java SDK 8 download web pagehttp://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
2. Check “Accept License Agreement”
3. Download “Windows x86” or “Windows x64” as your computer’s architecture is
• Tizen 2.4 SDK
1. Download Tizen SDK Installer
1. Windows x86: http://download.tizen.org/sdk/Installer/tizen-sdk-2.4-rev4/tizen-web-ide_TizenSDK_2.4.0_Rev4_windows-32.exe
2. Windows x64: http://download.tizen.org/sdk/Installer/tizen-sdk-2.4-rev4/tizen-web-ide_TizenSDK_2.4.0_Rev4_windows-64.exe
• Mirror Site
– If the download speed is slow, download them from the following mirror site.
– http://nyx.skku.ac.kr/?page_id=667 ( Password: ______________ )
Download Required Programs Ahead
50
5
Embedded Software Lab. @ SKKU
1. Install Samsung USB Driver
1. Go to Download Page
1. http://developer.samsung.com/technical-doc/view.do?v=T000000117#none
2. Download Samsung USB Driver
3. Install the Samsung USB Driver
Install Samsung USB Driver
1
50
6
Embedded Software Lab. @ SKKU
2. Check Your Computer’s Architecture
1. 제어판 > 시스템 및 보안 > 시스템
2. Check if it is “x86 or x64”
3. Install Java SDK(JDK) 8
1. Go to Java SDK 8 download web pagehttp://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
2. Check “Accept License Agreement”
3. Download “Windows x86” or “Windows x64” as your computer’s architecture is
4. Execute the Java SDK Installer
Install Java SDK
1
2
50
7
Embedded Software Lab. @ SKKU
4. Install Tizen SDK 2.4
1. Download Tizen SDK Installer
1. Windows x86: http://download.tizen.org/sdk/Installer/tizen-sdk-2.4-rev4/tizen-web-ide_TizenSDK_2.4.0_Rev4_windows-32.exe
2. Windows x64: http://download.tizen.org/sdk/Installer/tizen-sdk-2.4-rev4/tizen-web-ide_TizenSDK_2.4.0_Rev4_windows-64.exe
2. Execute the Tizen SDK Installer
3. Change Install Location to ‘D:₩’ drive
Install Tizen 2.4 SDK
1
2
3
4
50
8
Embedded Software Lab. @ SKKU
4. Install Tizen SDK 2.4 (Cont’d)
4. Run “Tizen Update Manager”
5. Install 2.4 Mobile Packages
4. 2.4 Mobile > Emulator
5. 2.4 Mobile > Native app. development (IDE)
(It takes few minutes)
Install Tizen 2.4 SDK: Native App Development
1
2
50
10
Embedded Software Lab. @ SKKU
6. Making Tizen SDK Certificate
1. Window > Preferences
2. Preferences > Tizen SDK > Security Profiles
3. Click “Add” “OK”
Making Tizen SDK Certificate
1
23
Only in Z3 (Developer Mode)
If you want develop apps in commercial mode,install “Certificate Extension” additionally. (not covered in class)
50
11
Embedded Software Lab. @ SKKU
6. Making Tizen SDK Certificate (Cont’d)
5. Click “Generate”
6. Fill out the form and click “OK”
Making Tizen SDK Certificate
1
2
3
50
12
Embedded Software Lab. @ SKKU
6. Making Tizen SDK Certificate (Cont’d)
7. Final view
Making Tizen SDK Certificate
50
14
Embedded Software Lab. @ SKKU
• Cross-category platform (Multi-profile)
– Mobile, IVI, wearable, TV, printer, camera, …
• Open Source Platform
– “Tizen” is a registered brand of “Linux Foundation”
– “Tizen Steering Group” manages Tizen project
– Many manufacturers & developers are contributing to Tizen
• Samsung, Intel, …
• 2 Application Frameworks
– Native Application (written in C and C++)
– Web Application (written in HTML5 and JavaScript)
• Enhanced UI/Graphics Framework (EFL)
– High graphic performance(60fps+)
– Optimized for low-end H/W (low memory usage)
Tizen Features
50
15
Embedded Software Lab. @ SKKU
Wearable profile-New native UI builder
-Support multi-project
packaging.
-New mobile web device
APIs
-Development language
for native has changed
-Support enlightenment
foundation libraries
Tizen 2.3 Nov.2014 Enhanced UX and APIs-New Tizen 2015 UX
-DALi for 3D graphics UI
-OpenGL ES 3.0 support
-New network connectivity
APIs
-New EOM(External Output
Manager) APIs
-Application background
policy support
-New stock applications
-Gamepad support
-HID device driver support
Tizen 2.4 Dec.2015
Linux kernel 3.10.65Support for TM1 (mobile reference
phone)
• Tizen 2.x (Now 2.4)
– Opened source code, closed development process
– Profiles: Mobile(Z1/Z3), Wearable(Gear S/Gear S2), TV, IVI
• Tizen 3.0
– Under development
– Opened source code, opened development process
– Profiles: Common, Mobile, Wearable, TV, Micro(IoT), IVI
Tizen Version History
50
16
Embedded Software Lab. @ SKKU
• Tizen 3.0 is always opened to you!
– Tizen review server: http://review.tizen.org
• Tizen Development Workflow
– Make a patch Send to reviewers Review (Vote) Accept/Reject
– (If your patch is accepted) Submit to OBS(Open Build System) Pre-release
– QA(Quality Assessment) Final Release (http://download.tizen.org/release)
How to Contribute to Tizen?
50
17
Embedded Software Lab. @ SKKU
• 2 APIs: Native API, Web API
• 2 FWs: Native FW, Web FW
• Native Framework(Subsystems)
– Composed of several system projects
– Tizen-native projects
• Flora License
– Opened source code
– Can be used only in Tizen Certified Platform
• ex. app-core, WRT, system-server, …
– External open source projects
• ex. X11, Wayland, EFL, Blink, …
Tizen Architecture Diagram
50
18
Embedded Software Lab. @ SKKU
• W3C standard web APIs
– W3C/HTML5 markup, CSS, JS
• Supplementary APIs
– De-facto APIs (Khronos, Mozilla, etc.)
• Tizen Device APIs
– Allow web app to access devicesex. NFC, Bluetooth, Power Controls, …
• UI framework
– jQuery Mobile & Tizen Web UI Framework
– Tools such as widgets, events, effects, and animations
(Tizen Web Framework)
50
19
Embedded Software Lab. @ SKKU
• Tizen uses its own customized Linux Kernel
– Support only ARM and x86
• ARM (armv7, aarch64)
– Linux 3.10.y
• 3.10.65 (2016/03)
• It has full git history
• Intel (x86, x86_64)
– Linux 3.14
• Kernel Feature for Tizen
– Memory Management
• CMA (Contiguous Memory Allocator), IOMMU, dma_buf
• In order to use “physically contiguous memory”
• Some apps such as camera app requires physically contiguous memory
– extcon: external connector class
– kdbus: inter-process communication
Linux Kernel in Tizen
50
21
Embedded Software Lab. @ SKKU
• Tizen Native App’s Graphics and UI are based on “EFL”
• EFL: Set of libraries supporting Enlightenment
– Enlightenment: a desktop window manager
– Open source
• Components are divided by functions
– Event loop: Ecore
– Rendering engine: Evas
– UI: Edje, Elementary, …
Enlightenment Foundation Library
50
22
Embedded Software Lab. @ SKKU
EFL Components
Legend
Applications EFL & fontsWindow System
H/W
Linux Kernel Frame Buffer Input Devices
H/W
fontconfigfreetype2 OpenGL ES/EGL
Eet
Evas
Ecore
Eina
Edje
Elementary
Core Applications
X Window System
InputService
Framework&
Voice Framework
kernel / Frame Buffer/ Input Devices
Graphics
ISF& Voice FW
Cairo
Elementary: UI widgets
Ecore: Core event loop & glue to other subsystems
Evas: Canvas & Rendering
50
23
Embedded Software Lab. @ SKKU
• A Set of Widgets
– Containers: Box, Conformant, Grid, Layout, Panes, Scroller, Table, …
– Non-Containers: Bg, Button, Check, Entry, Label, List, Icon, Win, ...
• Features:
– Fast, Finger friendly, Scalability, Themes
– Widget hierarchy, Dynamic language change
Elementary
<Scaled and resized relative to the screen> <Same view but different themes>
50
24
Embedded Software Lab. @ SKKU
• Various Widgets
Elementary Widgets
clock
colorselector
entry
frame
flipselectorcheck
diskselector
actionslider
bg
index
map
menuphoto, photocam
panel
toolbar
radio
bubble
slider
ctxpopup
notify
separator
segment control
multibuttonentrypanes
glview
fileselector
Label
thumb
50
26
Embedded Software Lab. @ SKKU
• Tizen SDK is composed of
– IDE, Web Simulator, Emulator, Event Injector, UI Builder
– Documents, Sample applications, Remote Inspector, Localization Wizard, Project Wizard
– …
Tizen SDK
50
28
Embedded Software Lab. @ SKKU
• Based on chrome browser
• Run web app without target in order to quick/instant test
Web App Simulator
50
29
Embedded Software Lab. @ SKKU
• Emulation of physical target (currently, phone-like)
– QEMU Virtual board + Event Injector + Emulator manager (configuration)
• Better performance and portability
– Not all devices are emulated due to performance & portability
– OpenGL, Audio/Video codec acceleration
• Configurable virtual HW
Emulator
50
30
Embedded Software Lab. @ SKKU
• High performance with HW VT support
– Inter VT-x or AMD-V
– Special kernel driver needed• KVM in Linux and HAXM in Windows
Execution with HW VT acceleration
50
31
Embedded Software Lab. @ SKKU
• Hardware keyboard, screen shot, SDB, rotate, scale
• Multi touch
– Ctrl + mouse click
Menu of Emulator
50
32
Embedded Software Lab. @ SKKU
• Provide basic commands for application development– file transfer, remote shell command, port forwarding for a debugger, and viewing,
filtering, and controlling device log output
• Installation– SDB tool in “tizen-sdk/tools/sdb”
– To use the sdb commands, • be in the sdb directory
• Or add the sdb location to the environment path variable
• Learn more
Smart Development Bridge
Command Description
sdb push <local> <remote> Copy a file or directory recursively to the device's data file. Content that is generally considered suitable for children three years of age and older.
sdb pull <remote> [<local>] Copy a file or directory recursively from the device's data file.
sdb shell Run a remote shell interactively by dropping into a remote shell on an Emulator or device instance.
50
33
Embedded Software Lab. @ SKKU
1. Run “Emulator Manager”
2. Press “Create New VM” Button
(How to Use Tizen Emulator)
1
2
50
34
Embedded Software Lab. @ SKKU
3. You can set your own preferences of the emulator
– ex. GPU on/off, DRAM size, # Processors, …
4. Click “Confirm” button
5. Click “▶” button
6. You can see emulated Tizen phone’s screen
(How to Use Tizen Emulator)
1
2
50
35
Embedded Software Lab. @ SKKU
7. Select your target emulator on “Connection Explorer”
8. ▶ > Run As > Tizen Native Application
9. Test your application
(How to Use Tizen Emulator)
1
32
50
37
Embedded Software Lab. @ SKKU
• Reference: #
1. Make a New Native Project
1. Right click on “Project Explorer” > New > Tizen Native Project
2. Template > MOBILE-2.4 > “Basic UI”
3. Set the project’s name and click “Finish”
4. Open “Tizen native perspective”(Click “Yes”)
Make a Hello World Project
1
2
3
4
5
50
38
Embedded Software Lab. @ SKKU
• inc
– basicui.h: header file
• res
• shared
– res
• basicui.png
• src
– basicui.c: source file
• lib
• tizen-manifest.xml:
Tizen Project
50
39
Embedded Software Lab. @ SKKU
2. Connect PC and your target device with USB cable
3. Select your target emulator on “Connection Explorer”
4. ▶ > Run As > Tizen Native Application
5. Test your application
Build and Install the Project!
1
2 3
50
40
Embedded Software Lab. @ SKKU
• UI and service applications can be packaged together
• Only one UI application, while one or more service applications
Packaging a Native Application
50
41
Embedded Software Lab. @ SKKU
• Package format and file extension
– File format: ZIP archive file format
– File extension: .tpk
• Directory hierarchy
Packaging a Native Application
App private data
App libraries
App resources
App shared resources
App executable binary
/opt
/usr
/apps
/<Package ID> /lib
/res
/shared
/data
/bin
/<Executable Name1>
/data
/res
/trusted
/<Executable Name2>
/<Executable Name3>
50
42
Embedded Software Lab. @ SKKU
• Widget package includes all the support files that are needed by the widget
– Widget is a complete standalone Web application without any additional external resources or network connectivity
(Packaging a Web Application)
50
43
Embedded Software Lab. @ SKKU
• Package format and file extension
– File format: ZIP archive file format
– File extension: .wgt
• Directory hierarchy
(Packaging a Web Application)
Configuration data
/opt
/usr
/apps
/<Package ID>
/res
/data
/bin /<Package ID>
/config.xml
/icon.png
/index.html
/wgt
/css
/js
Default icon {png|gif|ico|svg}
Default start file {html|htm|svg|xhtml|xht}
CSS source files
JavaScript files
Symbolic link to Web runtime
50
44
Embedded Software Lab. @ SKKU
• Package format and file extension
– File format: ZIP archive file format
– File extension: .wgt
• Directory hierarchy
(Packaging a Hybrid Application)
Web project root
Native resources or web content
/opt
/usr
/apps
/<Package ID>
/lib
/res
/shared
/info
/data
/bin /<Executable Name1>
/manifest.xml
/data
/res
/trusted
/<Executable Name2>
/<Package ID>
/icon.png
/index.html/wgt
/css
50
45
Embedded Software Lab. @ SKKU
• <app.h> : library for using Application API
• <Elementary.h>: library for using EFL’s elementaries
• <efl_extension.h>: Menu and Back key events for the naviframe
• <dlog.h>: send log output
Header file (basicui.h)
50
46
Embedded Software Lab. @ SKKU
• appdata_s structure contains evas objects and is used in a parameter of ui_app_main()function.
Source code file (basicui.c)
50
47
Embedded Software Lab. @ SKKU
• ui_app_lifecycle_callback_s structure contains the set of callback functions for handling application life cycle events.
Source code file (basicui.c)
50
49
Embedded Software Lab. @ SKKU
• ui_app_add_event_handler() function adds the system event handler
– Events: low battery, low memory, orientation changed, language changed, region format changed
Source code file (basicui.c)