1-1-5 安装集成开发环境Eclipse

来源:互联网 发布:alias软件安装 编辑:程序博客网 时间:2024/06/06 02:37

/* 以下笔记针对RHEL6为平台,针对2440开发的安装过程,其他发行版需稍作修改 */

1.  安装gdb server(arm-linux-gdb-7.5.tar.gz),直接解压后biuld-all,编译后会在/opt目录下自动生成/arm-linux-gdb目录,里面包含gdb的可执行文件。然后:

        export PATH=$PATH:/opt/arm-linux-gdb/bin/    /* 添加的环境变量环境变量必须位于 */

        source /root/.bashrc                         /* 交叉工具链前,而且需另外export */


2.  安装JLink调试工具(JLink_Linux_V434a.tgz),具体步骤

        tar xzvf JLink_Linux_V434a.tgz

        cp -d libjlinkarm.so* /usr/lib -f

        cp 45-jlink.rules /etc/udev/rules.d/

    最后接上开发板,打开电源,运行JLinkGDBserver

/* 出现的问题  */

    按照上述步骤,在RHEL6上是木有任何问题的,但换作ubuntu 14.4上运行JLinkGDBserver的时候就会报

error while loading shared libraries: libusb-0.1.so.4: cannot open shared object file: No such file or directory

    缺少了libusb-0.1.so.4库文件,于是在/usr/lib中找,确实找不到。曾经尝试把/lib/x86_64-linux-gnu/libusb-0.1.so.4拷贝到/usr/lib/,运行JLinkGDBserver后又报

error while loading shared libraries: libusb-0.1.so.4: wrong ELF class: ELFCLASS64

    估计是64bit和32bit的兼容性问题,于是把原来在RHEL6中的libusb-0.1.so.4拷贝过来,丢到ubuntu 14.04中的/usr/lib中,再运行JLinkGDBserver,成功启动。

    曾经试过把JLink主目录丢到/opt下,把目录添加到环境变量中,想直接用JLinkGDBserver来运行,结果发现不行,sudo JLinkGDBserver更是command not found,即使是把JLink_Linux_V434a目录丢home的用户文件里,依然不行,而只能通过sudo ./opt/JLink_Linux_V434a/JLinkGDBserver的方式才能运行(重要)


3.  安装Eclipse

  3.1  上 https://www.eclipse.org/downloads/  选择一个C/C++的IDE并安装(现在最新出的的neon还没试过,反正MARS是没问题的)。

  3.2  安装zylin基于JLink V8的调试插件

       在eclipse任务栏,Help->Install New Software,

       Work with: http://opensource.zylin.com/zylincdt,选中并Next,完成安装后重启eclipse

  3.3  创建工程目录,选择Makefile with Existing Code,打开选中已有工程的目录(当中包含源码*.c *.S 以及Makefile),而最后调试的其实就是编译出来的.elf文件,因此如果没有.elf文件,则要make一个。

  3.4  对Debug调试器进行配置包括:

    3.4.1  点击Debug按钮的侧面箭头,选择debug configuration

    3.4.2  双击右边的Zylin Embedded Debug Native 

    3.4.3  选中新建的配置,右边debugger标签,把arm-elf-gdb更改为arm-linux-gdb(上文的gdb7.5安装就是为了在这完成的debug准备工作),选择要调试的.elf文件(要是没有,得make一个),并把Stop on startup at:main的钩去掉。

    3.4.4  在Commands标签中,Initialize Command的空白处输入初始化命令


4.  最后把PC(USB)与开发板(JTAG)通过JLink连接好,在Linux中启动JLinkGDBserver(因此需要两个终端,一个用来启动JLinkGDBserver,另一个用来启动eclipse),显示connected,把开发板调至NORFLASH端,启动开发板,在eclipse中,点击debug,debug程序开始执行,并能F5单步调试,实验成功。


/* 以下为Initialize Command中的内容,仅供参考 */


# connect to the J-Link gdb server

target remote localhost:2331

# Set JTAG speed to 30 kHz

monitor endian little

monitor speed 30

# Reset the target

monitor reset

monitor sleep 10

#

# CPU core initialization (to be done by user)

#

# Set the processor mode

monitor reg cpsr = 0xd3

#config MMU 配置MMU

#flush v3/v4 cache

monitor cp15 7, 7, 0, 0 = 0x0

#/* flush v4 TLB  协处理器*/

monitor cp15 8, 7, 0, 0 = 0x0

#disable MMU stuff and caches

monitor cp15 1, 0, 0, 0 =0x1002

#Peri port setup

monitor cp15 15, 2, 0, 4 = 0x70000013

#disable watchdog kangear 关闭看门狗

monitor MemU32 0x53000000  =  0x00000000

monitor sleep 10

#disable interrupt kangear 关闭中断

monitor MemU32 0x4A000008  =  0xffffffff

monitor MemU32 0x4A00001C  =  0x7fff

 

#set clock 

 

#initialize system clocks --- locktime register

monitor MemU32 0x4C000000 = 0xFF000000

     

#initialize system clocks --- clock-divn register

monitor MemU32 0x4C000014 = 0x5            #CLKDVIN_400_148

     

#initialize system clocks --- mpll register

monitor MemU32 0x4C000004 = 0x7f021    #default clock

 

 

#config sdram

monitor MemU32 0x53000000 0x00000000  

monitor MemU32 0x4A000008 0xFFFFFFFF  

monitor MemU32 0x4A00001C 0x000007FF  

monitor MemU32 0x53000000 0x00000000  

monitor MemU32 0x56000050 0x000055AA  

monitor MemU32 0x4C000014 0x00000007  

monitor MemU32 0x4C000000 0x00FFFFFF  

monitor MemU32 0x4C000004 0x00061012  

monitor MemU32 0x4C000008 0x00040042  

monitor MemU32 0x48000000 0x22111120  

monitor MemU32 0x48000004 0x00002F50  

monitor MemU32 0x48000008 0x00000700  

monitor MemU32 0x4800000C 0x00000700  

monitor MemU32 0x48000010 0x00000700  

monitor MemU32 0x48000014 0x00000700  

monitor MemU32 0x48000018 0x0007FFFC  

monitor MemU32 0x4800001C 0x00018005  

monitor MemU32 0x48000020 0x00018005  

monitor MemU32 0x48000024 0x008E0459  

monitor MemU32 0x48000028 0x00000032  

monitor MemU32 0x4800002C 0x00000030  

monitor MemU32 0x48000030 0x00000030 

  

# Setup GDB for faster downloads

#set remote memory-write-packet-size 1024

monitor speed auto

break _start

load


0 0
原创粉丝点击