打印

ARM7调USB时,读RW区数据时不能跳到正确的地址!搞了三天没结果

[复制链接]
2056|9
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
decoder8|  楼主 | 2007-11-27 21:40 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
郁闷呀!!!!!向各位讨教!!!
以下为程序运行出错的代码:



//设备描述符
unsigned char  DeviceDescr[] =
    {0x12,                //设备描述符长度,= 12H
    0x01,                    //设备描述符类型,= 01H
    0x00,
    0x01,                                    //协议版本,= 1.10
    0x00,            //测试设备类型, = 0DCH    
    0x00,
    0x10,                                             //设备子类,设备协议
    0x10,                            //端点0最大数据包大小,= 10H    
    0x5e,
    0x10,                                                //PHILIPS公司的设备ID    
    0xff,
    0xff,                                                   //设备制造商定的产品ID
    0x00,
    0x01,                                    //设备系列号
    0x00,
    0x00, 
    0x00,                                         //索引
    0x01,
 };


unsigned char usb_descr[] =
 {
//配置描述符

    sizeof(USB_CONFIGURATION_DESCRIPTOR),        //配置描述符长度,= 09H
    USB_CONFIGURATION_DESCRIPTOR_TYPE,            //配置描述符类型,= 02H
    CONFIG_DESCRIPTOR_LENGTH,0x00,                //描述符总长度, = 002EH
    1,                                            //只支持1个接口
    1,                                            //配置值
    0,                                            //字符串描述符指针(无)
    0x80,                                        //自供电,不支持远程唤醒  //支持总线供电
    0x32,                                        //最大功耗(100mA)

//接口描述符

    sizeof(USB_INTERFACE_DESCRIPTOR),            //接口描述符长度,= 09H
    USB_INTERFACE_DESCRIPTOR_TYPE,                //接口描述符类型,= 04H
    0,                                            //接口数,只有1个
    0,                                            //可选配置,只有1个
    NUM_ENDPOINTS,                                //除端点0的端点索引数目,= 04H
    0x08,                                        //大容量存储类,= 08H
    0x06,                                        //子类代码,= 04H ---------UFI    
    0x50,                                        //协议代码,= 050H ---------单批量传输协议(Bulk-Only)
    0,                                            //字符串描述符索引,为0则未使用字符串描述符



//端点描述符,端点1输入

    0x07,                                         //端点描述符长度,= 07H
    USB_ENDPOINT_DESCRIPTOR_TYPE,                //端点描述符类型,= 05H
    0x81,                                        //端点1 IN
    USB_ENDPOINT_TYPE_INTERRUPT,                //中断传输, = 03H
    EP1_PACKET_SIZE,0x00,                        //端点最大包的大小,= 0010H
    10,                                            //传输间隔时间,= 10ms

//端点描述符,端点1输出

    0x07,            //端点描述符长度,= 07H
    USB_ENDPOINT_DESCRIPTOR_TYPE,                //端点描述符类型,= 05H
    0x1,                                        //端点1 OUT
    USB_ENDPOINT_TYPE_INTERRUPT,                //中断传输,= 03H
    EP1_PACKET_SIZE,0x00,                        //端点最大包的大小,= 0010H
    10,                                            //传输间隔时间,= 10ms


//端点2输入

    0x07,                                         //端点描述符长度,= 07H
    USB_ENDPOINT_DESCRIPTOR_TYPE,                //端点描述符类型,= 05H
    0x82,                                        //端点2 IN
    USB_ENDPOINT_TYPE_BULK,                        //批量传输,= 02H
    EP2_PACKET_SIZE,0x00,                        //端点最大包的大小,= 0040H
    10,                                            //批量传输时该设备无效

//端点2输出

    0x07,                                           //端点描述符长度,= 07H
    USB_ENDPOINT_DESCRIPTOR_TYPE,                //端点描述符类型,= 05H
    0x2,                                        //端点2 OUT    
    USB_ENDPOINT_TYPE_BULK,                        //批量传输,= 02H
    EP2_PACKET_SIZE,0x00,                        //端点最大包的大小,= 0040H
    10,                                            //批量传输时该设备无效

};


INT8U mbr[512]={
0x33,0xc0,0x8e,0xc0,0x8e,0xd8,0x8e,0xd0,0xbc,0x00,0x7c,0xfc,0x8b,0xf4,0xbf,0x00,//00000000
0x06,0xb9,0x00,0x01,0xf2,0xa5,0xea,0x44,0x06,0x00,0x00,0x8b,0xd5,0x58,0xb4,0x10,//00000010
0xf6,0xe4,0x05,0xae,0x04,0x8b,0xf0,0x8a,0x74,0x01,0x8b,0x4c,0x02,0xbb,0x00,0x7c,//00000020
0xe8,0x01,0x02,0xcd,0x13,0x72,0x16,0x81,0xbf,0xfe,0x01,0x55,0xaa,0x75,0x0e,0xea,//00000030
0x00,0x7c,0x00,0x00,0x80,0xfa,0x81,0x74,0x02,0xb2,0x80,0x8b,0xea,0xbf,0xbe,0x07,//00000040
0xb9,0x04,0x00,0x32,0xf6,0x8a,0x45,0x04,0x3c,0x00,0x74,0x0b,0x3c,0x05,0x74,0x07,//00000050
0x80,0x3d,0x80,0x74,0x19,0xfe,0xc6,0x83,0xc7,0x10,0xe2,0xe9,0x0a,0xf6,0x74,0x06,//00000060
0xbe,0x9c,0x06,0xeb,0x04,0x90,0xbe,0xb4,0x06,0xe8,0x0e,0x00,0xeb,0xfe,0x8a,0xc6,//00000070
0x04,0x31,0x50,0xbe,0x99,0x06,0xbb,0x1b,0x06,0x53,0xfc,0xac,0x50,0x24,0x7f,0xb4,//00000080
0x0e,0xcd,0x10,0x58,0xa8,0x80,0x74,0xf2,0xc3,0x0d,0x0a,0xa0,0x0d,0x0a,0x4e,0x6f,//00000090
0x20,0x61,0x63,0x74,0x69,0x76,0x65,0x20,0x70,0x61,0x72,0x74,0x69,0x74,0x69,0x6f,//000000a0
0x6e,0x2e,0x2e,0xae,0x0d,0x0a,0x50,0x61,0x72,0x74,0x69,0x74,0x69,0x6f,0x6e,0x20,//000000b0
0x6e,0x6f,0x74,0x20,0x66,0x6f,0x75,0x6e,0x64,0x2e,0x2e,0xae,0x00,0x00,0x00,0x00,//000000c0
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//000000d0
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//000000e0
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//000000f0
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//00000100
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//00000110
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//00000120
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//00000130
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//00000140
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//00000150
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//00000160
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//00000170
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//00000180
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//00000190
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//000001a0
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x01,//000001b0
0x01,0x00,0x06,0x01,0x21,0x60,0x01,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00,//000001c0
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//000001d0
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//000001e0
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x55,0xaa//000001f0
 };

当我把mbr[512]不赋初值,或者把mbr[512]数据全改为0X00时,在AXD中跳到DeviceDescr[]地址时能看到DeviceDescr[]数组定义的正确的赋值,当mbr[512]这以上数据时,在AXD中跳到DeviceDescr[]地址时看到的是它前一个数据,地址
跳转不对,而且有的数据还错了!搞了几天都晕了,不知道不什么,请各位高手指点!我用的是ADS2.2

相关帖子

沙发
阿南| | 2007-11-28 15:31 | 只看该作者

没有理解楼主的意思,可能是我理解能力比较差.

其它能理解的兄弟帮一下,或者楼主把情况说的再具体些

使用特权

评论回复
板凳
decoder8|  楼主 | 2007-11-28 20:47 | 只看该作者

不好意思

对于这个问题我也不知道怎样说,才能让别人理解我!因为在调试时,我也只用看到结果,地址分配的结果,我也不知道编译器为什么要这样做!看来没人能帮我了,只能自己来了!唉!我如果调出来再把结果发出来,让大家帮忙分析一下哟!嘿嘿!

使用特权

评论回复
地板
computer00| | 2007-11-28 20:51 | 只看该作者

RAM不足?

使用特权

评论回复
5
decoder8|  楼主 | 2007-11-28 20:58 | 只看该作者

不会

我是在SDRAM调的,有8M空间,这个是MAP文件加栈空间也不没有超过呀!
Warning : A1608:  MOV pc,<rn> instruction used, but BX <rn> is preferred
sysint.s line 170   

armasm :   170 00000140     MOV PC,LR


armasm : 0 Errors, 1 Warning


================================================================================


Memory Map of the image


  Image Entry point : 0x0c000000


  Load Region LR_1 (Base: 0x0c000000, Size: 0x00002f20, Max: 0xffffffff, ABSOLUTE)


    Execution Region ER_RO (Base: 0x0c000000, Size: 0x00002eb0, Max: 0xffffffff, ABSOLUTE)


    Base Addr    Size         Type   Attr      Idx    E Section Name        Object


    0x0c000000   0x000001c4   Code   RO            1  * InitSystemblock     sysint.o


    0x0c0001c4   0x00000008   Code   RO          172  * !!!main             __main.o(c_t__un.l)


    0x0c0001cc   0x00000038   Code   RO          209    !!!scatter          __scatter.o(c_t__un.l)


    0x0c000204   0x0000002c   Code   RO          211    !!handler_zi        __scatter_zi.o(c_t__un.l)


    0x0c000230   0x00000004   Ven    RO          182    .emb_text           lib_init.o(c_t__un.l)


    0x0c000234   0x00000010   Code   RO          182    .emb_text           lib_init.o(c_t__un.l)


    0x0c000244   0x00000aec   Code   RO            5    .text               usbapply.o


    0x0c000d30   0x0000004c   Code   RO           45    .text               usb.o


    0x0c000d7c   0x00000564   Code   RO           74    .text               D12Driver.o


    0x0c0012e0   0x000001fc   Code   RO          113    .text               Storage.o


    0x0c0014dc   0x00000b44   Code   RO          132    .text               BulkOnly.o


    0x0c002020   0x0000093c   Code   RO          154    .text               FAT.o


    0x0c00295c   0x00000068   Code   RO          174    .text               kernel.o(c_t__un.l)


    0x0c0029c4   0x00000018   Code   RO          176    .text               sys_exit.o(c_t__un.l)


    0x0c0029dc   0x00000014   Code   RO          178    .text               exit.o(c_t__un.l)


    0x0c0029f0   0x00000104   Code   RO          180    .text               stkheap1.o(c_t__un.l)


    0x0c002af4   0x00000008   Ven    RO          183    .text               lib_init.o(c_t__un.l)


    0x0c002afc   0x000000ce   Code   RO          183    .text               lib_init.o(c_t__un.l)


    0x0c002bca   0x00000002   PAD


    0x0c002bcc   0x00000004   Code   RO          186    .text               boardinit1.o(c_t__un.l)


    0x0c002bd0   0x0000000c   Code   RO          188    .text               boardinit2.o(c_t__un.l)


    0x0c002bdc   0x00000010   Code   RO          190    .text               boardinit3.o(c_t__un.l)


    0x0c002bec   0x00000004   Code   RO          192    .text               boardshut.o(c_t__un.l)


    0x0c002bf0   0x00000050   Code   RO          194    .text               sys_stackheap.o(c_t__un.l)


    0x0c002c40   0x00000004   Ven    RO          196    .text               libspace.o(c_t__un.l)


    0x0c002c44   0x0000000c   Code   RO          196    .text               libspace.o(c_t__un.l)


    0x0c002c50   0x00000004   Code   RO          199    .text               use_semi.o(c_t__un.l)


    0x0c002c54   0x00000004   Code   RO          201    .text               cpuinit.o(c_t__un.l)


    0x0c002c58   0x00000014   Code   RO          205    .text               rt_fp_status_addr.o(c_t__un.l)


    0x0c002c6c   0x0000000c   Ven    RO          214    Veneer$$Code        anon$$obj.o


    0x0c002c78   0x00000008   Ven    RO          215    Veneer$$Code        anon$$obj.o


    0x0c002c80   0x00000004   Code   RO           46    i.__ARM_get_argv    usb.o


    0x0c002c84   0x00000004   Ven    RO          203    x$fpl$fpinit        fpinit.o(fz_t_p.l)


    0x0c002c88   0x00000018   Code   RO          203    x$fpl$fpinit        fpinit.o(fz_t_p.l)


    0x0c002ca0   0x00000200   Data   RO          155    .constdata          FAT.o


    0x0c002ea0   0x00000010   Data   RO          207    Region$$Table       anon$$obj.o


    Execution Region ER_RW (Base: 0x0c002eb0, Size: 0x00000070, Max: 0xffffffff, ABSOLUTE)


    Base Addr    Size         Type   Attr      Idx    E Section Name        Object


    0x0c002eb0   0x00000040   Data   RW          102    .data               Descriptor.o


    0x0c002ef0   0x00000004   Data   RW          114    .data               Storage.o


    0x0c002ef4   0x0000002c   Data   RW          133    .data               BulkOnly.o


    Execution Region ER_ZI (Base: 0x0c002f20, Size: 0x002001a4, Max: 0xffffffff, ABSOLUTE)


    Base Addr    Size         Type   Attr      Idx    E Section Name        Object


    0x0c002f20   0x00000028   Zero   RW            6    .bss                usbapply.o


    0x0c002f48   0x00000050   Zero   RW           76    .bss                D12Driver.o


    0x0c002f98   0x000000ca   Zero   RW          134    .bss                BulkOnly.o


    0x0c003062   0x00200000   Zero   RW          156    .bss                FAT.o


    0x0c203062   0x00000002   PAD


    0x0c203064   0x00000060   Zero   RW          197    .bss                libspace.o(c_t__un.l)


使用特权

评论回复
6
computer00| | 2007-11-28 21:10 | 只看该作者

加个const算了,反正这些值也不会改他们了吧?

使用特权

评论回复
7
decoder8|  楼主 | 2007-11-28 21:40 | 只看该作者

OO太有才了

!哈哈!搞定了!OK了!能给我简单的分析一下为什么会这样吗?提思路也可以的!...

使用特权

评论回复
8
computer00| | 2007-11-28 21:49 | 只看该作者

原因可能是野指针;SDRAM刷新不够,引线短路、断路等原因

重点测试下你的SDRAM,看是否正确了。只有先确认硬件是好的,软件才有搞头。

使用特权

评论回复
9
平常人| | 2007-11-28 21:53 | 只看该作者

5楼给出的MAP文件好像应该是mbr数组的所有分量为0x00的结果

把你的Scatter文件拿来看看。

使用特权

评论回复
10
decoder8|  楼主 | 2007-11-30 00:06 | 只看该作者

我没有用Scatter文件进行定位

只是调试,在RAM中运行的.在INT8U mbr[512]前加上const后,地址跳转正确了.程序没在Execution Region中运行,就像单片机中一样的,但为什么也会出现这样的问题呢?搞不明白.....

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

11

主题

103

帖子

0

粉丝