ÀÌ ¸Å´º¾óÀº JKÀüÀÚ(JK Electronics) ¿¡ ÀÇÇؼ ¹ø¿ª, ¼öÁ¤, ÀÛ¼º µÇ¾ú°í ¼ÒÀ¯±Ç ¶ÇÇÑ JKÀüÀÚ(JK Electronics)ÀÇ °ÍÀÔ´Ï´Ù. ¼ÒÀ¯±ÇÀÚÀÇ Çã°¡¸¦ ¹ÞÁö ¾Ê°í ¹«´ÜÀ¸·Î ¼öÁ¤, »èÁ¦Çϰųª ¹èÆ÷ ÇÒ ¼ö ¾ø½À´Ï´Ù. |
|||||||||||||||||||||||||||
S3C6410 Start Kit QT2.2.0 Application Developer Guide |
|||||||||||||||||||||||||||
* Update history - 2011.4.23 : Ãʱâ Release |
|||||||||||||||||||||||||||
ÀÌ ¸Þ´º¾óÀº Qtopia-2.2.0, Qt-Extendded-4.4.3 (Qtopia Phone Edition), QtE-4.7.0¸¦ S3C6410 Start Kit ¾îÇø®ÄÉÀÌ¼Ç °³¹ß¿¡ ´ëÇÑ ³»¿ëÀ» ¼³¸íÇÏ´Â ¸Þ´º¾ó ÀÔ´Ï´Ù. 1. Qtopia 2.2.0 Application Programming
|
#include "main_form.h" |
main.cpp ´Â ´Ü¼øÈñ 4ÁÙÀÇ ¸ÅÅ©·Î È®Àå ÄÚµå·Î ÀÌ·ç¾îÁø °£´ÜÇÑ main ÇÔ¼ö ÀÔ´Ï´Ù. TMainForm ´Â main window object ·Î QApplication::exec () ¸¦ ½ÇÇà ½ÃÅ°°í main event loop ·Î ÁøÀÔ ÇÕ´Ï´Ù. main_form.h ÆÄÀÏÀº ¾øÀ¸¹Ç·Î »õ·Î »ý¼º ÇØ¾ß ÇÕ´Ï´Ù.
main.cpp¿Í ¸¶Âù°¡Áö·Î vi ¿¡µðÅ͸¦ ÀÌ¿ëÇؼ »ý¼º ÇÕ´Ï´Ù.
# vi main_form.h
#if !defined (__MAIN_FORM_H__) |
Ãß°¡·Î main_form.hÀ» Æ÷ÇÔÇÏ´Â main_form_base.h ÆÄÀÏÀÌ Àִµ¥ ÀÌ ÆÄÀÏÀº °³¹ßÀÚ°¡ »ý¼ºÇÏ´Â ÆÄÀÏÀÌ ¾Æ´Ï°í UI µðÀÚÀÌ³Ê Åø¿¡¼ ÀÚµ¿À¸·Î »ý¼º ½ÃÅ°´Â ÆÄÀÏ ÀÔ´Ï´Ù. ÀÌÁ¦ ½ÇÁ¦·Î À̺¥Æ®°¡ ¹ß»ý ÇßÀ» °æ¿ì ó¸®ÇÏ´Â À̺¥Æ® Çڵ鷯 ÇÔ¼ö¸¦ ÀÛ¼º ÇÕ´Ï´Ù.
# vi main_form.cpp
#include "main_form.h" |
¼Ò½ºÄڵ忡 ´ëÇؼ ÀÚ¼¼ÇÑ ¼³¸íÀº ÇÏÁö ¾Ê¾Æµµ ¾î¶² ³»¿ëÀÎÁö ¾Ë ¼ö ÀÖÀ»°Í °°½À´Ï´Ù.
¸ðµç ¼Ò½ºÄÚµåµéÀÇ ¼öÁ¤ÀÌ ¿Ï·á µÇ¾úÀ¸¸é ÄÄÆÄÀÏ ÇϱâÀü¿¡ ¸¶Áö¸·À¸·Î ÇÁ·ÎÁ§Æ® ÆÄÀÏÀ» ÀÛ¼ºÇØ¾ß ÇÕ´Ï´Ù.
# vi mycalc.pro
CONFIG += qtopiaapp |
CONFIG+=qtopiaapp : Qtopia ÇÁ·Î±×·¥ÀÇ Á¾·ù ÀÔ´Ï´Ù.
HEADERS and SOURCES : mycalc ÇÁ·ÎÁ§Æ®ÀÇ ¼Ò½ºÄÚµå¿Í Çì´õ ÆÄÀÏÀ» ³ª¿ ÇÕ´Ï´Ù.
TARGET : ÄÄÆÄÀÏ ÈÄ »ý¼ºµÇ´Â ÃÖÁ¾ ½ÇÇà ÆÄÀÏÀÇ À̸§À» ÀÔ·Â ÇÕ´Ï´Ù.
(5) x86¿ë ÄÄÆÄÀÏ ¹× ½ÇÇà
PC¹öÁ¯ÀÇ ÄÄÆÄÀÏ ½ºÅ©¸³Æ®ÀÎ "buildhost.sh" ¸¦ ½ÇÇà ½Ãŵ´Ï´Ù. Âü°í·Î "buildhost.sh" ÆÄÀÏÀº PC¹öÁ¯ÀÇ qt applicationÀÇ ÄÄÆÄÀÏÀ» ÆíÇÏ°Ô Çϱâ À§Çؼ ¹Ì¸® ¸¸µé¾îµÐ ½ºÅ©¸³Æ® ÆÄÀÏ ÀÔ´Ï´Ù. ½ºÅ©¸³Æ®ÀÇ ³»¿ëÀº ¾Æ·¡¿Í °°½À´Ï´Ù.
#!/bin/sh |
½ºÅ©¸³Æ® ÆÄÀÏ¿¡ ½ÇÇà ±ÇÇÑÀ» ºÎ¿© ÇÕ´Ï´Ù.
# chmod +x buildhost.sh
ºôµå ½ºÅ©¸³Æ®¸¦ ½ÇÇà ÇÕ´Ï´Ù. ½ºÅ©¸³Æ®°¡ ¼º°øÀûÀ¸·Î ½ÇÇàµÇ±â À§Çؼ´Â "/opt/ qtopia-free-2.2.0/" ¿¡ qtopia 2.2.0 ÀÌ ¼³Ä¡ µÇ¾î ÀÖ¾î¾ß ÇÕ´Ï´Ù. ¸¸¾à qtopia°¡ ´Ù¸¥ °æ·Î¿¡ ¼³Ä¡µÇ¾î ÀÖ´Ù¸é À§ÀÇ ½ºÅ©¸³Æ® ÆÄÀÏ ³»¿ëÁß¿¡¼ "source /opt/qtopia-free-2.2.0/setQpeEnv" ºÎºÐÀ» ÀûÀýÇÏ°Ô ¼öÁ¤ÇØ ÁÖ¸é µË´Ï´Ù.
# ./buildhost.sh
ÄÄÆÄÀÏÀÌ ¼º°øÀûÀ¸·Î ¿Ï·áµÇ¸é mycalc µð·ºÅ丮¿¡ mycalc ½ÇÇà ÆÄÀÏÀÌ »ý¼º µË´Ï´Ù. »ý¼ºµÈ ½ÇÇàÆÄÀÏÀ» PC¿¡¼ ½ÇÇà½ÃÄÑ º¾´Ï´Ù. ¾Æ·¡ ¸í·ÉÀº mycalc¸¦ ½ÇÇà ½ÃÅ°±â Àü¿¡ ¸ÕÀú qtopia¸¦ ½ÇÇà½ÃÅ°´Â ¸í·É ÀÔ´Ï´Ù.
# cd /opt/qtopia-free-2.2.0/
# ./run&
qtopia¸¦ ½ÇÇà½ÃÅ°°í ³ÈÄ¿¡ ¸î°¡Áö ȯ°æ º¯¼ö¸¦ µî·ÏÇÏ°í mycalc ¾îÇø®ÄÉÀ̼ÇÀ» ½ÇÇà ÇÕ´Ï´Ù. ȯ°æ º¯¼öµéÀº ¸®´ª½º »ç¿ëÀÚ ÇÁ·ÎÆÄÀÏ¿¡ µî·Ï ½ÃÄѳõÀ¸¸é Æí¸® ÇÕ´Ï´Ù.
# cd /opt/mini6410/qtopia2_apps/mycalc
# export QTDIR=/opt/qtopia-free-2.2.0/qtopia/image/opt/Qtopia/
# export QPEDIR=/opt/qtopia-free-2.2.0/qtopia/image/opt/Qtopia/
# export HOME=$QPEDIR/root/
# export LD_LIBRARY_PATH=$QPEDIR/lib:$LD_LIBARAY_PATH
# ./mycalc
(6) ARM¿ë ÄÄÆÄÀÏ ¹× ½ÇÇà
x86¿ë ÄÄÆÄÀÏÇÒ¶§¿Í ¸¶Âù°¡Áö·Î ÄÄÆÄÀÏÀ» Æí¸®ÇÏ°Ô Çϱâ À§Çؼ ¿ì¸®´Â "buildarm.sh" ½ºÅ©¸³Æ®¸¦ ¹Ì¸® ¸¸µé¾î µÎ¾ú½À´Ï´Ù. ÀÌ ½ºÅ©¸³Æ®¸¦ ½ÇÇàÇÏ¿© ARM¹öÁ¯À¸·Î ¾îÇø®ÄÉÀ̼ÇÀ» ÄÄÆÄÀÏ ÇÕ´Ï´Ù. ½ºÅ©¸³Æ® ÆÄÀÏÀÇ ³»¿ëÀº ¾Æ·¡¿Í °°½À´Ï´Ù.
# vi buildarm.sh
#!/bin/sh source |
½ºÅ©¸³Æ® ÆÄÀÏ¿¡ ½ÇÇà±ÇÇÑÀ» ºÎ¿©ÇÏ°í ½ºÅ©¸³Æ®¸¦ ½ÇÇàÇÏ¿© ÄÄÆÄÀÏÀ» ÇÕ´Ï´Ù.
# chmod +x buildarm.sh
ºôµå ½ºÅ©¸³Æ®¸¦ ½ÇÇà ÇÕ´Ï´Ù. ½ºÅ©¸³Æ®°¡ ¼º°øÀûÀ¸·Î ½ÇÇàµÇ±â À§Çؼ´Â "/opt/ qtopia-free-2.2.0/" ¿¡ qtopia 2.2.0 ÀÌ ¼³Ä¡ µÇ¾î ÀÖ¾î¾ß ÇÕ´Ï´Ù. ¸¸¾à qtopia°¡ ´Ù¸¥ °æ·Î¿¡ ¼³Ä¡µÇ¾î ÀÖ´Ù¸é À§ÀÇ ½ºÅ©¸³Æ® ÆÄÀÏ ³»¿ëÁß¿¡¼ "source /opt/qtopia-free-2.2.0/setQpeEnv" ºÎºÐÀ» ÀûÀýÇÏ°Ô ¼öÁ¤ÇØ ÁÖ¸é µË´Ï´Ù.
# ./buildarm.sh
°³¹ß¿ë PC¿¡¼ ÄÄÆÄÀÏÇÑ °á°ú¹°À» SD¸Þ¸ð¸®¿¡ º¹»çÇÑ´ÙÀ½ °³¹ßº¸µå¿¡ SD¸Þ¸ð¸®¸¦ »ðÀÔÇÏ°í ½ÇÇàÆÄÀÏÀ» Qtopia/bin µð·ºÅ丮¿¡ º¹»çÇÑ´ÙÀ½ ½ÇÇà ±ÇÇÑÀ» ºÎ¿© ÇÕ´Ï´Ù.
# cp /sdcard/mycalc /opt/Qtopia/bin/
# chmod +x /opt/Qtopia/bin/mycalc
¾ÆÁ÷Àº Qtopiaȯ°æ¿¡ ½ÇÇà ¾ÆÀÌÄÜÀÌ µî·ÏµÇÁö ¾Ê´Â »óÅÂÀ̹ǷΠ¸í·ÉÇà¿¡¼ ½ÇÇàÇØ º¸µµ·Ï ÇÏ°Ú½À´Ï´Ù.
# cp /bin/run_my_qtopia /bin/run_mycalc
# vi /bin/run_mycalc
run_mycalc ÆÄÀÏÀÇ ¸¶Áö¸· ÁÙÀÇ
exec $QPEDIR/bin/qpe ¸¦ exec $QPEDIR/bin/mycalc ·Î ¼öÁ¤ÇÏ°í ¾Æ·¡ ¸í·ÉÀ» ¼öÇà ÇÕ´Ï´Ù.
# chmod +x /bin/run_mycalc
# run_mycalc&
(7) mycalc ÇÁ·Î±×·¥À» Qtopia ȯ°æ¿¡ ¾ÆÀÌÄÜÀ¸·Î µî·ÏÇؼ ½ÇÇà
¾ÕÀý¿¡¼´Â ¸í·ÉÇà¿¡¼ ÇÁ·Î±×·¥À» ½ÇÇà½ÃÅ°´Â ¹æ¹ý¿¡ ´ëÇؼ ¾Ë¾Æ º¸¾Ò°í À̹ø¿¡´Â Qtopia½ÇÇà ȯ°æ¿¡¼ ¾ÆÀÌÄÜÀ¸·Î µî·ÏÇؼ ½ÇÇàÇÏ´Â ¹æ¹ý¿¡ ´ëÇؼ ¾Ë¾Æº¸µµ·Ï ÇÕ´Ï´Ù. Fedora9ÀÇ "/usr/share/icons/hicolor/48x48/apps" µð·ºÅ丮¿¡ ¸î°¡Áö Àç¹ÌÀÖ´Â ¾ÆÀÌÄܵéÀÌ ÀÖ½À´Ï´Ù. ±× Áß¿¡¼ ¿ì¸®´Â "gnome-sudoku.png" ÆÄÀÏÀ» mycalc ÇÁ·Î±×·¥ÀÇ ½ÇÇà ¾ÆÀÌÄÜÀ¸·Î »ç¿ëÇØ º¸µµ·Ï ÇսôÙ. °³¹ß¿ë PC¿¡¼ ¾Æ·¡ ¸í·ÉÀ» ÀÔ·Â ÇÕ´Ï´Ù.
# cd /usr/share/icons/hicolor/48x48/apps/
# cp gnome-sudoku.png /opt/mini6410/qtopia2_apps/mycalc/mycalc.png
¸ÕÀú mycalc¿¡ ´ëÇÑ desktop ÆÄÀÏÀ» ÀÛ¼º ÇÕ´Ï´Ù.
# cd /opt/mini6410/qtopia2_apps/mycalc/
# vi mycalc.desktop
[Translation] |
°³¹ß¿ë PC¿¡¼ ÀÛ¼ºµÈ mycalc.png, mycalc.desktop ÆÄÀÏÀ» SD¸Þ¸ð¸®¿¡ º¹»çÇÑÈÄ SD¸Þ¸ð¸®¸¦ °³¹ßº¸µå¿¡ »ðÀÔÇÑÈÄ ´ÙÀ½ ¸í·ÉÀ» ½ÇÇà ÇÕ´Ï´Ù.
# cp /sdcard/mycalc.desktop /opt/Qtopia/apps/Applications/
# cp /sdcard/mycalc.png /opt/Qtopia/pics/
ÆÄÀÏ º¹»ç°¡ ¿Ï·áµÇ¸é °³¹ßº¸µå¸¦ ÀçºÎÆà ÇÕ´Ï´Ù.
À̹ø Àý¿¡¼´Â Qtopia 2.2.0¿¡ "MyApps" ¶ó´Â ÇÁ·Î±×·¥ ±×·ìÀ» »ý¼º½ÃÅ°°í ¿ì¸®°¡ ÀÛ¼ºÇÑ ¾îÇø®ÄÉÀ̼ǵéÀ» »õ·Î »ý¼ºÇÑ ±×·ì¿¡ Æ÷ÇÔ½ÃÅ°µµ·Ï ÇØ º¾½Ã´Ù.
¸ÕÀú "/opt/mini6410/qtopia2_apps/" µð·ºÅ丮¸¦ »ý¼ºÇÏ°í »ý¼ºµÈ µð·ºÅ丮¾È¿¡ ".directory" ÆÄÀÏÀ» ÀÛ¼º ÇÕ´Ï´Ù.
# mkdir -p /opt/mini6410/qtopia2_apps/MyApps/
# cd /opt/mini6410/qtopia2_apps/MyApps/
# vi .directory
[Translation] |