跳至主要内容

【转】H-JTAG+AXD 调试S3C2440

1.设置好H-JTAG后准备调试简单的测试代码了,首先要在ADS的开发环境中设置"DebugRel Setting"的一些参数:

    a:"Target Settings" Linker=ARM Linker Post-linker=ARM FfromELF。

    b:"Language Settings=>ARM Asssembler" Target=ARM920T Byte order=Little endian;"Language Settings=>ARM C compiler"进行相同设定。

    c:"ARM Linker"Output=>Linktype=Simple RO Base=0x3000000(关键)。(对于一个加载时域和运行时域相同的映像文件来说,RO段基地址实际上就是该映像文件在存储空间的起始地址,根据S3C2440的SDRAM应该是在地址0x30000000的。所以此处应该设置为0x3000000。另外可以在窗口下方的命令行中输入"-map -list list.txt"字段(不包括引号),这样可以在编译完以后看到内存的具体分布情况。

2.用H-JTAG调试时单步和全速的时候发现程序虽然执行到"b   ResetHandler"处,但是再往下执行时,程序并不是跳转到0x30000000而是0x2fabe844处,一路空操作,也就是程序跑飞了。但是使用ARMUL仿真时,程序却能程序设计的步骤执行,折腾到晚上睡觉也没解决。第二天上网查资料得到的解释是:"因为2440带MMU,wince起来后,会打开MMU并对MMU进行相应的设置。所以,在板子上电后,如果WINCE起来后,地址0x30000000并不一定是SDRAM的地址。"而在ARMUL里软仿真的话,是默认已经设置好了SDRAM,相当于FPGA里的功能仿真,只验证程序的执行过程但不保证实际运行会不会出现问题。所以问题的解决办法是要对SDRAM进行初始化。因为在上电时,SDRAM是没有被初始化的,所谓初始化SDRAM,就是要设置处理器的SDRAM空间以及读写SDRAM的时序参数,因而SDRAM在初始化之前是不能进行读写操作的。而在设置SDRAM的方法有两种:

    a:在AXD里面通过命令窗口重新配置一下SDRAM;例如"setmem 0x48000000 0xac9 32"的含义就是将常数0xac9保存到地址为0x48000000的字中(一个字32bit)。这样可使用3~4条setmem命令初始化SDRAM,之后就可以正确地将映像文件加载到SDRAM中运行了。关于使用ob命令自动初始化SDRAM:由于每次上电后往SDRAM加载映像时都需要对其进行初始化,手工输入多条命令有时是很繁琐的。这时,可以把初始化SDRAM的命令序列保存在一个*.ini文本文件中(也可以是*.txt文件),每条命令占一行。然后在AXD命令行窗口使用obey命令调用该*.ini文件,就可以将文件中的命令顺序执行,继而完成SDRAM的初始化。例如,将SDRAM初始化命令序列保存在2440.ini件中,执行命令:ob PATH/2440.ini   就可自动执行初始化SDRAM的命令。其中,ob是obey的简写,$PATH是2440.ini的绝对路径。在硬件平台不变的情况下,在启动AXD时自动初始化SDRAM的一劳永逸的办法:初始化SDRAM的命令序列保存为一个*.txt文本文件(可以直接将上述的*.ini文件后缀改为.txt),然后在AXD的主窗口下选择菜单Options->Configure Interface...,在Session File一页中选择"Run Configuration Script",将该.txt文本文件作为一个脚本加进来,确定。这样以后每次启动AXD时,就会自动运行该脚本来完成对SDRAM的初始化。

    b:打开H-JTAG的Script=>Init Script菜单,在其中输入对应的设置参数,有几个寄存器要设置就添加几个,添加完毕后选中窗口的左下方"Enable Auto Init",即可自动配置SDRAM.

3.设置H-Flasher,a:选择板子对应的nor flash(AMD=>Am29LV160DB);b:Memory Config,Flash Bit Width= 08-bit Mode,Flash Start Address=0,RAM Start Address=0x30000000。

4.Enjoy!!!

评论

此博客中的热门博文

【转】smb协议栈使用示例

/*  * * uncdownload.c  * *  * * Utility for downloading files from SMB shares using libsmbclient  * *  * * Copyright(C) 2006 Sophos Plc, Oxford, England.  * *  * * This program is free software; you can redistribute it and/or modify it under the terms of the  * * GNU General Public License Version 2 as published by the Free Software Foundation.  * *  * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without  * * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  * * See the GNU General Public License for more details.  * *  * * You should have received a copy of the GNU General Public License along with this program; if not,  * * write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA  * *  * */ # include < sys / types . h > # include < sys / time . h > # include ...

【转】Ether Types

Ether Types (last updated 2008-09-09) NOTE: Please see [RFC5342] for current information and registration procedures. This registry will be revised soon and will be replaced with up-to-date information. Many of the networks of all classes are Ethernets (10Mb) or Experimental Ethernets (3Mb). These systems use a message "type" field in much the same way the ARPANET uses the "link" field. If you need an Ether Type, contact: IEEE Registration Authority IEEE Standards Department 445 Hoes Lane Piscataway, NJ 08854 Phone +1 732 562 3813 Fax: +1 732 562 1571 Email: <ieee-registration-authority& ieee.org > http://standards.ieee.org/regauth/index.html The following list of EtherTypes is contributed unverified information from various sources. Another list of EtherTypes is maintained by Michael A. Patton and is accessible at: <URL: http://www.cavebear.com/CaveBear/Ethernet/ > <URL: ftp://ftp.cavebear.com/pub/Ethernet-codes > Assign...

【转】tcphdr结构详解

位于:/usr/src/linux/include/linux/tcp.h struct tcphdr { __be16 source; __be16 dest; __be32 seq; __be32 ack_seq; #if defined(__LITTLE_ENDIAN_BITFIELD) __u16   res1:4, doff:4, fin:1, syn:1, rst:1, psh:1, ack:1, urg:1, ece:1, cwr:1; #elif defined(__BIG_ENDIAN_BITFIELD) __u16   doff:4, res1:4, cwr:1, ece:1, urg:1, ack:1, psh:1, rst:1, syn:1, fin:1; #else #error "Adjust your <asm/byteorder.h> defines"