歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> Ubuntu 15.10下編譯安裝ckermit串口調試助手

Ubuntu 15.10下編譯安裝ckermit串口調試助手

日期:2017/2/28 13:47:15   编辑:Linux教程

系統平台:Ubuntu 15.10

下載ckermit源碼

下載鏈接:http://www.columbia.edu/kermit/ck90.html

點擊“Source Code in tar, zip, or other archive formats or as separate files: CLICK HERE. ”的CLICK HERE,跳轉到下載頁面。

點擊下載cku302.tar.gz源碼包。

編譯ckermit源碼

先解壓源碼
tar zxvf cku302.tar.gz
編譯
make linux
如果出現以下錯誤

ckufio.o:在函數‘zvpass’中:
ckufio.c:(.text+0xbb81):對‘crypt’未定義的引用
ckcnet.o:在函數‘locate_srv_dns’中:
ckcnet.c:(.text+0x40b5):對‘__res_search’未定義的引用
ckcnet.c:(.text+0x4110):對‘__dn_expand’未定義的引用
ckcnet.c:(.text+0x4177):對‘__dn_expand’未定義的引用
ckcnet.c:(.text+0x4257):對‘__dn_expand’未定義的引用
ckcnet.o:在函數‘locate_txt_rr’中:
ckcnet.c:(.text+0xb1b4):對‘__res_search’未定義的引用
ckcnet.c:(.text+0xb20e):對‘__dn_expand’未定義的引用
ckcnet.c:(.text+0xb251):對‘__dn_expand’未定義的引用
collect2: error: ld returned 1 exit status
makefile:1202: recipe for target 'xermit' failed
make[2]: *** [xermit] Error 1
make[2]: Leaving directory '/opt/kermit'
makefile:5445: recipe for target 'linuxa' failed
make[1]: *** [linuxa] Error 2
make[1]: Leaving directory '/opt/kermit'
makefile:5473: recipe for target 'linux' failed
make: *** [linux] Error 2

解決方法是用vim 打開 makefile找到規則linuxa

linuxa:
        @echo 'Making C-Kermit $(CKVER) for Linux 1.2 or later...'
        @echo 'IMPORTANT: Read the comments in the linux section of the'
        @echo 'makefile if you have trouble.'
        $(MAKE) xermit KTARGET=$${KTARGET:-$(@)} "CC = gcc" "CC2 = gcc" \
        "CFLAGS = -O -DLINUX -pipe -funsigned-char -DFNFLOAT -DCK_POSIX_SIG \
        -DCK_NEWTERM -DTCPSOCKET -DLINUXFSSTND -DNOCOTFMC -DPOSIX \
        -DUSE_STRERROR $(KFLAGS)" "LNKFLAGS = $(LNKFLAGS)" "LIBS = $(LIBS) -lm"

在最後一行 “-lm “後邊加上 空格 -lcrypt -lresolv
如圖

再編譯一次
make linux
編譯完成。
生成的wermit就是了,一般情況下把它拷貝到/usr/local/bin下並重命名為kermit。

配置ckermit

在自己的家目錄下創建文件 .kermit
vim ~/.kermrc
加入以下內容

set line /dev/ttyUSB0 //根據實際情況改成自己的串口設備
set speed 115200
set carrier-watch off
set handshake none
set flow-control none
robust
set file type bin
set file name lit
set rec pack 1000
set send pack 1000
set window 5

啟動kermit

直接在命令行中輸入kermit回車
如果輸出以下信息

/dev/ttyUSB0: Permission denied
?SET SPEED has no effect without prior SET LINE
C-Kermit 8.0.211, 10 Apr 2004, for Linux
 Copyright (C) 1985, 2004,
  Trustees of Columbia University in the City of New York.
Type ? or HELP for help.
(/opt/kermit/) C-Kermit>q

需要將設備文件的權限修改一下(每次插入設備都要重新修改權限)
sudo chmod 777 /dev/ttyUSB0

再次啟動輸出

C-Kermit 8.0.211, 10 Apr 2004, for Linux
 Copyright (C) 1985, 2004,
  Trustees of Columbia University in the City of New York.
Type ? or HELP for help.
(/opt/kermit/) C-Kermit>

就可以用了,再C-Kermit>輸入c就連接上了串口

u@u-pc:/opt/kermit$ kermit
C-Kermit 8.0.211, 10 Apr 2004, for Linux
 Copyright (C) 1985, 2004,
  Trustees of Columbia University in the City of New York.
Type ? or HELP for help.
(/opt/kermit/) C-Kermit>c
Connecting to /dev/ttyUSB0, speed 115200
 Escape character: Ctrl-\ (ASCII 28, FS): enabled
Type the escape character followed by C to get back,
or followed by ? to see other options.
----------------------------------------------------
OK
後邊就是一大堆的開發板輸出的信息

要斷開串口連接 同時按下鍵盤ctrl+\鍵,松開後再按下c鍵。

關於kermit的更多用法後續更新。

Copyright © Linux教程網 All Rights Reserved