2011年6月29日 星期三

i2c command on uboot

#iprobe : probe to discover i2c chip address
#ibus [idx] [spd] : testing i2c bus speed ex: ibus 0 64
64(ST),0x190(FS),0xD480(HS)
#imd: display i2c memory
imd [chip address] [register address] .[show byte .0 .1 .2] [num of byte]
> imd 0x55 0x10.0 10
#imm: write data via i2c address
imm [chip address] [register address>.[show byte .0 .1 .2]

2011年6月28日 星期二

capture log into file from minicom

Ctrl+A+L --> open capture to which file? > input your file which store log
Ctrl+A+L --> close or pause

vim & cscope

reference:
http://blog.chhsu.org/2009/03/multi-projects-of-vim-using-cscope.html
http://rickey-nctu.blogspot.com/2009/02/vim-srcexpl.html

Installing:
sudo apt-get install cscope ctags

Build my environment:
step1: Put debug.sh into ~/bin/
#!/bin/bash
CSCOPE_FILE=cscope.out
if [ -n "$1" ]; then
echo "Source code directory: " $1
echo "Create file map : " $CSCOPE_FILE
find $1 -name "*.h" -o -name "*.c" -o -name "*.cpp" > $CSCOPE_FILE
cscope -bkq -i $CSCOPE_FILE
# cscope -Rbkq
ctags -R
else
echo "Please key-in path of project"
fi

step2: modify cscope_map.bin on /usr/share/vim/vim72/plugin/cscope-map.bin
let i = 1
while i < 20
if filereadable("cscope.out")
let db = getcwd() . "/cscope.out"
"echo db
let $CSCOPE_DB = db
cs add $CSCOPE_DB
let i = 20
else
cd ..
let i += 1
endif
endwhile

Debug:
step1:
go to project and type: #debug.sh

step2:
Open you want to trace code via vi
ex: vi /arch/arm/mach-xxx/board_xxxx.c

Trace code :
(Ctrl+\+c) : who call this function --> (Ctrl+\+t): return back
(Ctrl+\+g) : find this function defination --> (Ctrl+\+t) : return back
(Ctrl+\+s) : which function uses this function --> (Ctrl+\+t) : retunn back

2011年6月27日 星期一

view code by ctags

Exuberant Ctags
Installing :apt-get install exuberant-ctags

@setup taglist

Edit: /etc/vim/vimrc

"Tglist edit
set tags=tags;
set autochdir
nnoremap :TlistToggle

@ Create tags into root directory of project
# ctags -R *

@ Operation
step1 : Don't open screen
step2: Open Tlist via F9
step3: Open you want to see functino via Ctrl+]
If you want to open new window to see this function, you can type Ctrl+w+]
step4: Return your main window Ctrl+t
Or, you can close your new winodw which see this function, you can type Ctrl+w+q

@You can change your window size by Ctrl+w+"+" or Ctrl+w+"-"