59
임베디드 소프트웨어 1 Embedded GUI

슬라이드 제목 없음 - wabar.tistory.comwabar.tistory.com/attachment/ck10.pdf작은크기– 2MB ... MPEG and MP3 players, international city clock, asteroid game, patience,

Embed Size (px)

Citation preview

Page 1: 슬라이드 제목 없음 - wabar.tistory.comwabar.tistory.com/attachment/ck10.pdf작은크기– 2MB ... MPEG and MP3 players, international city clock, asteroid game, patience,

임베디드 소프트웨어 1

Embedded GUI

Page 2: 슬라이드 제목 없음 - wabar.tistory.comwabar.tistory.com/attachment/ck10.pdf작은크기– 2MB ... MPEG and MP3 players, international city clock, asteroid game, patience,

임베디드 소프트웨어 2

X Windows 개요

Applications

WindowManager

Xlib Library

I/O Device Driver(Graphic Card, Keyboard, Mouse, Remote Controller, etc.)

Toolkit (Xt, GTK+, Qt, OSF/Motif)

Network protocol

X11 Server

Network protocol

Page 3: 슬라이드 제목 없음 - wabar.tistory.comwabar.tistory.com/attachment/ck10.pdf작은크기– 2MB ... MPEG and MP3 players, international city clock, asteroid game, patience,

임베디드 소프트웨어 3

X 윈도우의 역사

▣Creation in 1987 by MIT X Consortium▣X11R6 released in 1992▣Dark ages : no significant change by X.org since then▣XFree86 gaining importance◈LINUX (and BSD) drive X◈Two new toolkits with applications (Qt and GTK+)◈Numerous commercial and free applications, games etc

▣New challenges for X◈Hardware changes since 1987

CPU infinitely fast, Bus writes dominate performance, graphic cards converged for 2D ops

◈ Application expectations are much higher◈X moving down to handheld computers

Page 4: 슬라이드 제목 없음 - wabar.tistory.comwabar.tistory.com/attachment/ck10.pdf작은크기– 2MB ... MPEG and MP3 players, international city clock, asteroid game, patience,

임베디드 소프트웨어 4

X 윈도우의 특징

▣Pros◈Network Transparency

네트워크가 투명하여 사용자 입장에서는 없는 것처럼 보임

◈Modularity and Extensibility서버-클라이언트 구조로 장치 독립성이 보장

많은 윈도우 자원들이 정해지지 않아 다양한 인터페이스로 적용 가능

◈Open Source소스가 공개

▣Cons◈Too slow◈Too much burden on the programmer◈No standard toolkit◈Too old◈Too complex

Page 5: 슬라이드 제목 없음 - wabar.tistory.comwabar.tistory.com/attachment/ck10.pdf작은크기– 2MB ... MPEG and MP3 players, international city clock, asteroid game, patience,

임베디드 소프트웨어 5

GUI System Model

▣ 단일 프로세스 모델◈ 한 프로세스가 모든 그래픽 장치를 전용해서 사용

◈ 속도가 빠르지만, 다양한 GUI 프로그램들을 실행하기 어려움

◈ GtkFB

▣ 서버-클라이언트 모델1. 서버가 그래픽 장치를 전용해서 사용하는 경우

◈ 클라이언트로부터의 그래픽 요청을 처리

◈ 안정된 처리를 보장하지만, 복잡하고 크기가 큼(수 MB 이상)◈ X-Windows, Microwindows

2. 클라이언트와 그래픽 장치를 공유해서 사용하는 경우

◈ 서버는 그래픽 장치 사용을 허가

◈ 클라이언트가 그래픽 처리를 책임져야 함

◈ Qtopia

Page 6: 슬라이드 제목 없음 - wabar.tistory.comwabar.tistory.com/attachment/ck10.pdf작은크기– 2MB ... MPEG and MP3 players, international city clock, asteroid game, patience,

임베디드 소프트웨어 6

Gtk/FB

▣GTK+ (http://www.gtk.org) 의 하부 라이브러리 GDK 를Framebuffer 에 직접 포팅◈GTK+는 많이 사용하는 오픈 소스 그래픽 윈도우 라이브러리

◈X 윈도우가 필요없음

◈단일 프로세스 모델

◈작은 크기 – 2MB▣기본 라이브러리 제공◈Glib – 기본 데이터 타입과 함수들

◈Pango – 다중 언어를 위한 텍스트와 폰트 지원.◈ libpng, libjpeg, libtiff – 이미지 처리 지원

◈FreeType – Truetype 및 Type1 폰트 지원 라이브러리

▣단점◈단일 프로세스 모델

◈X 라이브러리 호출하는 GTK 프로그램은 실행 불가

◈X 윈도우 기능을 모두 지원하지 않음

Page 7: 슬라이드 제목 없음 - wabar.tistory.comwabar.tistory.com/attachment/ck10.pdf작은크기– 2MB ... MPEG and MP3 players, international city clock, asteroid game, patience,

임베디드 소프트웨어 7

Qt/Embedded

▣Qt (http://www.trolltech.com) 라이브러리 수정◈Qt는 많이 사용하는 상용 그래픽 윈도우 라이브러리

◈X 윈도우가 필요없음

◈서버-클라이언트 모델 중 클라이언트와 그래픽 처리 공유

◈작은 크기 – 1.5 ~ 3MB

◈PIMS, Games, Multimedia 등 다양한 응용 지원

◈Qtopia 는 모바일 기기를 위한 응용 환경 – Sharp 의 Zaurus

Page 8: 슬라이드 제목 없음 - wabar.tistory.comwabar.tistory.com/attachment/ck10.pdf작은크기– 2MB ... MPEG and MP3 players, international city clock, asteroid game, patience,

임베디드 소프트웨어 8

Tiny X

▣Keith Packard에 의해 X 윈도우의 하부를 수정하여 크기를 줄임◈그래픽 장치 구동기 모듈 등을 지원하지 않음

◈Xfree86 소스코드 안에 포함 (programs/Xserver/hw/kdrive)◈작은 크기 – 서버만 1MB

▣그래픽 장치의 하드웨어 가속 기능 등을 이용하기 위해서는 Tiny X 그래픽 가속 드라이버를 구현하여야 함

▣http://www.bluemug.com Modified GTK+GTK+ 1MB Gdk 235KB Glib 166KB

Tiny-XLibraries

X11 (w/o CMS) 666KB Xext 60KB Xi 30KB Xpm 57KB

X Server (framebuffered)Xfbdev 691KB

Total 2.9MB

Page 9: 슬라이드 제목 없음 - wabar.tistory.comwabar.tistory.com/attachment/ck10.pdf작은크기– 2MB ... MPEG and MP3 players, international city clock, asteroid game, patience,

임베디드 소프트웨어 9

Microwindows

▣X 윈도우 또는 M$ windows 를 대체할 수 있는 오픈소스그래픽 라이브러리◈Microwindows – Win32 API 구현 WinCE 호환

◈Nano-X – Xlib API 와 유사

▣서버-클라이언트 구조

▣http://www.microwindows.org◈프로그램 갱신이 느림

Page 10: 슬라이드 제목 없음 - wabar.tistory.comwabar.tistory.com/attachment/ck10.pdf작은크기– 2MB ... MPEG and MP3 players, international city clock, asteroid game, patience,

임베디드 소프트웨어 10

SDL(Simple DirectMedia Layer)

▣그래픽 프레임버퍼와 오디오장치에 대한 빠른 접근을 위해제작된 크로스플랫폼 멀티미디어 라이브러리◈MPEG playback software, emulator, game 등에 주로 사용

▣다양한 하드웨어플랫폼에 포팅◈Linux, Windows, MacOS, FreeBSD, IRIX, QNX, etc.

▣다양한 언어 바인딩 지원◈C++, Ada, Eiffel, Java, Lua, ML, Perl, PHP, Pike, Python, and

Ruby

▣http://www.libsdl.org

Page 11: 슬라이드 제목 없음 - wabar.tistory.comwabar.tistory.com/attachment/ck10.pdf작은크기– 2MB ... MPEG and MP3 players, international city clock, asteroid game, patience,

임베디드 소프트웨어 11

DirectFB

▣An abstract layer on the top of Linux kernel FB device.▣A replacement over X.◈Cleaner design than X.◈Off-screen buffers for each top-level window.◈Already having ported GDK, supporting GTK+ applications.

▣But not much advantages over X.◈Not even provide multiple client support.◈Not even provide standard GUI.

Page 12: 슬라이드 제목 없음 - wabar.tistory.comwabar.tistory.com/attachment/ck10.pdf작은크기– 2MB ... MPEG and MP3 players, international city clock, asteroid game, patience,

임베디드 소프트웨어 12

WxWidgets

▣오픈 소스 크로스 플랫폼 C++ GUI 라이브러리◈Windows, Linux/GTK, Linux/X11, MacOS 등에 포팅

◈응용을 재컴파일하면 여러 플랫폼에서 실행 가능

▣임베디드 용으로 설계된 것은 아님

▣http://www.wxwidgets.org

Page 13: 슬라이드 제목 없음 - wabar.tistory.comwabar.tistory.com/attachment/ck10.pdf작은크기– 2MB ... MPEG and MP3 players, international city clock, asteroid game, patience,

임베디드 소프트웨어 13

임베디드 그래픽 응용 프로그램 개발

▣응용 프로그래밍◈그래픽 라이브러리 학습

라이브러리 관련 출판된 책이나 사이트의 매뉴얼 등 참고

◈ IDE, GUI 빌더 등의 소프트웨어 사용Qt - Kdevelop,Qt Designer(GUI Builder)GTK+ - Glade-2(GUI Builder)wxWindows – MinGW Developer Studio, wxDesigner

▣호스트 환경◈호스트용 크로스 그래픽 라이브러리 컴파일 및 설치

◈이를 이용하여 타겟용 그래픽 응용 프로그램 컴파일

▣타겟 환경◈타겟용 그래픽 라이브러리 설치

◈타겟용 그래픽 응용 프로그램 설치

▣참고 사이트◈http://www.linuxdevices.com

Page 14: 슬라이드 제목 없음 - wabar.tistory.comwabar.tistory.com/attachment/ck10.pdf작은크기– 2MB ... MPEG and MP3 players, international city clock, asteroid game, patience,

임베디드 소프트웨어 14

Qt/Embedded Programming

Page 15: 슬라이드 제목 없음 - wabar.tistory.comwabar.tistory.com/attachment/ck10.pdf작은크기– 2MB ... MPEG and MP3 players, international city clock, asteroid game, patience,

임베디드 소프트웨어 15

Qt

▣멀티플랫폼 GUI 응용을 위한 C++ GUI Toolkit◈객체 지향 프로그래밍 구현 – 시그널과 슬롯 등 제공

◈풍부한 위젯(Widget) 제공

◈다양한 플랫폼 지원 – Windows, Mac OS X, Linux, Solaris,HP-UX◈Unicode 와 i18n 등의 다양한 언어 지원

▣유용한 도구 제공◈Qt Designer(GUI 빌더) , Qt Linguist, qmake 등

▣대표적인 리눅스 데스크탑 환경인 KDE 의 기반◈Qt/X11 사용

▣노르웨이의 Trolltech 사에서 개발

▣다양한 배포판으로 제공됨◈Qt Enterprise Edition and Qt Professional Edition◈Qt Free Edition◈Qt Embedded Edition

Page 16: 슬라이드 제목 없음 - wabar.tistory.comwabar.tistory.com/attachment/ck10.pdf작은크기– 2MB ... MPEG and MP3 players, international city clock, asteroid game, patience,

임베디드 소프트웨어 16

Qt/Embedded

▣임베디드 GUI 와 응용 개발을 위한 C++ GUI Toolkit◈임베디드 리눅스와 함께 다양한 프로세서 상에서 실행

◈X 윈도우 시스템을 사용하지 않고 프레임버퍼에 직접 접근

◈표준 Qt API 를 사용하므로 윈도우와 유닉스 상에서도 개발 가능

▣유용한 개발 도구들(QtDesigner, Tmake 등) 지원

▣PDA 등의 임베디드 응용 환경인 Qtopia 의 기반

Page 17: 슬라이드 제목 없음 - wabar.tistory.comwabar.tistory.com/attachment/ck10.pdf작은크기– 2MB ... MPEG and MP3 players, international city clock, asteroid game, patience,

임베디드 소프트웨어 17

Qt/Embedded 적용 사례

▣Sharp Zaurus PDA ▣Motorola Smart Phones

Page 18: 슬라이드 제목 없음 - wabar.tistory.comwabar.tistory.com/attachment/ck10.pdf작은크기– 2MB ... MPEG and MP3 players, international city clock, asteroid game, patience,

임베디드 소프트웨어 18

Qtopia

▣ 모바일 기기를 위한 윈도우 환경과 응용 슈트◈ Qt/Embedded 기반의 윈도우 매니저 (Window Manager)◈ MS-Windows처럼 윈도우 상의 아이콘을 클릭하여 Qt/Embedded

응용 프로그램을 실행할 수 있는 환경

◈ 효율적인 메모리 사용 – 6~8MB◈ 오픈 소스, 전용성, 통합성 제공

▣ Qtopia 제공 응용 프로그램들◈ 개인 정보 관리(Personal Information Management), 인터넷 컨텐

츠, Entertainment, 다중 플랫폼 OS와의 동기화(synchronization) 소프트웨어 등

◈ Address Book, Calculator, Calendar, To do List, text editor, MPEG and MP3 players, international city clock, asteroid game, patience, mine hunt, File Manager, Go, etc.

Page 19: 슬라이드 제목 없음 - wabar.tistory.comwabar.tistory.com/attachment/ck10.pdf작은크기– 2MB ... MPEG and MP3 players, international city clock, asteroid game, patience,

임베디드 소프트웨어 19

Qtopia 적용 화면

▣Qtopia Phone

▣Qtopia PDA

Page 20: 슬라이드 제목 없음 - wabar.tistory.comwabar.tistory.com/attachment/ck10.pdf작은크기– 2MB ... MPEG and MP3 players, international city clock, asteroid game, patience,

임베디드 소프트웨어 20

Qt/Embedded 의 구조

▣메모리 효율성◈X Windows 를 전혀 이용하지 않고 커널 프레임버퍼에 직접 접근

◈가속 기능 최적화로

속도가 느린 단점 보완

◈라이브러리 크기 조정 가능

M$-Windows

Qt API

Unix/Linux Mac OS X Embedded Linux

GDI Xlib Carbon

Qt/Windows Qt/X11 Qt/Macintosh Qt/Embedded

Qt Application

Page 21: 슬라이드 제목 없음 - wabar.tistory.comwabar.tistory.com/attachment/ck10.pdf작은크기– 2MB ... MPEG and MP3 players, international city clock, asteroid game, patience,

임베디드 소프트웨어 21

Qt/Embedded 의 구조

▣윈도우 시스템◈서버 프로세스와 나머지 클라이언트들로 구성

◈서버 프로세스

입력 메소드(IME) 제공하거나 클라이언트 시동 사용자 인터페이스

제공

◈클라이언트서버와 공유 메모리를 통해 통신

서버 프로세스가 개입하지 않고 프레임버퍼에 직접 씀

◈QCOP 채널을 통해 메시지 교환

◈Qprocess 의 비동기 IPC 메커니즘 제공

◈다양한 폰트 포맷 지원

TTF(TrueType Fonts), PostScript Type1, BDF(Bitmap Distribution Format), QPF(Qt Pre-rendered Fonts)

Page 22: 슬라이드 제목 없음 - wabar.tistory.comwabar.tistory.com/attachment/ck10.pdf작은크기– 2MB ... MPEG and MP3 players, international city clock, asteroid game, patience,

임베디드 소프트웨어 22

Signal 과 Slot

▣Signal 과 Slot 매커니즘으로 객체 간 통신◈C++ 로 구현된 빠르고, 유연하고 완전한 객체 지향 구조

◈기존의 콜백 함수 이용 방식의 단점 개선

콜백 함수 이용 방식은 특정 이벤트와 처리 코드 포인트를 연결

콜백 함수는 클래스 독립적인 구조에 적합하지 않음

또한, 매개변수에 대한 타입체크가 없음

◈사용 방법

미리 시그널을 처리할 함수(슬롯)을 만들고 connect() 함수를 이용하여시그널과 슬롯을 연결

이벤트가 발생하면 발생 위젯이 시그널을 만들고 해당 슬롯에 의해 처

매개변수에 대한 타입 체크, 즉 Type safe예) Quit 버튼의 clicked() 시그널과 quit() 슬롯을 연결하여 사용자가Quit 버튼을 클릭하면 응용 프로그램이 종료

connect ( button, SIGNAL(clicked()), qApp, SLOT(quit()) );

Page 23: 슬라이드 제목 없음 - wabar.tistory.comwabar.tistory.com/attachment/ck10.pdf작은크기– 2MB ... MPEG and MP3 players, international city clock, asteroid game, patience,

임베디드 소프트웨어 23

Signal 과 Slot

▣Signal 과 Slot

Page 24: 슬라이드 제목 없음 - wabar.tistory.comwabar.tistory.com/attachment/ck10.pdf작은크기– 2MB ... MPEG and MP3 players, international city clock, asteroid game, patience,

임베디드 소프트웨어 24

Signal 과 Slot

▣간단한 Signal 과 Slot 예제

class BankAccount : public QObject{Q_OBJECT

public:BankAccount() { curBalance = 0; }int balance() const { return curBalance; }

public slots:void setBalance( int newBalance );

signals:void balanceChanged( int newBalance );

private:int curBalance;

};

void BankAccount::setBalance( int newBalance ){

if ( newBalance != curBalance ) {curBalance = newBalance;emit balanceChanged( curBalance );

}}

balanceChanged() 시그널

은 따로 구현하지 않음

balancChanged() 시그널이 발

생하여 매개변수 curBanalce 를

해당 슬롯에 전달

Page 25: 슬라이드 제목 없음 - wabar.tistory.comwabar.tistory.com/attachment/ck10.pdf작은크기– 2MB ... MPEG and MP3 players, international city clock, asteroid game, patience,

임베디드 소프트웨어 25

Signal 과 Slot

▣Meta Object Compiler (MOC)◈Signal 과 slot 매커니즘을 지원

signal and slot 관련 코드를 C++ preprocessor 와 moc 가 표준 C++ 코드로 구현

◈응용의 헤더 파일을 읽고 signal 과 slot 을 지원하는 코드를 생성

◈Qt 의 translation 메커니즘, 속성 시스템, 실행 시간 타입 정보 지원

Page 26: 슬라이드 제목 없음 - wabar.tistory.comwabar.tistory.com/attachment/ck10.pdf작은크기– 2MB ... MPEG and MP3 players, international city clock, asteroid game, patience,

임베디드 소프트웨어 26

Widgets

▣Qt 는 버튼, 스크롤바 등의 풍부한 위젯들 제공◈위젯들은 QWidget 의 인스턴스들

◈위젯의 특성부모 위젯은 많은 수의 자식 위젯들을 포함

자식 위젯들은 부모 위젯 영역 안에 표시

부모 위젯이 없는 위젯은 top-level widget – 타이틀바와 프레임 포함

자식 위젯 위치는 수동 또는 layout manager 에 의해 자동으로 설정

위젯이 숨겨지거나 삭제되면 자식 위젯들도 같은 영향을 받음

QObject

QLineEdit

QTimer QWidget

QDialog QFrame

QLabel

QSpinBox

Page 27: 슬라이드 제목 없음 - wabar.tistory.comwabar.tistory.com/attachment/ck10.pdf작은크기– 2MB ... MPEG and MP3 players, international city clock, asteroid game, patience,

임베디드 소프트웨어 27

Qt/Embedded Programming

▣Hello Qt/Embedded 예제

#include <qapplication.h>#include <qlabel.h>int main( int argc, char **argv ){

QApplication app( argc, argv );QLabel *hello = new QLabel( "<font color=blue>Hello"

" <i>Qt/Embedded!</i></font>", 0 );app.setMainWidget( hello );hello->show();return app.exec();

}

Page 28: 슬라이드 제목 없음 - wabar.tistory.comwabar.tistory.com/attachment/ck10.pdf작은크기– 2MB ... MPEG and MP3 players, international city clock, asteroid game, patience,

임베디드 소프트웨어 28

Qt/Embedded Programming

▣위젯 직접 만들기◈Qwidget 을 상속받은 서브클래스 작성

◈AnalogClock 위젯 예제

“analogclock.h” 파일

#include <qwidget.h>class AnalogClock : public QWidget{public:

AnalogClock( QWidget *parent = 0, const char *name = 0 );protected:

virtual void timerEvent( QTimerEvent *event );virtual void paintEvent( QPaintEvent *event );

};

Page 29: 슬라이드 제목 없음 - wabar.tistory.comwabar.tistory.com/attachment/ck10.pdf작은크기– 2MB ... MPEG and MP3 players, international city clock, asteroid game, patience,

임베디드 소프트웨어 29

Qt/Embedded Programming

▣AnalogClock 위젯 예제 계속◈“analogclock.cpp” 파일

#include <qdatetime.h>#include <qpainter.h>#include "analogclock.h"AnalogClock::AnalogClock( QWidget *parent, const

char *name ): QWidget( parent, name )

{startTimer( 12000 );resize( 100, 100 );

}void AnalogClock::timerEvent( QTimerEvent * ){

update();}void AnalogClock::paintEvent( QPaintEvent * ){

QCOORD hourHand[8] = { 2, 0, 0, 2, -2, 0, 0, -25 };QCOORD minuteHand[8] = { 1, 0, 0, 1, -1, 0, 0, -40 };

QTime time = QTime::currentTime();QPainter painter( this );painter.setWindow( -50, -50, 100, 100 );painter.setBrush( black );for ( int i = 0; i < 12; i++ ) {

painter.drawLine( 44, 0, 46, 0 );painter.rotate( 30 );

}painter.save();painter.rotate( 30 * (time.hour() % 12) + time.minute() / 2 );painter.drawConvexPolygon( QPointArray(4, hourHand) );painter.restore();painter.save();painter.rotate( 6 * time.minute() );painter.drawConvexPolygon( QPointArray(4, minuteHand) );painter.restore();

}

매 12초마다

timerEvent 발생

paintEvent 발생

Page 30: 슬라이드 제목 없음 - wabar.tistory.comwabar.tistory.com/attachment/ck10.pdf작은크기– 2MB ... MPEG and MP3 players, international city clock, asteroid game, patience,

임베디드 소프트웨어 30

Qt/Embedded Programming

▣AnalogClock 위젯 예제 계속◈테스트 프로그램

#include <qapplication.h>#include "analogclock.h"int main( int argc, char **argv ){

QApplication app( argc, argv );AnalogClock *clock = new AnalogClock;app.setMainWidget( clock );clock->show();return app.exec();

}

Page 31: 슬라이드 제목 없음 - wabar.tistory.comwabar.tistory.com/attachment/ck10.pdf작은크기– 2MB ... MPEG and MP3 players, international city clock, asteroid game, patience,

임베디드 소프트웨어 31

Qt/Embedded 개발 환경

▣Qt/Embedded 개발에 필요한 소스◈Trolltech(http://www.trolltech.com) 홈페이지로부터 다운로드

◈호스트 컴퓨터용

Qt/X11 free 버전 소스코드 (qt-x11-free-2.3.2.tar.gz)Qt/Embedded free 버전 소스코드 (qt-embedded-2.3.7.tar.gz)Qtopia free 버전 소스코드 (qtopia-free-1.7.0.tar.gz)Tmake free 버전 소스코드 (tmake-1.13.tar.gz)

– Trolltech에서 개발한 소프트웨어 프로젝트 툴

◈타겟 임베디드 시스템용

Qt/Embedded free 버전 소스코드 (qt-embedded-2.3.7.tar.gz)Qtopia free 버전 소스코드 (qtopia-free-1.7.0.tar.gz)Tmake free 버전 소스코드 (tmake-1.13.tar.gz)

Page 32: 슬라이드 제목 없음 - wabar.tistory.comwabar.tistory.com/attachment/ck10.pdf작은크기– 2MB ... MPEG and MP3 players, international city clock, asteroid game, patience,

임베디드 소프트웨어 32

개발환경 및 과정

Qt/X11 설치(Qvfb)

Qt/X11 설치(Qvfb)

Qt/Embedded 설치Qt/Embedded 설치

Qtopia 설치Qtopia 설치

타겟용 Qt/EmbeddedLibrary 설치

타겟용 Qt/EmbeddedLibrary 설치

타겟용 Qtopia 설치타겟용 Qtopia 설치

Qt 응용 프로그램 개발 및 테스트Qt 응용 프로그램 개발 및 테스트

호스트 컴퓨터 타겟 임베디드 시스템

Tmake 설정Tmake 설정 타겟용 Tmake 설정타겟용 Tmake 설정

▣Qvfb (Qt Virtual FrameBuffer)◈X-Window 상에서 프레임버퍼를 emulation하는 Virtual Frame

Buffer 제공

Page 33: 슬라이드 제목 없음 - wabar.tistory.comwabar.tistory.com/attachment/ck10.pdf작은크기– 2MB ... MPEG and MP3 players, international city clock, asteroid game, patience,

임베디드 소프트웨어 33

Tmake

▣ Tmake◈ Trolltech에서 개발한 소프트웨어 프로젝트 툴

◈ 현재 데스크탑용은 Qmake로 진화

main.cpphello.cpphello.h

main.cpphello.cpphello.h

hello.prohello.pro hellohello

project file

Makefile

Page 34: 슬라이드 제목 없음 - wabar.tistory.comwabar.tistory.com/attachment/ck10.pdf작은크기– 2MB ... MPEG and MP3 players, international city clock, asteroid game, patience,

임베디드 소프트웨어 34

호스트 컴퓨터에 Qt/X11 설치

▣Qt/X11 free 버전 설치 (qt-x11-free-2.3.2)◈qt-x11-2.3.2.tar.gz 파일을 특정 디렉토리에 푼다.

◈설정

◈make

$ tar xvfz qt-x11-2.3.2.tar.gz$ mv qt-x11-2.3.2 qt-X-x86-2.3.2$ cd qt-X-x86-2.3.2

$ tar xvfz qt-x11-2.3.2.tar.gz$ mv qt-x11-2.3.2 qt-X-x86-2.3.2$ cd qt-X-x86-2.3.2

$ export QTDIR=`pwd`$ export PATH=$QTDIR/bin:$PATH$ export LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH$ ./configure –no-xft –shared –release

This is the Qt/X11 Free Edition.……..Do you accept the terms of either license? yes

$ export QTDIR=`pwd`$ export PATH=$QTDIR/bin:$PATH$ export LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH$ ./configure –no-xft –shared –release

This is the Qt/X11 Free Edition.……..Do you accept the terms of either license? yes

$ make$ make

Page 35: 슬라이드 제목 없음 - wabar.tistory.comwabar.tistory.com/attachment/ck10.pdf작은크기– 2MB ... MPEG and MP3 players, international city clock, asteroid game, patience,

임베디드 소프트웨어 35

호스트 컴퓨터에 Qt/X11 설치

◈컴파일 확인 - bin 디렉토리의 designer 실행

Page 36: 슬라이드 제목 없음 - wabar.tistory.comwabar.tistory.com/attachment/ck10.pdf작은크기– 2MB ... MPEG and MP3 players, international city clock, asteroid game, patience,

임베디드 소프트웨어 36

호스트 컴퓨터에 Qt/X11 설치

◈qvfb(Qt virtual framebuffer) 실행

$ make –C tools/qvfb$ cp tools/qvfb/qvfb ./bin$ qvfb –depth 16 &

$ make –C tools/qvfb$ cp tools/qvfb/qvfb ./bin$ qvfb –depth 16 &

Page 37: 슬라이드 제목 없음 - wabar.tistory.comwabar.tistory.com/attachment/ck10.pdf작은크기– 2MB ... MPEG and MP3 players, international city clock, asteroid game, patience,

임베디드 소프트웨어 37

호스트 컴퓨터에 Qt/Embedded 설치

▣Qt/Embedded free 버전 설치◈qt-embedded-2.3.7.tar.gz 파일을 특정 디렉토리에 푼다.

◈qtopia-1.7.0.tar.gz 파일을 특정 디렉토리에 푼다.

◈Qt/Embedded 설정

$ tar xvfz qt-embedded-2.3.7.tar.gz$ mv qt-2.3.7 qt-E-x86-2.3.7

$ tar xvfz qt-embedded-2.3.7.tar.gz$ mv qt-2.3.7 qt-E-x86-2.3.7

$ tar xvfz qtopia-free-1.7.0.tar.gz$ mv qtopia-free-1.7.0 qtopia-x86-1.7.0

$ tar xvfz qtopia-free-1.7.0.tar.gz$ mv qtopia-free-1.7.0 qtopia-x86-1.7.0

$ cd qt-E-x86-2.3.7$ cp ../qtopia-x86-1.7.0/src/qt/qconfig-qpe.h src/tools$ export QTDIR=`pwd`$ export PATH=$QTDIR/bin:$PATH$ export LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH$ ./configure –shared –qconfig qpe –qvfb –depths 4,8,16 –release

This is the Qt/Embedded Free Edition.……..

$ cd qt-E-x86-2.3.7$ cp ../qtopia-x86-1.7.0/src/qt/qconfig-qpe.h src/tools$ export QTDIR=`pwd`$ export PATH=$QTDIR/bin:$PATH$ export LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH$ ./configure –shared –qconfig qpe –qvfb –depths 4,8,16 –release

This is the Qt/Embedded Free Edition.……..

Page 38: 슬라이드 제목 없음 - wabar.tistory.comwabar.tistory.com/attachment/ck10.pdf작은크기– 2MB ... MPEG and MP3 players, international city clock, asteroid game, patience,

임베디드 소프트웨어 38

호스트 컴퓨터에 Qt/Embedded 설치

◈Make

▣Tmake 설치◈ tmake-1.13.tar.gz 파일을 특정 디렉토리에 푼다.

◈Tmake 설정

$ make sub-src$ cp ../qt-X-x86-3.3.4/bin/uic ./bin

$ make sub-src$ cp ../qt-X-x86-3.3.4/bin/uic ./bin

$ tar xvfz tmake-1.13.tar.gz$ cd tmake-1.13

$ tar xvfz tmake-1.13.tar.gz$ cd tmake-1.13

$ export TMAKEPATH=`pwd`/lib/qws/linux-x86-g++$ export PATH=$PATH:`pwd`/bin$ cd ..

$ export TMAKEPATH=`pwd`/lib/qws/linux-x86-g++$ export PATH=$PATH:`pwd`/bin$ cd ..

Page 39: 슬라이드 제목 없음 - wabar.tistory.comwabar.tistory.com/attachment/ck10.pdf작은크기– 2MB ... MPEG and MP3 players, international city clock, asteroid game, patience,

임베디드 소프트웨어 39

호스트 컴퓨터에 Qtopia 설치

▣Qtopia 설치◈Qtopia 설정 및 make

◈Qvfb 를 이용한 Qtopia 실행

$ cd qtopia-x86-1.7.0$ export QPEDIR=`pwd`$ export PATH=$QPEDIR/bin:$PATH$ cd src$ ./configure –shared –release$ make

$ cd qtopia-x86-1.7.0$ export QPEDIR=`pwd`$ export PATH=$QPEDIR/bin:$PATH$ cd src$ ./configure –shared –release$ make

$ qvfb –width 240 –height 320 –depth 16 &$ qpe &

$ qvfb –width 240 –height 320 –depth 16 &$ qpe &

Page 40: 슬라이드 제목 없음 - wabar.tistory.comwabar.tistory.com/attachment/ck10.pdf작은크기– 2MB ... MPEG and MP3 players, international city clock, asteroid game, patience,

임베디드 소프트웨어 40

호스트 컴퓨터에 Qtopia 설치

◈Qtopia 실행 화면

Page 41: 슬라이드 제목 없음 - wabar.tistory.comwabar.tistory.com/attachment/ck10.pdf작은크기– 2MB ... MPEG and MP3 players, international city clock, asteroid game, patience,

임베디드 소프트웨어 41

타겟 시스템에 Qt/Embedded 설치

▣Qt/Embedded free 버전 설치◈qt-embedded-2.3.7.tar.gz 파일을 특정 디렉토리에 푼다.

◈qtopia-1.7.0.tar.gz 파일을 특정 디렉토리에 푼다.

◈Qt/Embedded 설정

$ tar xvfz qt-embedded-2.3.7.tar.gz$ mv qt-2.3.7 qt-E-arm-2.3.7

$ tar xvfz qt-embedded-2.3.7.tar.gz$ mv qt-2.3.7 qt-E-arm-2.3.7

$ tar xvfz qtopia-free-1.7.0.tar.gz$ mv qtopia-free-1.7.0 qtopia-arm-1.7.0

$ tar xvfz qtopia-free-1.7.0.tar.gz$ mv qtopia-free-1.7.0 qtopia-arm-1.7.0

$ cd qt-E-arm-2.3.7$ cp ../qtopia-arm-1.7.0/src/qt/qconfig-qpe.h src/tools$ export QTDIR=`pwd`$ export PATH=$QTDIR/bin:$PATH$ export LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH$ ./configure –xplatform linux-arm-g++ –shared –qconfig qpe \–depths 4,8,16 –release

This is the Qt/Embedded Free Edition.……..

$ cd qt-E-arm-2.3.7$ cp ../qtopia-arm-1.7.0/src/qt/qconfig-qpe.h src/tools$ export QTDIR=`pwd`$ export PATH=$QTDIR/bin:$PATH$ export LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH$ ./configure –xplatform linux-arm-g++ –shared –qconfig qpe \–depths 4,8,16 –release

This is the Qt/Embedded Free Edition.……..

Page 42: 슬라이드 제목 없음 - wabar.tistory.comwabar.tistory.com/attachment/ck10.pdf작은크기– 2MB ... MPEG and MP3 players, international city clock, asteroid game, patience,

임베디드 소프트웨어 42

타겟 시스템에 Qt/Embedded 설치

◈Make

◈라이브러리 파일을 nfs 디렉토리에 복사(다음 페이지 참고)

▣Tmake 설치 및 환경 설정◈Tmake 설정

$ make sub-src$ cp ../qt-X-x86-3.3.4/bin/uic ./bin

$ make sub-src$ cp ../qt-X-x86-3.3.4/bin/uic ./bin

$ cd tmake-1.13 $ export TMAKEPATH=`pwd`/lib/qws/linux-arm-g++$ export PATH=$PATH:`pwd`/bin ; cd ..

$ cd tmake-1.13 $ export TMAKEPATH=`pwd`/lib/qws/linux-arm-g++$ export PATH=$PATH:`pwd`/bin ; cd ..

Page 43: 슬라이드 제목 없음 - wabar.tistory.comwabar.tistory.com/attachment/ck10.pdf작은크기– 2MB ... MPEG and MP3 players, international city clock, asteroid game, patience,

임베디드 소프트웨어 43

타겟 시스템에 Qtopia 설치

▣Qtopia 설치◈Qtopia 설정 및 make

◈필요한 파일을 nfs 디렉토리에 복사

$ cd qtopia-arm-1.7.0$ export QPEDIR=`pwd`$ export PATH=$QPEDIR/bin:$PATH$ cd src$ ./configure –xplatform linux-arm-g++ –shared$ make

$ cd qtopia-arm-1.7.0$ export QPEDIR=`pwd`$ export PATH=$QPEDIR/bin:$PATH$ cd src$ ./configure –xplatform linux-arm-g++ –shared$ make

$ cp –rf $QPEDIR /nfsroot$ cp –rf $QTDIR/lib /nfsroot/qtopia-arm-1.7.0$ cp /usr/local/arm-linux/lib/libdl* /nfsroot/qtopia-arm-1.7.0/lib

$ cp –rf $QPEDIR /nfsroot$ cp –rf $QTDIR/lib /nfsroot/qtopia-arm-1.7.0$ cp /usr/local/arm-linux/lib/libdl* /nfsroot/qtopia-arm-1.7.0/lib

Page 44: 슬라이드 제목 없음 - wabar.tistory.comwabar.tistory.com/attachment/ck10.pdf작은크기– 2MB ... MPEG and MP3 players, international city clock, asteroid game, patience,

임베디드 소프트웨어 44

타겟 시스템에 기타 프로그램 설치

▣터치 스크린 입력 calibration 프로그램 설치◈ tslib 다운로드 및 설치

휴인스 홈페이지 또는 http://cvs.arm.linux.org.uk/cgi.viewcvs.cgi/tslib/

▣입력 디바이스 드라이버 설치◈터치스크린 입력 디바이스 드라이버 설치

ads7846e 디바이스 드라이버 소스 컴파일 및 설치 또는

PXA255-PRO2 보드 부팅 후 /usr/qpea 디렉토리로부터 디바이스 드라이버 모듈 파일(ads7846e.o) 을 nfs 디렉토리로 복사해서 이용

처음 한번만 수행

$ tar xvfj tslib_ok.tar.bz2$ ./configure –prefix=/ –build=i386-linux –host=arm-linux$ make; make DESTDIR=/nfsroot/qtopia-arm-1.7.0 install

$ tar xvfj tslib_ok.tar.bz2$ ./configure –prefix=/ –build=i386-linux –host=arm-linux$ make; make DESTDIR=/nfsroot/qtopia-arm-1.7.0 install

Page 45: 슬라이드 제목 없음 - wabar.tistory.comwabar.tistory.com/attachment/ck10.pdf작은크기– 2MB ... MPEG and MP3 players, international city clock, asteroid game, patience,

임베디드 소프트웨어 45

타겟 시스템에 기타 프로그램 설치

▣Qt/Embedded 라이브러리 재설치◈Qt/Embedded 소스의 src/kernel/qwsmouse_qws.cpp 파일 수정

◈Qt/Embedded 소스의 src/kernel/qwsmouse_qws.cpp 파일 수정

◈재컴파일 후 재설치

…#if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX)#if defined(QT_QWS_IPAQ)# ifdef QT_QWS_IPAQ_RAW

if ((mouseFD = open( "/dev/ads7846e", O_RDONLY | O_NDELAY)) < 0) {# else

if ((mouseFD = open( "/dev/ads7846e", O_RDONLY | O_NDELAY)) < 0) {# endif

qWarning( "Cannot open /dev/ads7846e (%s)", strerror(errno));…void QTPanelHandlerPrivate::readMouseData() ….

lastSample = 0;} else if (data->x != 0 && data->y != 0) {

currSample = 0;

…#endif // QT_H

#define QT_QWS_IPAQ

Page 46: 슬라이드 제목 없음 - wabar.tistory.comwabar.tistory.com/attachment/ck10.pdf작은크기– 2MB ... MPEG and MP3 players, international city clock, asteroid game, patience,

임베디드 소프트웨어 46

타겟 시스템에서 Qtopia 실행

▣타겟 접속 후 Qtopia 실행

$ mkdir /mnt/nfs$ mount –t nfs www.xxx.yyy.zzz:/nfsroot /mnt/nfs$ export QTDIR=/mnt/nfs/qtopia-arm-1.7.0$ export QPEDIR=/mnt/nfs/qtopia-arm-1.7.0$ export LD_LIBRARY_PATH=$QPEDIR/lib:$LD_LIBRARY_PATH$ export QWS_SIZE=“640x480”$ export TSLIB_PLUGINDIR=$QPEDIR/share/ts/plugins$ export TSLIB_TSEVENTTYPE=H3600$ export TSLIB_TSDEVICE =/dev/ads7846e$ export TSLIB_CONFFILE=$QPEDIR/etc/ts.conf$ mknod /dev/ads7846e c 11 240$ insmod $QPEDIR/ads7846e.o$ $QPEDIR/usr/local/bin/ts_calibrate$ cd $QPEDIR/bin$ ./qpe &>/dev/null

$ mkdir /mnt/nfs$ mount –t nfs www.xxx.yyy.zzz:/nfsroot /mnt/nfs$ export QTDIR=/mnt/nfs/qtopia-arm-1.7.0$ export QPEDIR=/mnt/nfs/qtopia-arm-1.7.0$ export LD_LIBRARY_PATH=$QPEDIR/lib:$LD_LIBRARY_PATH$ export QWS_SIZE=“640x480”$ export TSLIB_PLUGINDIR=$QPEDIR/share/ts/plugins$ export TSLIB_TSEVENTTYPE=H3600$ export TSLIB_TSDEVICE =/dev/ads7846e$ export TSLIB_CONFFILE=$QPEDIR/etc/ts.conf$ mknod /dev/ads7846e c 11 240$ insmod $QPEDIR/ads7846e.o$ $QPEDIR/usr/local/bin/ts_calibrate$ cd $QPEDIR/bin$ ./qpe &>/dev/null

Page 47: 슬라이드 제목 없음 - wabar.tistory.comwabar.tistory.com/attachment/ck10.pdf작은크기– 2MB ... MPEG and MP3 players, international city clock, asteroid game, patience,

임베디드 소프트웨어 47

타겟 시스템에 OPIE 설치▣ OPIE (Open Palmtop Integrated Environment)

◈ 리눅스 기반의 PDA 등을 위한 응용 슈트 및 GUI 환경◈ Qt/Embedded 기반 (GPE 는 GTK+ 기반)◈ http://opie.handhelds.org

▣ OPIE 설치◈ OPIE 소스 (opie-source-1.0.3.tar.bz2) 다운로드(http://opie.handhelds.org) ◈ OPIE 소스 파일파일을 특정 디렉토리에 푼다.

◈ Qt/Embedded 패치 및 재컴파일

$ tar xvfz qt-embedded-2.3.7.tar.gz$ mv qt-2.3.7 qt-E-arm-opie-2.3.7$ cd qt-E-arm-opie-2.3.7$ cp ../opie-arm-1.0.3/qt/qconfig-qpe.h src/tools$ patch –p1 < ../opie-arm-1.0.3/qt/qte-2.3.7-all.patch$ export QTDIR=`pwd`$ export PATH=$QTDIR/bin:$PATH$ export LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH$ ./configure –xplatform linux-arm-g++ –shared –qconfig qpe \–depths 4,8,16 –system-jpeg –releaseThis is the Qt/Embedded Free Edition.……..$ make

$ tar xvfz qt-embedded-2.3.7.tar.gz$ mv qt-2.3.7 qt-E-arm-opie-2.3.7$ cd qt-E-arm-opie-2.3.7$ cp ../opie-arm-1.0.3/qt/qconfig-qpe.h src/tools$ patch –p1 < ../opie-arm-1.0.3/qt/qte-2.3.7-all.patch$ export QTDIR=`pwd`$ export PATH=$QTDIR/bin:$PATH$ export LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH$ ./configure –xplatform linux-arm-g++ –shared –qconfig qpe \–depths 4,8,16 –system-jpeg –releaseThis is the Qt/Embedded Free Edition.……..$ make

$ tar xvfj opie-source.1.0.3.tar.bz2$ mv opie opie-arm-1.0.3

$ tar xvfj opie-source.1.0.3.tar.bz2$ mv opie opie-arm-1.0.3

Page 48: 슬라이드 제목 없음 - wabar.tistory.comwabar.tistory.com/attachment/ck10.pdf작은크기– 2MB ... MPEG and MP3 players, international city clock, asteroid game, patience,

임베디드 소프트웨어 48

타겟 시스템에 OPIE 설치

▣ OPIE 설치 계속◈ OPIE 설정

Opie Configuration 메뉴에서 각 항목을 적절히 선택– Build Parameters/Target Machine 메뉴에서 Ipaq 선택

– Build Parameters 메뉴에서 가장 아래 항목을 다음으로 대체

– Base 메뉴에서 Opie-login (Initial Login app, ala xdm/kdm/gdm) 선택 제외 – GDM 필요

– Apps 메뉴에서 calibrate(standalone) 선택

– Communications… 메뉴에서 gsmtool 선택 제외 – GSM 라이브러리 필요

– Games 메뉴에서 sfcave-sdl 선택 제외 – SDL 라이브러리 필요

저장한 다음 빠져 나옴

◈ 몇몇 파일 수정qmake 환경 수정: $(OPIEDIR)/mkspecs/qws/linux-ipaq-g++/qmake.conf 파일에서QMAKE_LINK 와 QMAKE_SHLIB 이 arm-linux-g++ 로 수정

Opie-reader 환경 수정: $(OPIEDIR)/noncore/apps/opie-reader/opie-reader.pro 파일에서INCPATH 에 $(QTDIR)/src/3rdparty/zlib 추가

◈ make

$ cd opie-arm-1.0.3$ export OPIEDIR=`pwd`$ export LD_LIBRARY_PATH=$OPIEDIR/lib:$LD_LIBRARY_PATH$ make clean$ make menuconfig

$ cd opie-arm-1.0.3$ export OPIEDIR=`pwd`$ export LD_LIBRARY_PATH=$OPIEDIR/lib:$LD_LIBRARY_PATH$ make clean$ make menuconfig

-mcpu=xscale –mtune=xscale -mapcs-32 –fexpensive-optimizations –fomit-frame-pointer -O2

Page 49: 슬라이드 제목 없음 - wabar.tistory.comwabar.tistory.com/attachment/ck10.pdf작은크기– 2MB ... MPEG and MP3 players, international city clock, asteroid game, patience,

임베디드 소프트웨어 49

타겟 시스템에 OPIE 설치

▣OPIE 설치 계속◈필요한 파일을 nfs 디렉토리로 복사

◈터치스크린 입력 디바이스 드라이버 설치 (이전 페이지 참고)◈Qt/Embedded 라이브러리 재설치 (이전 페이지 참고)◈타겟 접속 후 qpe 실행

$ cp –rf $OPIEDIR /nfsroot$ cp –rf $QTDIR/lib /nfsroot/opie-arm-1.0.3$ cp /usr/local/arm-linux/lib/libdl* /nfsroot/opie-arm-1.0.3/lib

$ cp –rf $OPIEDIR /nfsroot$ cp –rf $QTDIR/lib /nfsroot/opie-arm-1.0.3$ cp /usr/local/arm-linux/lib/libdl* /nfsroot/opie-arm-1.0.3/lib

$ mkdir /mnt/nfs$ mount –t nfs www.xxx.yyy.zzz:/nfsroot /mnt/nfs$ export QTDIR=/mnt/nfs/opie-arm-1.0.3$ export OPIEDIR=/mnt/nfs/opie-arm-1.0.3$ export LD_LIBRARY_PATH=$OPIEDIR/lib:$LD_LIBRARY_PATH$ export QWS_SIZE=“640x480”$ mknod /dev/ads7846e c 11 240$ insmod $OPIEDIR/ads7846e.o$ cd $OPIEDIR/bin$ ./qpe &>/dev/null

$ mkdir /mnt/nfs$ mount –t nfs www.xxx.yyy.zzz:/nfsroot /mnt/nfs$ export QTDIR=/mnt/nfs/opie-arm-1.0.3$ export OPIEDIR=/mnt/nfs/opie-arm-1.0.3$ export LD_LIBRARY_PATH=$OPIEDIR/lib:$LD_LIBRARY_PATH$ export QWS_SIZE=“640x480”$ mknod /dev/ads7846e c 11 240$ insmod $OPIEDIR/ads7846e.o$ cd $OPIEDIR/bin$ ./qpe &>/dev/null

Page 50: 슬라이드 제목 없음 - wabar.tistory.comwabar.tistory.com/attachment/ck10.pdf작은크기– 2MB ... MPEG and MP3 players, international city clock, asteroid game, patience,

임베디드 소프트웨어 50

타겟 시스템에 OPIE 설치

◈OPIE 실행 화면 (Qvfb 상에서 실행)

Page 51: 슬라이드 제목 없음 - wabar.tistory.comwabar.tistory.com/attachment/ck10.pdf작은크기– 2MB ... MPEG and MP3 players, international city clock, asteroid game, patience,

임베디드 소프트웨어 51

Qt/Embedded Programming 예제

▣Qt Designer 를 이용한 프로그래밍 예제◈Qt Designer 실행

◈Dialog 선택$ designer$ designer

Page 52: 슬라이드 제목 없음 - wabar.tistory.comwabar.tistory.com/attachment/ck10.pdf작은크기– 2MB ... MPEG and MP3 players, international city clock, asteroid game, patience,

임베디드 소프트웨어 52

Qt/Embedded Programming 예제

▣Qt Designer 를 이용한 프로그래밍 예제 계속◈Property Edit 창에서 속성 값 확인 및 변경

Name&Caption: Talk, maximumSize: (240,320)◈위젯 추가: MultiLineEdit, LineEdit, PushButton

Page 53: 슬라이드 제목 없음 - wabar.tistory.comwabar.tistory.com/attachment/ck10.pdf작은크기– 2MB ... MPEG and MP3 players, international city clock, asteroid game, patience,

임베디드 소프트웨어 53

Qt/Embedded Programming 예제

▣Qt Designer 를 이용한 프로그래밍 예제 계속◈Signal/Slot 연결

Connect Signal/Slots 항목 선택

LineEdit 위젯을 클릭한 후 MultiLineEdit 위젯까지 드래그

Signal 은 textChanged, slot 은 setText 로 선택

◈저장talk.ui

Page 54: 슬라이드 제목 없음 - wabar.tistory.comwabar.tistory.com/attachment/ck10.pdf작은크기– 2MB ... MPEG and MP3 players, international city clock, asteroid game, patience,

임베디드 소프트웨어 54

Qt/Embedded Programming 예제

▣Qt Designer 를 이용한 프로그래밍 예제 계속◈프로젝트 파일 제작 : talk.pro

◈소스 파일 제작 : main.cpp

TEMPLATE = appCONFIG = qt warn_on releaseSOURCES = main.cppINTERFACES = talk.uiTARGET = talk

TEMPLATE = appCONFIG = qt warn_on releaseSOURCES = main.cppINTERFACES = talk.uiTARGET = talk

#include <qapplication.h>#include "talk.h"

int main (int argc, char **argv){

QApplication a(argc, argv);Talk *mw = new Talk;mw->show();a.connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()) );

return a.exec();}

#include <qapplication.h>#include "talk.h"

int main (int argc, char **argv){

QApplication a(argc, argv);Talk *mw = new Talk;mw->show();a.connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()) );

return a.exec();}

Page 55: 슬라이드 제목 없음 - wabar.tistory.comwabar.tistory.com/attachment/ck10.pdf작은크기– 2MB ... MPEG and MP3 players, international city clock, asteroid game, patience,

임베디드 소프트웨어 55

Qt/Embedded Programming 예제

▣Qt Designer 를 이용한 프로그래밍 예제 계속◈사용자 인터페이스 소스 생성 : talk.h, talk.cpp

◈Makefile 생성 및 make

“undefined …GWizard:staticMetaObject” 오류 발생 시

– qt-E-x86-2.3.7 소스 파일(src/dialogs/qwizard.h) 수정 후 재컴파일

$ uic talk.ui > talk.h$ uic –impl talk.h talk.ui > talk.cpp

$ uic talk.ui > talk.h$ uic –impl talk.h talk.ui > talk.cpp

$ tmake talk.pro –o Makefile$ make

$ tmake talk.pro –o Makefile$ make

….#ifndef QT_H#include "qdialog.h"#endif // QT_H

#define QT_NO_WIZARD#if !defined(QT_NO_WIZARD) && ( !defined(QT_NO_WIZARD_IMPL) || !defined(QT_MOC_CPP) )

….#ifndef QT_H#include "qdialog.h"#endif // QT_H

#define QT_NO_WIZARD#if !defined(QT_NO_WIZARD) && ( !defined(QT_NO_WIZARD_IMPL) || !defined(QT_MOC_CPP) )

Page 56: 슬라이드 제목 없음 - wabar.tistory.comwabar.tistory.com/attachment/ck10.pdf작은크기– 2MB ... MPEG and MP3 players, international city clock, asteroid game, patience,

임베디드 소프트웨어 56

Qt/Embedded Programming 예제

▣Qt Designer 를 이용한 프로그래밍 예제 계속

◈실행

$ qvfb –depth 16 &$ ./talk -qws

$ qvfb –depth 16 &$ ./talk -qws

Page 57: 슬라이드 제목 없음 - wabar.tistory.comwabar.tistory.com/attachment/ck10.pdf작은크기– 2MB ... MPEG and MP3 players, international city clock, asteroid game, patience,

임베디드 소프트웨어 57

▣ 타겟 시스템 Qtopia 에 응용 프로그램 추가하기◈소스 파일 수정

Main 및 소스 파일 수정

프로젝트 파일(.pro) 수정

◈Make

컴파일 오류 점검– tmake 환경 확인: $(TmakeDir)/lib/qws/linux-arm-g++/tmake.conf 파일에서

TMAKE_LINK 와 TMAKE_SHLIB 이 arm-linux-g++ 인지 확인

– TMAKEPATH, QTDIR, QPEDIR, LD_LIBRARY_PATH, PATH 확인

– moc. uic 파일 경로 및 Qt/X11 로부터 복사 확인

#include <qapplication.h> #include <qpeapplication.h>QApplication app(argc, argv) QPEApplication app(argc, argv)

Qt/Embedded Programming 예제

#include <qapplication.h> #include <qpeapplication.h>QApplication app(argc, argv) QPEApplication app(argc, argv)

INCLUDEPATH += $(QPEDIR)/includeDEPENDPATH += $(QPEDIR)/includeINCLUDEPATH += $(QPEDIR)/include/qtopiaDEPENDPATH += $(QPEDIR)/include/qtopiaLIBS += -L$(QPEDIR)/lib -lqpe

INCLUDEPATH += $(QPEDIR)/includeDEPENDPATH += $(QPEDIR)/includeINCLUDEPATH += $(QPEDIR)/include/qtopiaDEPENDPATH += $(QPEDIR)/include/qtopiaLIBS += -L$(QPEDIR)/lib -lqpe

$ tmake –o Makefile hello.pro$ make

$ tmake –o Makefile hello.pro$ make

Page 58: 슬라이드 제목 없음 - wabar.tistory.comwabar.tistory.com/attachment/ck10.pdf작은크기– 2MB ... MPEG and MP3 players, international city clock, asteroid game, patience,

임베디드 소프트웨어 58

Qt/Embedded Programming 예제

[Desktop Entry]Comment = First Example : helloExec = helloType = ApplicationName = hello

[Desktop Entry]Comment = First Example : helloExec = helloType = ApplicationName = hello

▣ 타겟 시스템 Qtopia 에 응용 프로그램 추가하기

◈파일 추가

Desktop 정보 파일 : $(QPEDIR)/apps/Applications/hello.desktop

$(QPEDIR)/bin 에 실행 파일 복사

$(QPEDIR)/pics 에 실행 아이콘 만들어 둠.◈ QPE 실행

Page 59: 슬라이드 제목 없음 - wabar.tistory.comwabar.tistory.com/attachment/ck10.pdf작은크기– 2MB ... MPEG and MP3 players, international city clock, asteroid game, patience,

임베디드 소프트웨어 59

Qt/Embedded Programming 실습

▣타겟 임베디드 시스템에 Qt/Embedded 와 Qtopia 설치

▣호스트 컴퓨터에서 간단한 Qt GUI 프로그램 작성 및 설치

▣타겟 임베디드 시스템에 간단한 채팅 프로그램 설치 및 호스트와 연결 테스트