1

50

전공핵심실습1:운영체제론 Lecture 2. and Tizen Native App

Sungkyunkwan University Embedded Lab. Dongkun Shin

Embedded Software Lab. @ SKKU 2

Contents 50

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

Embedded Software Lab. @ SKKU 3

50

1. Install Tizen SDK

Embedded Software Lab. @ SKKU 4

Download Required Programs Ahead 50

• 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 page http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads- 2133151.html 2. Check “Accept License Agreement” 3. Download “Windows ” 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: ______)

Embedded Software Lab. @ SKKU 5

Install Samsung USB Driver 50

1. Install Samsung USB Driver 1. Go to Download Page 1. http://developer.samsung.com/technical- doc/view.do?v=T000000117#none 1 2. Download Samsung USB Driver 3. Install the Samsung USB Driver

Embedded Software Lab. @ SKKU 6

Install Java SDK 50

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 page http://www.oracle.com/technetwork/java/jav ase/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 1

2

Embedded Software Lab. @ SKKU 7

Install Tizen 2.4 SDK 50

4. Install Tizen SDK 2.4 1. Download Tizen SDK Installer 1 1. Windows x86: http://download.tizen.org/sdk/Installer/tizen- 2 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 3 2. Execute the Tizen SDK Installer 3. Change Install Location to ‘D:₩’ drive

4

Embedded Software Lab. @ SKKU 8

Install Tizen 2.4 SDK: Native App Development 50

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) 1 (It takes few minutes)

2

Embedded Software Lab. @ SKKU 9

Execute Tizen IDE-2.4 50

5. Execute “Tizen IDE-2.4”

Embedded Software Lab. @ SKKU 10

Making Tizen SDK Certificate 50

Only in Z3 (Developer Mode)

If you want develop apps in commercial mode, install “Certificate Extension” additionally. (not covered in class) 6. Making Tizen SDK Certificate 1. Window > Preferences 2. Preferences > Tizen SDK > Security Profiles 1 3. Click “Add”  “OK”

3 2

Embedded Software Lab. @ SKKU 11

Making Tizen SDK Certificate 50

6. Making Tizen SDK Certificate (Cont’d) 5. Click “Generate” 6. Fill out the form and click “OK” 1

3

2

Embedded Software Lab. @ SKKU 12

Making Tizen SDK Certificate 50

6. Making Tizen SDK Certificate (Cont’d) 7. Final view

Embedded Software Lab. @ SKKU 13

50

2. Introduction to Tizen

Embedded Software Lab. @ SKKU 14

Tizen Features 50

• Cross-category platform (Multi-profile) – Mobile, IVI, wearable, TV, printer, camera, …

• Open Source Platform – “Tizen” is a registered brand of “ Foundation” – “Tizen Steering Group” manages Tizen project – Many manufacturers & developers are contributing to Tizen • Samsung, , …

• 2 Application Frameworks – Native Application (written in 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)

Embedded Software Lab. @ SKKU 15

Tizen Version History 50

• 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 Dec.2015 – Profiles: Common, Mobile, Wearable, TV, Micro(IoT), IVI Tizen 2.4

Tizen 2.3 Nov.2014 Enhanced UX and APIs -New Tizen 2015 UX -DALi for 3D graphics UI Wearable profile -OpenGL ES 3.0 support -New native UI builder -New network connectivity -Support multi-project APIs packaging. -New EOM(External Output -New device Manager) APIs APIs -Application background -Development language policy support for native has changed -New stock applications -Support enlightenment -Gamepad support foundation libraries -HID device driver support

Linux kernel 3.10.65 Support for TM1 (mobile reference phone) Embedded Software Lab. @ SKKU 16

How to Contribute to Tizen? 50

• 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)

Embedded Software Lab. @ SKKU 17

Tizen Architecture Diagram 50

• 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, …

Embedded Software Lab. @ SKKU 18

(Tizen Web Framework) 50

• W3C standard web APIs – W3C/HTML5 markup, CSS, JS • Supplementary APIs – De-facto APIs (Khronos, Mozilla, etc.)

• Tizen Device APIs – Allow web app to devices ex. NFC, Bluetooth, Power Controls, …

• UI framework – jQuery Mobile & Tizen Web UI Framework – Tools such as widgets, events, effects, and animations

Embedded Software Lab. @ SKKU 19

Linux Kernel in Tizen 50

• 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

Embedded Software Lab. @ SKKU 20

Tizen Kernel Overview 50

Embedded Software Lab. @ SKKU 21

Enlightenment Foundation Library 50

• 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, …

Embedded Software Lab. @ SKKU 22

EFL Components 50

Elementary: UI widgets

Core Applications Ecore: Core event loop & glue to other subsystems Elementary Input Ecore Service Edje Evas Framework & Eet Voice Eina freetype2 fontconfig Cairo OpenGL ES/EGL Framework

Evas: Canvas & Rendering X Window System

Linux Kernel Frame Buffer Input Devices

H/W

Legend

Applications Window System Graphics EFL & fonts

ISF& Voice FW H/W kernel / Frame Buffer/ Input Devices

Embedded Software Lab. @ SKKU 23

Elementary 50

• 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

Embedded Software Lab. @ SKKU 24

Elementary Widgets 50

• Various Widgets actionslider check flipselector slider

clock segment control radio

photo, photocam entry menu notify bg frame colorselector

diskselector index bubble separator

Label panel map thumb

fileselector

toolbar multibuttonentry glview ctxpopup panes Embedded Software Lab. @ SKKU 25

50

3. Tizen SDK

Embedded Software Lab. @ SKKU 26

Tizen SDK 50

• Tizen SDK is composed of – IDE, Web Simulator, Emulator, Event Injector, UI Builder – Documents, Sample applications, Remote Inspector, Localization Wizard, Project Wizard – …

Embedded Software Lab. @ SKKU 27

Tizen IDE: Components 50

Embedded Software Lab. @ SKKU 28

Web App Simulator 50

• Based on chrome browser • Run web app without target in order to quick/instant test

Embedded Software Lab. @ SKKU 29

Emulator 50

• 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

Embedded Software Lab. @ SKKU 30

Execution with HW VT acceleration 50

• High performance with HW VT support – Inter VT-x or AMD-V – Special kernel driver needed • KVM in Linux and HAXM in Windows

Embedded Software Lab. @ SKKU 31

Menu of Emulator 50

• Hardware keyboard, screen shot, SDB, rotate, scale • Multi touch – Ctrl + mouse click

Embedded Software Lab. @ SKKU 32

Smart Development Bridge 50

• 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

Command Description sdb push 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 [] 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.

Embedded Software Lab. @ SKKU 33

(How to Use Tizen Emulator) 50

1. Run “Emulator Manager” 2. Press “Create New VM” Button

1 2

Embedded Software Lab. @ SKKU 34

(How to Use Tizen Emulator) 50

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 1

2

Embedded Software Lab. @ SKKU 35

(How to Use Tizen Emulator) 50

7. Select your target emulator on “Connection Explorer” 8. ▶ > Run As > Tizen Native 3 2 Application 9. Test your application

1

Embedded Software Lab. @ SKKU 36

50

4. Tizen Native App Development 1) Hello World

Embedded Software Lab. @ SKKU 37

Make a Hello World Project 50

• Reference: # 1 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”)

2

3 5

4 Embedded Software Lab. @ SKKU 38

Tizen Project 50

• inc – basicui.h: header file • res • shared – res • basicui.png • src – basicui.c: source file • lib • tizen-manifest.xml:

Embedded Software Lab. @ SKKU 39

Build and Install the Project! 50

2. Connect PC and your target device with USB cable 3. Select your target emulator on “Connection Explorer” 4. ▶ > Run As > Tizen Native Application 2 3 5. Test your application

1

Embedded Software Lab. @ SKKU 40

Packaging a Native Application 50

• UI and service applications can be packaged together • Only one UI application, while one or more service applications

Embedded Software Lab. @ SKKU 41

Packaging a Native Application 50

and file extension – File format: ZIP archive file format – File extension: .tpk • Directory hierarchy

/opt /

/usr /bin / App executable binary / /apps /data App private data

/ /lib App libraries /data /res App resources /res /shared App shared resources /trusted

Embedded Software Lab. @ SKKU 42

(Packaging a Web Application) 50

• 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

Embedded Software Lab. @ SKKU 43

(Packaging a Web Application) 50

• Package format and file extension – File format: ZIP archive file format – File extension: .wgt • Directory hierarchy

/bin / Symbolic link to Web runtime /opt /data /config.xml Configuration data /usr

/icon.png /apps Default icon {png|gif|ico|svg} /res /wgt

/ /index.html Default start file {html|htm|svg|xhtml|xht}

/css CSS source files

/js JavaScript files Embedded Software Lab. @ SKKU 44

(Packaging a Hybrid Application) 50

• Package format and file extension – File format: ZIP archive file format – File extension: .wgt

• Directory hierarchy /

/opt /bin /

/data / /usr /icon.png /info /manifest.xml /apps /lib /wgt /index.html

/ Web project root /res /css Native resources or web content

/data

/shared /res

/trusted Embedded Software Lab. @ SKKU 45

Header file (basicui.h) 50

: library for using Application API • : library for using EFL’s elementaries • : Menu and Back key events for the naviframe • : send log output

Embedded Software Lab. @ SKKU 46

Source code file (basicui.c) 50

• appdata_s structure contains evas objects and is used in a parameter of ui_app_main() function.

Embedded Software Lab. @ SKKU 47

Source code file (basicui.c) 50

• ui_app_lifecycle_callback_s structure contains the set of callback functions for handling application life cycle events.

Embedded Software Lab. @ SKKU 48

Application Lifecycle (ui_app_lifecycle_callback_s) 50

Embedded Software Lab. @ SKKU 49

Source code file (basicui.c) 50

• ui_app_add_event_handler() function adds the system event handler – Events: low battery, low memory, orientation changed, language changed, region format changed

Embedded Software Lab. @ SKKU 50

Source code file (basicui.c) 50

• create_base_gui() generates elements composing the screen of application using evas objects

Embedded Software Lab. @ SKKU