簡單來說兩者都屬於無線傳輸的一種,Zibgee較適合用於sensor network or 家用遙控技術上,NFC則算是RFID的一種應用於電子錢包&商品查詢&付費等等,最近中華電信也推出NFC皮套的服務,可以用於電子付款用
Zigbee跟NFC我發現的最大差別在於
1.距離(10~75m vs <20cm )
2.無線頻率(2.4G/868M/915M vs 13.65MB) - 當zigbee走2.4G可能會跟一般家用wifi干擾到
3.速度(10~250kbps vs 425kbps)
4.價錢(NFC比zigbee來的便宜)
參考:
http://www.cteccb.org.tw/pdf/IECQ-50-7.pdf
1.zigbee介紹
http://zh.wikipedia.org/wiki/ZigBee
2.NFC介紹
http://www.gs1tw.org/twct/gs1w/download/7.pdf
3.悠遊卡NFC背夾 讓iPhone 4也能當信用卡
http://mag.udn.com/mag/digital/storypage.jsp?f_MAIN_ID=323&f_SUB_ID=2952&f_ART_ID=359451
2012年4月23日 星期一
在linux下trace code的神兵- cscope
因為工作的關係常常需要在linux下trace code
這裡分享的是如何利用vim+cscope去trace code
當然如果你覺得Source insight已經很夠用的話就可以自動略過這篇文章
首先先安裝相關套件
拿Fedora為例
yum install cscope
yum install ctags
然後利用下面的myscope.sh去建立database以利trace
#!/bin/sh
#1.搜尋相關興趣的副檔名
find . -name "*.h" -o -name "*.c" -o -name "*.cc" -o -name "*.cpp" -name "*.pp" > cscope.files
#2.根據找到的檔案做關連
cscope -bkq -i cscope.files
ctags -R
接著打開vim
cs add cscope.out //加入資料庫
接著就可以開始trace code拉
使用方法
s: 查找C语言符号,即查找函数名、宏、枚举值等出现的地方
g: 查找函数、宏、枚举等定义的位置,类似ctags所提供的功能
d: 查找本函数调用的函数
c: 查找调用本函数的函数
t: 查找指定的字符串
e: 查找egrep模式,相当于egrep功能,但查找速度快多了
f: 查找并打开文件,类似vim的find功能
i: 查找包含本文件的文
例如想搜尋foo函數定義的地方
:cs f g foo
或者是全部檔案有出現foo的函數/變數
:cs f s foo
或者是想搜尋example.c這個檔案在哪的地方
:cs f f example.c
其他的功能就自已去玩囉
參考連結:
http://www.cnblogs.com/jianyungsun/archive/2011/07/24/2115298.html
這裡分享的是如何利用vim+cscope去trace code
當然如果你覺得Source insight已經很夠用的話就可以自動略過這篇文章
首先先安裝相關套件
拿Fedora為例
yum install cscope
yum install ctags
然後利用下面的myscope.sh去建立database以利trace
#!/bin/sh
#1.搜尋相關興趣的副檔名
find . -name "*.h" -o -name "*.c" -o -name "*.cc" -o -name "*.cpp" -name "*.pp" > cscope.files
#2.根據找到的檔案做關連
cscope -bkq -i cscope.files
ctags -R
接著打開vim
cs add cscope.out //加入資料庫
接著就可以開始trace code拉
使用方法
s: 查找C语言符号,即查找函数名、宏、枚举值等出现的地方
g: 查找函数、宏、枚举等定义的位置,类似ctags所提供的功能
d: 查找本函数调用的函数
c: 查找调用本函数的函数
t: 查找指定的字符串
e: 查找egrep模式,相当于egrep功能,但查找速度快多了
f: 查找并打开文件,类似vim的find功能
i: 查找包含本文件的文
例如想搜尋foo函數定義的地方
:cs f g foo
或者是全部檔案有出現foo的函數/變數
:cs f s foo
或者是想搜尋example.c這個檔案在哪的地方
:cs f f example.c
其他的功能就自已去玩囉
參考連結:
http://www.cnblogs.com/jianyungsun/archive/2011/07/24/2115298.html
Remote GDB debug紀錄
要先使用make menuconfig將gdbserver打開
make menuconfig -> Load config Cisco
Debug selection -> Build GDBserver for application debugging ->Save
然後重新編譯image之後燒到版子上,gdbserver會在/bin底下
ps:如果自己的SDK裡面沒有則需要自行cross compile
由於要debug telnet斷線問題,所以必須先利用gdbserver將板子上面想debug的app啟動
在target端
ps查看telnetd行程
./gdbserver :2000 --attach 1050 //觀察PID 1050的telnetd,開的port為2000
接著在PC端
切到要debug的路徑下
cd userspace/private/apps/telnetd/
讀取尚未strip過的exe
/opt/toolchains/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-gdb telnetd
設定lib位置,這樣gdb才會知道去哪找到程式碼
(gdb)set solib-absolute-prefix xxx/fs
(gdb)set solib-search-path xxx/lib
連接到剛剛用gdbserver啟動的路徑
(gdb)target remote 192.168.1.1:2000
設定中斷點
(gdb)break foo
使用continue繼續執行,如果打run看起來會讓gdb不知道如何跑就結束了~"~
(gdb)c
可以使用bt去看目前的static
然後用n一步一步去執行
make menuconfig -> Load config Cisco
Debug selection -> Build GDBserver for application debugging ->Save
然後重新編譯image之後燒到版子上,gdbserver會在/bin底下
ps:如果自己的SDK裡面沒有則需要自行cross compile
由於要debug telnet斷線問題,所以必須先利用gdbserver將板子上面想debug的app啟動
在target端
ps查看telnetd行程
./gdbserver :2000 --attach 1050 //觀察PID 1050的telnetd,開的port為2000
接著在PC端
切到要debug的路徑下
cd userspace/private/apps/telnetd/
讀取尚未strip過的exe
/opt/toolchains/uclibc-crosstools-gcc-4.4.2-1/usr/bin/mips-linux-uclibc-gdb telnetd
設定lib位置,這樣gdb才會知道去哪找到程式碼
(gdb)set solib-absolute-prefix xxx/fs
(gdb)set solib-search-path xxx/lib
連接到剛剛用gdbserver啟動的路徑
(gdb)target remote 192.168.1.1:2000
設定中斷點
(gdb)break foo
使用continue繼續執行,如果打run看起來會讓gdb不知道如何跑就結束了~"~
(gdb)c
可以使用bt去看目前的static
然後用n一步一步去執行
傳檔案到版子上的方法
先起個頭,主要是想找出除了用傳統usb傳檔或者重編譯image燒錄的路
有一些原因是因為某些版子沒有usb port只能單純用網路...
方便性上來說NFS>TFTP>FTP>SFTP>USB
1.NFS
需求
1.nfs client on target
2.nfs server on host
2.portmap
目前只有在STB版子上能使用
Ex:
mount -t nfs 192.168.1.100:/mntshare /mnt/nfs
2.TFTP
需求
1.tftp client on target
2.tftp server on host
將檔案從host端get下來
tftp -g 192.168.1.100 -r myfile.txt
3.FTP
需求
1.ftp server on target
2.ftp client on host
經驗上來說如果版子上是server的話傳大量資料比較方便...畢竟windows FTP client軟體這麼多,用拖拉傳檔是不是比較爽
4.SFTP
需求
1.openssh server on target
2.winscp on host
主要effort必須porting openssh上板子並且別關閉sftp的功能
5.USB disk
需求
1.usb disk *1並且你的版子要有usb的孔
2.usb storage drive on target
通常有些版子有auto_mount的設計
插上去都會自動偵測到,如果沒有的話就要手動mount
有一些原因是因為某些版子沒有usb port只能單純用網路...
方便性上來說NFS>TFTP>FTP>SFTP>USB
1.NFS
需求
1.nfs client on target
2.nfs server on host
2.portmap
目前只有在STB版子上能使用
Ex:
mount -t nfs 192.168.1.100:/mntshare /mnt/nfs
2.TFTP
需求
1.tftp client on target
2.tftp server on host
將檔案從host端get下來
tftp -g 192.168.1.100 -r myfile.txt
3.FTP
需求
1.ftp server on target
2.ftp client on host
經驗上來說如果版子上是server的話傳大量資料比較方便...畢竟windows FTP client軟體這麼多,用拖拉傳檔是不是比較爽
4.SFTP
需求
1.openssh server on target
2.winscp on host
主要effort必須porting openssh上板子並且別關閉sftp的功能
5.USB disk
需求
1.usb disk *1並且你的版子要有usb的孔
2.usb storage drive on target
通常有些版子有auto_mount的設計
插上去都會自動偵測到,如果沒有的話就要手動mount
訂閱:
意見 (Atom)