首頁 > 軟體

Ubuntu 15.10下編譯安裝ckermit串列埠偵錯助手

2020-06-16 17:28:56

系統平台: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的更多用法後續更新。

本文永久更新連結地址http://www.linuxidc.com/Linux/2016-11/13706.htm


IT145.com E-mail:sddin#qq.com