2016年10月27日 星期四

設定DragonBoard Navigation Bar顯示

將PROP_QEMU_NAVKEY設定為0

property_set(PROP_QEMU_NAVKEY, 0);



2014年9月2日 星期二

mtdev2tuio放上DM8134發生not found問題


  • 把mtdev2tuio放上DM8134執行,出現not found訊息
  • 猜想可能是跟之前在Makefile裡加入--entry=main有關,因此修改Makefile把這參數拿掉,重新build再放到DM8134上執行,結果依然出現not found訊息
  • 拿同時build的其他package測試。在mtdev裡面有mtdev-test程式,在liblo裡面有oscsend、oscdump兩隻程式,各自執行都沒有問題
  • 由上推測可能跟mtdev2tuio使用的toolchain設定有關
  • 修改mtdev2tuio程式,修改成只印出"hello world",不必要的include也全部拿掉,Makefile不修改,重新make過後傳送到DM8134執行,結果還是同樣出現not found訊息
  • 在TI DM813x_Software_Develoers_Guide文件裡面有教人建立helloworld程式的教學,因此決定依照這教學一步步建立helloworld程式,看編譯完後能不能執行
  • 編譯完TI提供的helloworld的教學程式,傳送到DM8134執行,結果沒問題
  • TI的教學程式跟自己修改mtdev2tuio程式的最大差別在於compile指令不同,因此決定使用TI教學的compile指令來編譯我的mtdev2tuio程式
  • 編譯完後傳送到DM8134執行,結果可以正常執行
  • 得到結論問題應該在Makefile
  • 問題似乎發生在LD階段,如果將LD階段要做的事情移到CC階段做,編譯出來的執行檔就可以執行
  • 直接下GCC指令,將GCC指令修改如後

arm-none-linux-gnueabi-gcc -I/media/DM8134/src/board-support/linux-2.6.37-psp04.04.00.01/usr/include/ -I/mnt/hgfs/share/qtuio/liblo/include/ -I/mnt/hgfs/share/qtuio/mtdev-1.1.2/include/ -L/media/DM8134/targetfs/lib/ -L/media/DM8134/targetfs/usr/lib/liblo/lib/ -L/media/DM8134/targetfs/usr/lib/mtdev/lib/ -o touchtest mtdev2tuio.c -Wl,-Bstatic -lmtdev -llo -Wl,-Bdynamic -lc -lgcc_s -lm


  • 編譯完送到DM8134執行,結果沒有問題

其他學到的東西
  • 用file指令可以查看binary的簡介
  • 用arm-none-linux-gnueabi-ranlib可以看binary的詳細內容
  • .so是shared library、.a是static library、.la是描述.a檔案的文字檔

2014年8月29日 星期五

cross compile mtdev2tuio for TI DM8134 - Cont.

yesterday I successfully build mtdev2tuio, but there were still some warnings left. So today I try to resolve these warnings.

There are 4 warning of 3 types.


the first one is "Attempt to use kernel headers from user space"

check the website

The problem comes from using wrong header files. To solve this problem, we should make our gcc to use correct include path.

In our bsp, go to root of kernel and type the command

sudo make headers_install ARCH=arm INSTALL_HDR_PATH=./usr/

It will generate header files of the kernel


check the usr directory and we find the include directory in it, good.



next, in our make file, we have to add this path for gcc while compiling

arm-none-linux-gnueabi-gcc -nostdlib  -I/media/DM8134/src/board-support/linux-2.6.37-psp04.04.00.01/usr/include/ -I/mnt/hgfs/share/qtuio/liblo/include/ -I/mnt/hgfs/share/qtuio/mtdev-1.1.2/include -c mtdev2tuio.c

check the result, the warning disappeared, great!!





Next, let's take a look of these two warnings

e-linux-gnueabi-ld: warning: library search path "/usr/local/lib/liblo/lib/" is unsafe for cross-compilation
arm-none-linux-gnueabi-ld: warning: library search path "/usr/local/lib/mtdev/lib/" is unsafe for cross-compilation


These warnings come with (probably) wrong lib path setting. We cross compile object files for TI DM8134 (ARM arch) but out library refer to the path of Ubuntu(i386). It seems something wrong.

While I started to port TUIO to DM8134, I found a great reference. The author told us to cross compile necessary libs (liblo, mtdev), install them to /usr/local/lib/, and then load them in the linking stage. It is not wrong, but it is very dirty.

The better way to solve these two warnings is to set the install path of libs to our development directory. In this case, it is under targetfs/usr/lib/. So first, install them to targetfs/usr/lib/.


Second, add the path to our ld command

arm-none-linux-gnueabi-ld  mtdev2tuio.o -o mtdev2tuio -L/media/DM8134/targetfs/usr/lib/liblo/lib/ -L/media/DM8134/targetfs/usr/lib/mtdev/lib/ -lmtdev -llo -lc -lgcc_s -lm

check the result again


the warning disappeared

Wwwonderful!!

Last, the warning 

warning: cannot find entry symbol _start; defaulting to 000096e0

please refer to this website

add "--entry main" to tell ld what the entry function is

arm-none-linux-gnueabi-ld --entry main mtdev2tuio.o -o mtdev2tuio -L/media/DM8134/targetfs/usr/lib/liblo/lib/ -L/media/DM8134/targetfs/usr/lib/mtdev/lib/ -lmtdev -llo -lc -lgcc_s -lm


OK, we can see all warnings generated from gcc and ld are cleared.

P.S. there is still a warning, this is because I use VM to develop, and it seems cause the clock skew.

2014年8月28日 星期四

cross compile mtdev2tuio for TI DM8134

refer to this article

Building mtdev2tuio needs header files of mtdev and liblo, since these two packages are built and install into directories respectively. We can add -I option to gcc command

arm-none-linux-gnueabi-gcc -I/mnt/hgfs/share/qtuio/liblo/include/ -I/mnt/hgfs/share/qtuio/mtdev-1.1.2/include -c mtdev2tuio.c


and we can find the object file is generated (mtdev2tuio.o).


next, link corresponding libs to generate executable.

mtdev and liblo was made and installed into its directories, so we can use -L to load the path and -l to load the lib

arm-none-linux-gnueabi-ld  -o mtdev2tuio mtdev2tuio.o -L/media/DM8134/targetfs/lib -L/usr/lib/liblo/lib/ -L/usr/local/lib/mtdev/lib/ -lmtdev -llo

and we get



God damn it! I never got so many errors in one make.

No worry. It seems that we lack of some libs (printf, free)

so add -lc to add libc into the link stage

arm-none-linux-gnueabi-ld  -o mtdev2tuio mtdev2tuio.o -L/media/DM8134/targetfs/lib -L/usr/lib/liblo/lib/ -L/usr/local/lib/mtdev/lib/ -lmtdev -llo -lc



again, we get a bunch of error messages.

no worry. Just search Google and it give us a good result as usual

the error message is about lacking libs of gcc, so find something looks like "libgcc" in our building environment


and we found there is a libgcc_s in lib, that is it. add it into our link command

arm-none-linux-gnueabi-ld  -o mtdev2tuio mtdev2tuio.o -L/media/DM8134/targetfs/lib -L/usr/lib/liblo/lib/ -L/usr/local/lib/mtdev/lib/ -lmtdev -llo -lc -lgcc_s

press enter! unfortunately there are still errors while linking.


Search Google and I found it

add -lm to the command

arm-none-linux-gnueabi-ld  -o mtdev2tuio mtdev2tuio.o -L/media/DM8134/targetfs/lib -L/usr/lib/liblo/lib/ -L/usr/local/lib/mtdev/lib/ -lmtdev -llo -lc -lgcc_s -lm


and we can find the binary is generated


There are still 3 warnings while linking.

Leave it tomorrow.

:Q


cross compile mtdev for TI DM8134

while making mtdev, the error log shows that



'const struct input_absinfo' has no member named 'resolution'

so check the include file first

go to the include directory, and type the command : $CC -M mtdev.h to get the path of all header files

the result is as follows



we can find that the file input.h is from CodeSourcery directory. We want to reference it from our source tree(/media/DM8134/src/...). So I set the env parameter

export C_INCLUDE_PATH=/media/DM8134/src/board-support/linux-2.6.37-psp04.04.00.01/include

observe the parameter



C_INCLUDE_PATH is now set

make again



OK, we got a new error message. 

error: asm/bitsperlong.h: No such file or directory

check my include path again, I find there is a "asm-generic" directory in it but no "asm" directory.

brute force!! copy asm-generic to asm



OK

make again



so it seems that it can be built now

go to upper (mtdev) directory, make and install

make

lot of warnings...



make install

remember to set PATH parameter when using sudo to make install

sudo env PATH=$PATH make install



all files are installed into corresponding directories under /usr/local/lib/mtdev/




done!!

見招拆招!!


2014年6月17日 星期二

記錄一下自己vim的hotkey

Tabs相關

  • 產生新tab:<Ctrl-T><Ctrl-T>
  • 關掉目前的tab:<Ctrl-T><Ctrl-W>
  • 移到前ㄧ個tab:<Shift-H>
  • 移到下ㄧ個tab:<Shift-L>

Split(分割視窗)相關

  • 移到左split:<Ctrl-w>H
  • 移到右split:<Ctrl-w>L
  • 移到上split:<Ctrl-w>K
  • 移到下split:<Ctrl-w>J

開啓/關閉NERDTree:<Fn><F6>

開啓/關閉TagBar:<Fn><F7>

ctags

  • 搜尋游標所在變數、函式定義:<Ctrl-w>]
  • 回到搜尋處:<Ctrl-w>t

cscope

  • <Fn>s   symbol: find all references to the token under cursor
  • <Fn>g   global: find global definition(s) of the token under cursor
  • <Fn>c   calls:  find all calls to the function name under cursor
  • <Fn>t   text:   find all instances of the text under cursor
  • <Fn>e   egrep:  egrep search for the word under cursor
  • <Fn>f   file:   open the filename under cursor
  • <Fn>i   includes: find files that include the filename under cursor
  • <Fn>d   called: find functions that function under cursor calls

script to generate cscope and ctags files

因為工作需要,所以寫了一個簡單的shell script來幫忙產生新的ctags以及cscope檔案



# put this script to the top directory of source code
CSCOPE_PATH=`pwd`
CTAGS_PATH=`pwd`
# remove cscope files
echo "remove cscpoe.out"
if [ -f $CSCOPE_PATH/cscope.out ]; then
    rm cscope.out
fi
echo "remove cscpoe.in.out"
if [ -f $CSCOPE_PATH/cscope.in.out ]; then
    rm cscope.in.out
fi
echo "remove cscpoe.po.out"
if [ -f $CSCOPE_PATH/cscope.po.out ]; then
    rm cscope.po.out
fi
# remove ctags files
echo "remove tags"
if [ -f $CTAGS_PATH/tags ]; then
    rm tags
fi
# recreate cscpoe files
cscope -Rbkq
ctags -R
# use the following script instead of 'cscpoe -Rbkq' to add .cc into cscope
#find . -name "*.h" -o -name "*.c"-o -name "*.cc" > cscope.files
#cscope -bkq -i cscope.files

其實用for loop來寫比較簡潔,不過這樣寫比較容易懂,所以算了 XD

另外好像應該找一個可以模擬script的css來用比較好讀