嵌入式Linux+ARM开发环境搭建

操作系统: Ubuntu 12.04

学习平台: OK6410

内核版本: Linux_3.0.1


一、 编译工具VIM配置

"更新时间:2012年11月25日
">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
">>>>>>>>>>>>VIM 自身相关配置

"1. 用于语法高亮的配色方案
colorscheme evening
"2. 禁止光标闪烁
set gcr=a:block-blinkon0
"3. 开启语法高亮功能
syntax enable 
"4. 允许用制定语法高亮配色方案替代默认方案
syntax on
"5. 设置制表符占用空格数
set tabstop=4
set shiftwidth=4
set noexpandtab
"6. 开启行号显示
set nu
"7. 开启高亮显示结果
set hlsearch
"8. 开启实时搜索功能
set incsearch
"9. 在命令行显示当前输入的命令
set showcmd
"10. 禁止拆行
"set nowrap
"11. 关闭兼容模式
set nocompatible
"12. 禁止显示滚动条
set guioptions-=l
set guioptions-=r
"13. 开启文件类型侦测
filetype on
"14. 根据侦测到的不同类型加载对应的插件
filetype plugin on
"15. 根据侦测到的不同类型采用不同的缩进格式
filetype indent on
"16. 定义快捷键的前缀,即<Leader>
let mapleader=","
"17. 关闭当前所有窗口
nmap <Leader>q :wqall<CR>
"18. 保存当前窗口内容
nmap <Leader>w :q<CR>
"19. 横向创建新窗口
nmap <Leader>vp :vsp<CR>
"20. 一键编译内核
nmap <Leader>mk :wa<CR>:make kernel<CR>:cw<CR><CR>
"21. 一键编译应用
nmap <Leader>mp :wa<CR>:make platform<CR>:cw<CR><CR>
"22. 一键编译
nmap <Leader>ma :wa<CR>:make <CR>:cw<CR><CR>
"23. 一键清除
nmap <Leader>mc: make clean<CR>:cw<CR><CR>
"24. Highlight current line
set cursorline
"25. 自动保存
set autowriteall


">>>>>>>>>>>>>>插件相关配置
"1. 使用NERDTree插件察看工程文件
nmap <Leader>lf :NERDTreeToggle<CR>
let NERDTreeWinSize=20
let NERDTreeWinpos="right"
"2. 设置tablist插件
let Tlist_Show_One_File=1
nnoremap<Leader>ls :TlistToggle<CR>
let Tlist_WinWidth=40
let Tlist_Inc_Winwidth=0
"3. 使用minibufexpl.vim插件管理buffer
let g:miniBufExplMapCTabSwitchBufs = 1
"4. 支持用\K查看SHELL命令和C库函数的man信息
source$VIMRUNTIME/ftplugin/man.vim
"5. 取消补全内容以分割字窗口形式出现,只显示补全列表
set completeopt=longest,menu
"6. 使用grep.vim插件在工程内全局查找
nnoremap<Leader>vg :Grep<CR>
"7. 遍历各分割窗口
"nnoremap<Leader>k <C-W><C-W>
nnoremap<Leader>k <C-W>
"8. 使用new-omni-completion补全
imap<Leader><TAB> <C-X><C-O>
"9. 支持文本折叠方式
set foldmethod=syntax
"10. 闭合折叠层数
set foldlevel=100
"11. cscope插件配置
set cscopequickfix=s-,c-,d-,i-,t-,e-
cs add cscope.out
"Find symbol.
nmap <silent> <leader>cs :cs find s <cword><CR><esc>
"Find definition
nmap <silent> <leader>cg :cs find g <cword><CR><esc>
"Find who call this function
nmap <silent> <leader>cc :cs find c <cword><CR><esc>
"Find string
nmap <silent> <leader>ct :cs find t <cword><CR><esc>
"Find egrep
nmap <silent> <leader>ce :cs find e <cword><CR><esc>
"Find file
nmap <silent> <leader>cf :cs find f <cword><CR><esc>
"Find which function it call
nmap <silent> <leader>cd :cs find d <cword><CR><esc>
                       
"12. lookfile 快捷键配置
let g:LookupFile_TagExpr = string('./filenametags')
let g:LookupFile_MinPatLength = 2
let g:LookupFile_PreserveLastPattern = 0
let g:LookupFile_PreservePatternHistory = 0
let g:LookupFile_AllowNewFiles = 0
let g:LookupFile_AlwaysAcceptFirst = 1
nmap <silent> <leader>lk :LookupFile<cr>
nmap <silent> <leader>ll :LUBufs<cr>
nmap <silent> <leader>lw :LUWalk<cr>


二、 交叉编译链

工具包: arm-linux-gcc-4.3.2.tgz  

               cross-4.2.2-eabi.tar.bz2        两者均是GCC编译器,只是版本有所不同,可根据实际情况使用。

(1)arm-linux-gcc的路径: ####  mkdir -p /usr/local/arm; tar zxvf arm-linux-gcc-4.3.2.tgz -C /

(2) 编辑~/.bashrc,添加arm-linux-gcc搜索路径

102 # enable programmable completion features (you don't need to enable
103 # this, if it's already enabled in /etc/bash.bashrc and /etc/profile
104 # sources /etc/bash.bashrc).
105 if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
106     . /etc/bash_completion
107 fi
108 
109 export PATH=$PATH:/usr/local/arm/4.3.2/bin/:/usr/local/arm/4.2.2-eabi/usr/bin

三、 TFTP工具安装

(1)$ sudo apt-get install tftpd tftp openbsd-inetd

(2) $ sudo gedit /etc/inetd.conf
在这个配置文件里面找到下面的位置:
#:BOOT: TFTP service is provided primarily for booting. Most sites
# run this only on machines acting as "boot servers."
#tftp dgram udp wait nobody /usr/sbin/tcpd /usr/sbin/in.tftpd /srv/tftp
#我把上面的默认的配置文件用井号注释掉了,自己配置了tftp的主工作目录为/tftp
tftp dgram udp wait nobody /usr/sbin/tcpd /usr/sbin/in.tftpd /tftp

(3)创建TFTP服务器的文件目录

$ chmod -R 777 /tftp

** 如果有需要下载的文件这时可以拷贝进去,也用chmod 777命令把所有权限打开

(4)启动(或重启)xinetd服务
$sudo /etc/init.d/openbsd-inetd restart

(5)查看69端口是否有打开,使用下面命令
netstat -an | more
打印出的东西中找到如下即可:
udp 0 0 0.0.0.0:69 0.0.0.0:*

(6)在本机测试一下:

        a.在/tftp目下新建一个文件,并写入数据:
        www.linuxidc.com @linuxidc:/tftp$ echo helloworld > zhang.txt
        www.linuxidc.com @linuxidc:/tftp$ cat zhang.txt
        helloworld
        b. 到/home目录下
        www.linuxidc.com @linuxidc:/home$ sudo tftp 221.204.110.99[注:这是本机的IP地址]
        [sudo] password for yishugao: 
        tftp> get zhang.txt
        Received 12 bytes in 0.0 seconds
        tftp> quit
        www.linuxidc.com @linuxidc:/home$ cat zhang.txt
        helloworld
        www.linuxidc.com @linuxidc:/home$
        行了,本地测试成功!

(7)开发板OK6410上测试

首先,保证虚拟机的网络是Bridged模式,并且,本地连接属性中 VMware Bridge Protocol 打钩

使用命令 "tftp c0800000 Helloword"
Helloword 是你虚拟机中 tftp 目录里的一个文件,记住最好把所有文件的权限改为 777

下面是tftp传输成功时,串口上的打印信息

SMDK6410 # tftp c0800000 Helloword
Found DM9000 ID:90000a46 at address 18000300 !
DM9000 work in 16 bus width
bd->bi_entaddr: 00:40:5c:26:0a:5b
[eth_init]MAC:0:40:5c:26:a:5b:
TFTP from server 192.168.0.101; our IP address is 192.168.0.232
Filename 'Helloword'.
Load address: 0xc0800000
Loading: T T ####
done
Bytes transferred = 19774 (4d3e hex)
SMDK6410 #

四、 串口工具kermit

sudo apt-get install ckermit

使用kermit之前,在用户宿主目录下(/home/用户名/)创建一个名为.kermrc的配置文件,内容如下

set line /dev/ttyUSB0      //如果是串口就是ttyS0

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


网络问题:

(1)由于无线网卡跟本地有线网卡/板子网卡地址配置为同一子网,且无线网卡获取ip与板子地址一样,造成冲突;

解决: 将板子网卡和本地有线网卡配置成同一子网并与无线网卡独立开来

(2)移植Linux时,默认无法支持make uImage

(3)http://blog.csdn.net/challen537/article/details/6544878



续。。。。。。。。。。。。。。。。。。。


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值