搭建GCC+JLINK开发调试环境(裸机调试)

a) 安装VMware   --- just do it.
b) 安装arm-elf-gcc toolset --- we can get it from:
c) 安装JLINK软件 --- just get it from SEGGER website.

d) 实现2440 gdb 启动脚本:
   1) 参阅JLinkGDBServer文档,如下:

文件: UM08005_JLinkGDBServer.pdf 大小: 509KB 
 
本文要用到的相关文件下载在Linux公社的1号FTP服务器里,下载地址:

FTP地址:ftp://www.linuxidc.com

用户名:

密码:

在 2011年LinuxIDC.com\3月\搭建GCC+JLINK开发调试环境(裸机调试)

下载方法见


  2) 此gdb启动脚本的主要任务是初始化内存控制器,禁止WatchDog,禁止中断。
     参考JLinkGDBServer文档后,经测试,以下代码可以正常工作:
  ##main function defined for initial the S3C2440 CPU.

define reset_2440
    monitor endian little  ##little endian, should be the same as your application.
   
    ##copied from JLinkGDBServer Document.
    monitor reset            ##reset the S3C2440
    monitor reg cpsr = 0xd3  ##setup cpsr register.
    monitor speed auto       ##Link Speed.
   
    ##translated from VIVI S3C2440 version.
    #disable watchdog
    monitor MemU32 0x53000000 = 0
   
    #disalbe interrupt --- int-mask register
    monitor MemU32 0x4A000008 = 0xFFFFFFFF
   
    #disalbe interrupt --- int-sub-mask register
    monitor MemU32 0x4A00001C = 0x7FFF ## vivi set it as 0x7FF, why???
   
    #initialize system clocks --- locktime register
    monitor long 0x4C000000 = 0xFF000000
   
    #initialize system clocks --- clock-divn register
    monitor long 0x4C000014 = 0x5            #CLKDVIN_400_148
   
    #initialize system clocks --- mpll register
    monitor long 0x4C000004 = 0x7f021    #default clock
   
    #setup memory controller
    monitor MemU32 0x48000000 = 0x22111110    #conw
    monitor MemU32 0x48000004 = 0x00000700    #bank0
    monitor MemU32 0x48000008 = 0x00000700     #bank1
    monitor MemU32 0x4800000c = 0x00000700     #bank2
    monitor MemU32 0x48000010 = 0x00000700     #bank3
    monitor MemU32 0x48000014 = 0x00000700     #bank4
    monitor MemU32 0x48000018 = 0x00000700     #bank5
    monitor MemU32 0x4800001c = 0x00018009     #bank6
    monitor MemU32 0x48000020 = 0x00018009     #bank7
    monitor MemU32 0x48000024 = 0x008e04eb     #vREFRESH
    monitor MemU32 0x48000028 = 0xB2        #vBANKSIZE -- 128M/128M --- should
                                                       according to the physical
                                                       memory size? --- 0xB0 ??
    monitor MemU32 0x4800002c = 0x30        #vMRSRB6
    monitor MemU32 0x48000030 = 0x30        #vMRSRB7       
  end

##main function defined for connect to the TARGET.
  ##arg0 = IP address.
  ##arg1 = PORT number of JLINK gdb server.

define connect_jei
    if $argc == 2
        target remote $arg0:$arg1
        reset_2440
    end
  end

3) 脚本做好以后,以下命令为怎样使用该脚本---假设该脚本名字为targets.cmd,编译出的程序文件为main.out

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/24801.html