OpenEdv-开源电子网

 找回密码
 立即注册
正点原子全套STM32/Linux/FPGA开发资料,上千讲STM32视频教程免费下载...
查看: 9917|回复: 3

ucos下HID启动

[复制链接]

1

主题

3

帖子

0

精华

新手入门

积分
27
金钱
27
注册时间
2011-8-22
在线时间
0 小时
发表于 2011-8-22 12:14:06 | 显示全部楼层 |阅读模式

首先我在stm32下移植了一个UCOS,而且在另外一个工程里也调试好了STM32 HID这块,但是当我把usB这块移植到UCSO下就发现系统彻底挂了。链接电脑后显示没有发现硬件设备,并且LED灯也不亮!!!我怀疑是启动文件的问题,但也不知道如何修改!

我在主函数下加的是:

 USB_Interrupts_Config();
 Set_USBClock();   
USB_Init(); 

三个函数,结果系统就挂了!

以下是我的启动文件请看下:

; If you need to use external SRAM mounted on STM3210E-EVAL board as data memory,
; change the following define value to '1' (or choose ENABLE in Configuration Wizard window)
;//   <o>  External SRAM Configuration  <0=> DISABLE <1=> ENABLE
DATA_IN_ExtSRAM  EQU     0


; Amount of memory (in bytes) allocated for Stack
; Tailor this value to your application needs
;// <h> Stack Configuration
;//   <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
;// </h>
Stack_Size       EQU     0x00000400

                 AREA    STACK, NOINIT, READWRITE, ALIGN=3
Stack_Mem        SPACE   Stack_Size

__initial_sp
; If you need to use external SRAM mounted on STM3210E-EVAL board as data memory
; and internal SRAM for Stack, uncomment the following line and comment the line above
;__initial_sp    EQU 0x20000000 + Stack_Size ; "Use MicroLIB" must be checked in
                                             ; the Project->Options->Target window

; Amount of memory (in bytes) allocated for Heap
; Tailor this value to your application needs
;// <h> Heap Configuration
;//   <o>  Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
;// </h>

Heap_Size        EQU     0x00000400

                 AREA    HEAP, NOINIT, READWRITE, ALIGN=3
__heap_base
Heap_Mem         SPACE   Heap_Size
__heap_limit
  

                 THUMB
                 PRESERVE8
    IMPORT  __main
                 ; Import exceptions handlers

                 IMPORT  NMIException
                 IMPORT  HardFaultException
                 IMPORT  MemManageException
                 IMPORT  BusFaultException
                 IMPORT  UsageFaultException
                 IMPORT  SVCHandler
                 IMPORT  DebugMonitor

                 IMPORT  OSPendSV
                 IMPORT  SysTickHandler
                 IMPORT  WWDG_IRQHandler
                 IMPORT  PVD_IRQHandler
                 IMPORT  TAMPER_IRQHandler
                 IMPORT  RTC_IRQHandler
                 IMPORT  FLASH_IRQHandler
                 IMPORT  RCC_IRQHandler
                 IMPORT  EXTI0_IRQHandler
                 IMPORT  EXTI1_IRQHandler
                 IMPORT  EXTI2_IRQHandler
                 IMPORT  EXTI3_IRQHandler
                 IMPORT  EXTI4_IRQHandler
                 IMPORT  DMA1_Channel1_IRQHandler
                 IMPORT  DMA1_Channel2_IRQHandler
                 IMPORT  DMA1_Channel3_IRQHandler
                 IMPORT  DMA1_Channel4_IRQHandler
                 IMPORT  DMA1_Channel5_IRQHandler
                 IMPORT  DMA1_Channel6_IRQHandler
                 IMPORT  DMA1_Channel7_IRQHandler
                 IMPORT  ADC1_2_IRQHandler
                 IMPORT  USB_HP_CAN_TX_IRQHandler
                 IMPORT  USB_LP_CAN_RX0_IRQHandler
                 IMPORT  CAN_RX1_IRQHandler
                 IMPORT  CAN_SCE_IRQHandler
                 IMPORT  EXTI9_5_IRQHandler
                 IMPORT  TIM1_BRK_IRQHandler
                 IMPORT  TIM1_UP_IRQHandler
                 IMPORT  TIM1_TRG_COM_IRQHandler
                 IMPORT  TIM1_CC_IRQHandler
                 IMPORT  TIM2_IRQHandler
                 IMPORT  TIM3_IRQHandler
                 IMPORT  TIM4_IRQHandler
                 IMPORT  I2C1_EV_IRQHandler
                 IMPORT  I2C1_ER_IRQHandler
                 IMPORT  I2C2_EV_IRQHandler
                 IMPORT  I2C2_ER_IRQHandler
                 IMPORT  SPI1_IRQHandler
                 IMPORT  SPI2_IRQHandler
                 IMPORT  USART1_IRQHandler
                 IMPORT  USART2_IRQHandler
                 IMPORT  USART3_IRQHandler
                 IMPORT  EXTI15_10_IRQHandler
                 IMPORT  RTCAlarm_IRQHandler
                 IMPORT  USBWakeUp_IRQHandler
                 IMPORT  TIM8_BRK_IRQHandler
                 IMPORT  TIM8_UP_IRQHandler
                 IMPORT  TIM8_TRG_COM_IRQHandler
                 IMPORT  TIM8_CC_IRQHandler
                 IMPORT  ADC3_IRQHandler
                 IMPORT  FSMC_IRQHandler
                 IMPORT  SDIO_IRQHandler
                 IMPORT  TIM5_IRQHandler
                 IMPORT  SPI3_IRQHandler
                 IMPORT  UART4_IRQHandler
                 IMPORT  UART5_IRQHandler
                 IMPORT  TIM6_IRQHandler
                 IMPORT  TIM7_IRQHandler
                 IMPORT  DMA2_Channel1_IRQHandler
                 IMPORT  DMA2_Channel2_IRQHandler
                 IMPORT  DMA2_Channel3_IRQHandler
                 IMPORT  DMA2_Channel4_5_IRQHandler
                
;*******************************************************************************
; Fill-up the Vector Table entries with the exceptions ISR address
;*******************************************************************************
                 AREA    RESET, DATA, READONLY
                 EXPORT  __Vectors
                     
__Vectors        DCD  __initial_sp              ; Top of Stack
                 DCD  Reset_Handler
                 DCD  NMIException
                 DCD  HardFaultException
                 DCD  MemManageException
                 DCD  BusFaultException
                 DCD  UsageFaultException
                 DCD  0                 ; Reserved
                 DCD  0                 ; Reserved
                 DCD  0                 ; Reserved
                 DCD  0                 ; Reserved
                 DCD  SVCHandler
                 DCD  DebugMonitor
                 DCD  0                 ; Reserved
                 DCD  OSPendSV
                 DCD  SysTickHandler
                 DCD  WWDG_IRQHandler
                 DCD  PVD_IRQHandler
                 DCD  TAMPER_IRQHandler
                 DCD  RTC_IRQHandler
                 DCD  FLASH_IRQHandler
                 DCD  RCC_IRQHandler
                 DCD  EXTI0_IRQHandler
                 DCD  EXTI1_IRQHandler
                 DCD  EXTI2_IRQHandler
                 DCD  EXTI3_IRQHandler
                 DCD  EXTI4_IRQHandler
                 DCD  DMA1_Channel1_IRQHandler
                 DCD  DMA1_Channel2_IRQHandler
                 DCD  DMA1_Channel3_IRQHandler
                 DCD  DMA1_Channel4_IRQHandler
                 DCD  DMA1_Channel5_IRQHandler
                 DCD  DMA1_Channel6_IRQHandler
                 DCD  DMA1_Channel7_IRQHandler
                 DCD  ADC1_2_IRQHandler
                 DCD  USB_HP_CAN_TX_IRQHandler
                 DCD  USB_LP_CAN_RX0_IRQHandler
                 DCD  CAN_RX1_IRQHandler
                 DCD  CAN_SCE_IRQHandler
                 DCD  EXTI9_5_IRQHandler
                 DCD  TIM1_BRK_IRQHandler
                 DCD  TIM1_UP_IRQHandler
                 DCD  TIM1_TRG_COM_IRQHandler
                 DCD  TIM1_CC_IRQHandler
                 DCD  TIM2_IRQHandler
                 DCD  TIM3_IRQHandler
                 DCD  TIM4_IRQHandler
                 DCD  I2C1_EV_IRQHandler
                 DCD  I2C1_ER_IRQHandler
                 DCD  I2C2_EV_IRQHandler
                 DCD  I2C2_ER_IRQHandler
                 DCD  SPI1_IRQHandler
                 DCD  SPI2_IRQHandler
                 DCD  USART1_IRQHandler
                 DCD  USART2_IRQHandler
                 DCD  USART3_IRQHandler
                 DCD  EXTI15_10_IRQHandler
                 DCD  RTCAlarm_IRQHandler
                 DCD  USBWakeUp_IRQHandler
                 DCD  TIM8_BRK_IRQHandler
                 DCD  TIM8_UP_IRQHandler
                 DCD  TIM8_TRG_COM_IRQHandler
                 DCD  TIM8_CC_IRQHandler
                 DCD  ADC3_IRQHandler
                 DCD  FSMC_IRQHandler
                 DCD  SDIO_IRQHandler
                 DCD  TIM5_IRQHandler
                 DCD  SPI3_IRQHandler
                 DCD  UART4_IRQHandler
                 DCD  UART5_IRQHandler
                 DCD  TIM6_IRQHandler
                 DCD  TIM7_IRQHandler
                 DCD  DMA2_Channel1_IRQHandler
                 DCD  DMA2_Channel2_IRQHandler
                 DCD  DMA2_Channel3_IRQHandler
                 DCD  DMA2_Channel4_5_IRQHandler
                
                 AREA    |.text|, CODE, READONLY

; Reset handler routine
Reset_Handler    PROC
                 EXPORT  Reset_Handler
    
             IF      DATA_IN_ExtSRAM == 1
; FSMC Bank1 NOR/SRAM3 is used for the STM3210E-EVAL, if another Bank is
; required, then adjust the Register Addresses


; Enable FSMC clock
             LDR R0,= 0x00000114
             LDR R1,= 0x40021014
             STR R0,[R1]                 
                 
; Enable GPIOD, GPIOE, GPIOF and GPIOG clocks
             LDR R0,= 0x000001E0
             LDR R1,= 0x40021018
             STR R0,[R1]   

; SRAM Data lines, NOE and NWE configuration
; SRAM Address lines configuration
; NOE and NWE configuration  
; NE3 configuration
; NBL0, NBL1 configuration

             LDR R0,= 0x44BB44BB
             LDR R1,= 0x40011400
             STR R0,[R1]  
    
             LDR R0,= 0xBBBBBBBB
             LDR R1,= 0x40011404
             STR R0,[R1]  
    
             LDR R0,= 0xB44444BB
             LDR R1,= 0x40011800
             STR R0,[R1]  
    
             LDR R0,= 0xBBBBBBBB
             LDR R1,= 0x40011804
             STR R0,[R1]  
    
             LDR R0,= 0x44BBBBBB
             LDR R1,= 0x40011C00
             STR R0,[R1]    

             LDR R0,= 0xBBBB4444
             LDR R1,= 0x40011C04
             STR R0,[R1]    

             LDR R0,= 0x44BBBBBB
             LDR R1,= 0x40012000
             STR R0,[R1]  

             LDR R0,= 0x44444B44
             LDR R1,= 0x40012004
             STR R0,[R1]     
            
; FSMC Configuration  
; Enable FSMC Bank1_SRAM Bank

            LDR R0,= 0x00001011
            LDR R1,= 0xA0000010
            STR R0,[R1] 

            LDR R0,= 0x00000200
            LDR R1,= 0xA0000014
            STR R0,[R1] 

        
            ENDIF
           
           
     IMPORT  __main
                 LDR     R0, =__main
                 BX      R0
                 ENDP

                 ALIGN

;*******************************************************************************
; User Stack and Heap initialization
;*******************************************************************************
                 IF      EF:__MICROLIB          
               
                 EXPORT  __initial_sp
                 EXPORT  __heap_base
                 EXPORT  __heap_limit
               
                 ELSE
               
                 IMPORT  __use_two_region_memory
                 EXPORT  __user_initial_stackheap
                
__user_initial_stackheap

                 LDR     R0, =  Heap_Mem
                 LDR     R1, =(Stack_Mem + Stack_Size)
                 LDR     R2, = (Heap_Mem +  Heap_Size)
                 LDR     R3, = Stack_Mem
                 BX      LR

                 ALIGN

                 ENDIF

                 END

;******************* (C) COPYRIGHT 2008 STMicroelectronics *****END OF FILE*****

希望有同样问题的人能一起“顶”起来!

 

 

 

 

 

 

 

 

 

 

 

 

 


       

正点原子逻辑分析仪DL16劲爆上市
回复

使用道具 举报

530

主题

11万

帖子

34

精华

管理员

Rank: 12Rank: 12Rank: 12

积分
165352
金钱
165352
注册时间
2010-12-1
在线时间
2108 小时
发表于 2011-8-22 12:28:02 | 显示全部楼层
不用ucos的时候,能成功么?
我是开源电子网www.openedv.com站长,有关站务问题请与我联系。
正点原子STM32开发板购买店铺http://openedv.taobao.com
正点原子官方微信公众平台,点击这里关注“正点原子”
回复 支持 反对

使用道具 举报

1

主题

3

帖子

0

精华

新手入门

积分
27
金钱
27
注册时间
2011-8-22
在线时间
0 小时
 楼主| 发表于 2011-8-22 14:36:25 | 显示全部楼层
回复【2楼】正点原子:
---------------------------------不用UCOS的时候,在UCOS工程下可以跑程序点亮LED流水灯,然后加入USB工程里的三个函数就挂了!在USB工程里可以正常发送数据上位机接收到!
回复 支持 反对

使用道具 举报

1

主题

3

帖子

0

精华

新手入门

积分
27
金钱
27
注册时间
2011-8-22
在线时间
0 小时
 楼主| 发表于 2011-8-22 15:02:45 | 显示全部楼层
我现在发现一个问题:莫非UCOS下的USB和STM32例程里的USB不一样???呜呜!!~~~
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则



关闭

原子哥极力推荐上一条 /2 下一条

正点原子公众号

QQ|手机版|OpenEdv-开源电子网 ( 粤ICP备12000418号-1 )

GMT+8, 2024-11-24 22:01

Powered by OpenEdv-开源电子网

© 2001-2030 OpenEdv-开源电子网

快速回复 返回顶部 返回列表