完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
首先我在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) ;// DATA_IN_ExtSRAM EQU 0 ; Amount of memory (in bytes) allocated for Stack ; Tailor this value to your application needs ;// ;// ;// 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 ;// ;// ;// 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***** 希望有同样问题的人能一起“顶”起来! |
|
相关推荐
3个回答
|
|
不用ucos的时候,能成功么?
|
|
|
|
不用UCOS的时候,在UCOS工程下可以跑程序点亮LED流水灯,然后加入USB工程里的三个函数就挂了!在USB工程里可以正常发送数据上位机接收到!
|
|
|
|
我现在发现一个问题:莫非UCOS下的USB和STM32例程里的USB不一样???呜呜!!~~~
|
|
|
|
只有小组成员才能发言,加入小组>>
调试STM32H750的FMC总线读写PSRAM遇到的问题求解?
1659 浏览 1 评论
X-NUCLEO-IHM08M1板文档中输出电流为15Arms,15Arms是怎么得出来的呢?
1571 浏览 1 评论
998 浏览 2 评论
STM32F030F4 HSI时钟温度测试过不去是怎么回事?
695 浏览 2 评论
ST25R3916能否对ISO15693的标签芯片进行分区域写密码?
1617 浏览 2 评论
1877浏览 9评论
STM32仿真器是选择ST-LINK还是选择J-LINK?各有什么优势啊?
663浏览 4评论
STM32F0_TIM2输出pwm2后OLED变暗或者系统重启是怎么回事?
529浏览 3评论
548浏览 3评论
stm32cubemx生成mdk-arm v4项目文件无法打开是什么原因导致的?
517浏览 3评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-29 21:45 , Processed in 0.924900 second(s), Total 84, Slave 65 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号