Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1277366
  • 博文数量: 129
  • 博客积分: 1449
  • 博客等级: 上尉
  • 技术积分: 3048
  • 用 户 组: 普通用户
  • 注册时间: 2012-07-24 18:36
文章分类

全部博文(129)

文章存档

2015年(3)

2014年(20)

2013年(65)

2012年(41)

分类: 项目管理

2013-05-09 10:35:40

1. 文件名: startup_stm32f10x_hd_rtos.s, 代码如下

点击(此处)折叠或打开

  1. ; Tailor this value to your application needs
  2. ; <h> Stack Configuration
  3. ; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
  4. ; </h>

  5. Stack_Size EQU 0x00000600

  6.                 AREA STACK, NOINIT, READWRITE, ALIGN=3
  7. Stack_Mem SPACE Stack_Size
  8. __initial_sp

  9. ;__initial_spTop EQU 0x20000400 ; stack used for SystemInit_ExtMemCtl
  10.                                                   ; always internal RAM used

  11. ; <h> Heap Configuration
  12. ; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
  13. ; </h>

  14. Heap_Size EQU 0x00000800

  15.                 AREA HEAP, NOINIT, READWRITE, ALIGN=3
  16. __heap_base
  17. Heap_Mem SPACE Heap_Size
  18. __heap_limit

  19.                                 IMPORT    OS_CPU_SysTickHandler
  20.                  IMPORT    OS_CPU_PendSVHandler
  21.                  IMPORT    vPortSVCHandler
  22.                  EXTERN vPortSVCHandler [WEAK]        ;uCOS中无此, 必须 [WEAK]

  23.                 PRESERVE8
  24.                 THUMB

  25. ; Vector Table Mapped to Address 0 at Reset                                
  26.                 AREA RESET, DATA, READONLY
  27.                 EXPORT __Vectors
  28.                 EXPORT __Vectors_End
  29.                 EXPORT __Vectors_Size

  30. __Vectors DCD __initial_sp         ; Top of Stack
  31.                 DCD Reset_Handler ; Reset Handler
  32.                 DCD NMI_Handler ; NMI Handler
  33.                 DCD HardFault_Handler ; Hard Fault Handler
  34.                 DCD MemManage_Handler ; MPU Fault Handler
  35.                 DCD BusFault_Handler ; Bus Fault Handler
  36.                 DCD UsageFault_Handler ; Usage Fault Handler
  37.                 DCD 0 ; Reserved
  38.                 DCD 0 ; Reserved
  39.                 DCD 0 ; Reserved
  40.                 DCD 0 ; Reserved
  41.                 ;DCD SVC_Handler ; SVCall Handler
  42.                 DCD vPortSVCHandler ; SVCall Handler
  43.                 DCD DebugMon_Handler ; Debug Monitor Handler
  44.                 DCD 0 ; Reserved
  45.                 ;DCD PendSV_Handler ; PendSV Handler
  46.                 ;DCD SysTick_Handler ; SysTick Handler
  47.                 DCD            OS_CPU_PendSVHandler
  48.                 DCD            OS_CPU_SysTickHandler

  49.                 ; External Interrupts
  50.                 DCD WWDG_IRQHandler ; Window Watchdog
  51.                 DCD PVD_IRQHandler ; PVD through EXTI Line detect
  52.                 DCD TAMPER_IRQHandler ; Tamper
  53.                 DCD RTC_IRQHandler ; RTC
  54.                 DCD FLASH_IRQHandler ; Flash
  55.                 DCD RCC_IRQHandler ; RCC
  56.                 DCD EXTI0_IRQHandler ; EXTI Line 0
  57.                 DCD EXTI1_IRQHandler ; EXTI Line 1
  58.                 DCD EXTI2_IRQHandler ; EXTI Line 2
  59.                 DCD EXTI3_IRQHandler ; EXTI Line 3
  60.                 DCD EXTI4_IRQHandler ; EXTI Line 4
  61.                 DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
  62.                 DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
  63.                 DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
  64.                 DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
  65.                 DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
  66.                 DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
  67.                 DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
  68.                 DCD ADC1_2_IRQHandler ; ADC1 & ADC2
  69.                 DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX
  70.                 DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0
  71.                 DCD CAN1_RX1_IRQHandler ; CAN1 RX1
  72.                 DCD CAN1_SCE_IRQHandler ; CAN1 SCE
  73.                 DCD EXTI9_5_IRQHandler ; EXTI Line 9..5
  74.                 DCD TIM1_BRK_IRQHandler ; TIM1 Break
  75.                 DCD TIM1_UP_IRQHandler ; TIM1 Update
  76.                 DCD TIM1_TRG_COM_IRQHandler ; TIM1 Trigger and Commutation
  77.                 DCD TIM1_CC_IRQHandler ; TIM1 Capture Compare
  78.                 DCD TIM2_IRQHandler ; TIM2
  79.                 DCD TIM3_IRQHandler ; TIM3
  80.                 DCD TIM4_IRQHandler ; TIM4
  81.                 DCD I2C1_EV_IRQHandler ; I2C1 Event
  82.                 DCD I2C1_ER_IRQHandler ; I2C1 Error
  83.                 DCD I2C2_EV_IRQHandler ; I2C2 Event
  84.                 DCD I2C2_ER_IRQHandler ; I2C2 Error
  85.                 DCD SPI1_IRQHandler ; SPI1
  86.                 DCD SPI2_IRQHandler ; SPI2
  87.                 DCD USART1_IRQHandler ; USART1
  88.                 DCD USART2_IRQHandler ; USART2
  89.                 DCD USART3_IRQHandler ; USART3
  90.                 DCD EXTI15_10_IRQHandler ; EXTI Line 15..10
  91.                 DCD RTCAlarm_IRQHandler ; RTC Alarm through EXTI Line
  92.                 DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
  93.                 DCD TIM8_BRK_IRQHandler ; TIM8 Break
  94.                 DCD TIM8_UP_IRQHandler ; TIM8 Update
  95.                 DCD TIM8_TRG_COM_IRQHandler ; TIM8 Trigger and Commutation
  96.                 DCD TIM8_CC_IRQHandler ; TIM8 Capture Compare
  97.                 DCD ADC3_IRQHandler ; ADC3
  98.                 DCD FSMC_IRQHandler ; FSMC
  99.                 DCD SDIO_IRQHandler ; SDIO
  100.                 DCD TIM5_IRQHandler ; TIM5
  101.                 DCD SPI3_IRQHandler ; SPI3
  102.                 DCD UART4_IRQHandler ; UART4
  103.                 DCD UART5_IRQHandler ; UART5
  104.                 DCD TIM6_IRQHandler ; TIM6
  105.                 DCD TIM7_IRQHandler ; TIM7
  106.                 DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
  107.                 DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
  108.                 DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
  109.                 DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
  110. __Vectors_End

  111. __Vectors_Size     EQU     __Vectors_End - __Vectors

  112.                 AREA |.text|, CODE, READONLY

  113. ; Dummy SystemInit_ExtMemCtl function
  114. SystemInit_ExtMemCtl PROC
  115.                 EXPORT SystemInit_ExtMemCtl [WEAK]
  116.                 BX LR
  117.                 ENDP

  118. ; Reset handler routine
  119. Reset_Handler PROC
  120.                 EXPORT Reset_Handler [WEAK]
  121.                 IMPORT __main

  122.                 LDR R0, = SystemInit_ExtMemCtl ; initialize external memory controller
  123.                 BLX R0

  124.                 LDR R1, = __initial_sp ; restore original stack pointer
  125.                 MSR MSP, R1

  126.                 LDR R0, =__main
  127.                 BX R0
  128.                 ENDP

  129. ; Dummy Exception Handlers (infinite loops which can be modified)

  130. NMI_Handler PROC
  131.                 EXPORT NMI_Handler [WEAK]
  132.                 B .
  133.                 ENDP
  134. HardFault_Handler\\
  135.                 PROC
  136.                 ;EXPORT HardFault_Handler [WEAK]
  137.                 ;B .
  138.                 IMPORT HardFaultException
  139.                 TST LR, #4
  140.                 ITE EQ
  141.                 MRSEQ R0, MSP
  142.                 MRSNE R0, PSP
  143.                 B HardFaultException
  144.                 ENDP
  145. MemManage_Handler\\
  146.                 PROC
  147.                 EXPORT MemManage_Handler [WEAK]
  148.                 B .
  149.                 ENDP
  150. BusFault_Handler\\
  151.                 PROC
  152.                 EXPORT BusFault_Handler [WEAK]
  153.                 B .
  154.                 ENDP
  155. UsageFault_Handler\\
  156.                 PROC
  157.                 EXPORT UsageFault_Handler [WEAK]
  158.                 B .
  159.                 ENDP
  160. SVC_Handler PROC
  161.                 EXPORT SVC_Handler [WEAK]
  162.                 B .
  163.                 ENDP
  164. DebugMon_Handler\\
  165.                 PROC
  166.                 EXPORT DebugMon_Handler [WEAK]
  167.                 B .
  168.                 ENDP
  169. PendSV_Handler PROC
  170.                 EXPORT PendSV_Handler [WEAK]
  171.                 B .
  172.                 ENDP
  173. SysTick_Handler PROC
  174.                 EXPORT SysTick_Handler [WEAK]
  175.                 B .
  176.                 ENDP

  177. Default_Handler PROC

  178.                 EXPORT WWDG_IRQHandler [WEAK]
  179.                 EXPORT PVD_IRQHandler [WEAK]
  180.                 EXPORT TAMPER_IRQHandler [WEAK]
  181.                 EXPORT RTC_IRQHandler [WEAK]
  182.                 EXPORT FLASH_IRQHandler [WEAK]
  183.                 EXPORT RCC_IRQHandler [WEAK]
  184.                 EXPORT EXTI0_IRQHandler [WEAK]
  185.                 EXPORT EXTI1_IRQHandler [WEAK]
  186.                 EXPORT EXTI2_IRQHandler [WEAK]
  187.                 EXPORT EXTI3_IRQHandler [WEAK]
  188.                 EXPORT EXTI4_IRQHandler [WEAK]
  189.                 EXPORT DMA1_Channel1_IRQHandler [WEAK]
  190.                 EXPORT DMA1_Channel2_IRQHandler [WEAK]
  191.                 EXPORT DMA1_Channel3_IRQHandler [WEAK]
  192.                 EXPORT DMA1_Channel4_IRQHandler [WEAK]
  193.                 EXPORT DMA1_Channel5_IRQHandler [WEAK]
  194.                 EXPORT DMA1_Channel6_IRQHandler [WEAK]
  195.                 EXPORT DMA1_Channel7_IRQHandler [WEAK]
  196.                 EXPORT ADC1_2_IRQHandler [WEAK]
  197.                 EXPORT USB_HP_CAN1_TX_IRQHandler [WEAK]
  198.                 EXPORT USB_LP_CAN1_RX0_IRQHandler [WEAK]
  199.                 EXPORT CAN1_RX1_IRQHandler [WEAK]
  200.                 EXPORT CAN1_SCE_IRQHandler [WEAK]
  201.                 EXPORT EXTI9_5_IRQHandler [WEAK]
  202.                 EXPORT TIM1_BRK_IRQHandler [WEAK]
  203.                 EXPORT TIM1_UP_IRQHandler [WEAK]
  204.                 EXPORT TIM1_TRG_COM_IRQHandler [WEAK]
  205.                 EXPORT TIM1_CC_IRQHandler [WEAK]
  206.                 EXPORT TIM2_IRQHandler [WEAK]
  207.                 EXPORT TIM3_IRQHandler [WEAK]
  208.                 EXPORT TIM4_IRQHandler [WEAK]
  209.                 EXPORT I2C1_EV_IRQHandler [WEAK]
  210.                 EXPORT I2C1_ER_IRQHandler [WEAK]
  211.                 EXPORT I2C2_EV_IRQHandler [WEAK]
  212.                 EXPORT I2C2_ER_IRQHandler [WEAK]
  213.                 EXPORT SPI1_IRQHandler [WEAK]
  214.                 EXPORT SPI2_IRQHandler [WEAK]
  215.                 EXPORT USART1_IRQHandler [WEAK]
  216.                 EXPORT USART2_IRQHandler [WEAK]
  217.                 EXPORT USART3_IRQHandler [WEAK]
  218.                 EXPORT EXTI15_10_IRQHandler [WEAK]
  219.                 EXPORT RTCAlarm_IRQHandler [WEAK]
  220.                 EXPORT USBWakeUp_IRQHandler [WEAK]
  221.                 EXPORT TIM8_BRK_IRQHandler [WEAK]
  222.                 EXPORT TIM8_UP_IRQHandler [WEAK]
  223.                 EXPORT TIM8_TRG_COM_IRQHandler [WEAK]
  224.                 EXPORT TIM8_CC_IRQHandler [WEAK]
  225.                 EXPORT ADC3_IRQHandler [WEAK]
  226.                 EXPORT FSMC_IRQHandler [WEAK]
  227.                 EXPORT SDIO_IRQHandler [WEAK]
  228.                 EXPORT TIM5_IRQHandler [WEAK]
  229.                 EXPORT SPI3_IRQHandler [WEAK]
  230.                 EXPORT UART4_IRQHandler [WEAK]
  231.                 EXPORT UART5_IRQHandler [WEAK]
  232.                 EXPORT TIM6_IRQHandler [WEAK]
  233.                 EXPORT TIM7_IRQHandler [WEAK]
  234.                 EXPORT DMA2_Channel1_IRQHandler [WEAK]
  235.                 EXPORT DMA2_Channel2_IRQHandler [WEAK]
  236.                 EXPORT DMA2_Channel3_IRQHandler [WEAK]
  237.                 EXPORT DMA2_Channel4_5_IRQHandler [WEAK]

  238. WWDG_IRQHandler
  239. PVD_IRQHandler
  240. TAMPER_IRQHandler
  241. RTC_IRQHandler
  242. FLASH_IRQHandler
  243. RCC_IRQHandler
  244. EXTI0_IRQHandler
  245. EXTI1_IRQHandler
  246. EXTI2_IRQHandler
  247. EXTI3_IRQHandler
  248. EXTI4_IRQHandler
  249. DMA1_Channel1_IRQHandler
  250. DMA1_Channel2_IRQHandler
  251. DMA1_Channel3_IRQHandler
  252. DMA1_Channel4_IRQHandler
  253. DMA1_Channel5_IRQHandler
  254. DMA1_Channel6_IRQHandler
  255. DMA1_Channel7_IRQHandler
  256. ADC1_2_IRQHandler
  257. USB_HP_CAN1_TX_IRQHandler
  258. USB_LP_CAN1_RX0_IRQHandler
  259. CAN1_RX1_IRQHandler
  260. CAN1_SCE_IRQHandler
  261. EXTI9_5_IRQHandler
  262. TIM1_BRK_IRQHandler
  263. TIM1_UP_IRQHandler
  264. TIM1_TRG_COM_IRQHandler
  265. TIM1_CC_IRQHandler
  266. TIM2_IRQHandler
  267. TIM3_IRQHandler
  268. TIM4_IRQHandler
  269. I2C1_EV_IRQHandler
  270. I2C1_ER_IRQHandler
  271. I2C2_EV_IRQHandler
  272. I2C2_ER_IRQHandler
  273. SPI1_IRQHandler
  274. SPI2_IRQHandler
  275. USART1_IRQHandler
  276. USART2_IRQHandler
  277. USART3_IRQHandler
  278. EXTI15_10_IRQHandler
  279. RTCAlarm_IRQHandler
  280. USBWakeUp_IRQHandler
  281. TIM8_BRK_IRQHandler
  282. TIM8_UP_IRQHandler
  283. TIM8_TRG_COM_IRQHandler
  284. TIM8_CC_IRQHandler
  285. ADC3_IRQHandler
  286. FSMC_IRQHandler
  287. SDIO_IRQHandler
  288. TIM5_IRQHandler
  289. SPI3_IRQHandler
  290. UART4_IRQHandler
  291. UART5_IRQHandler
  292. TIM6_IRQHandler
  293. TIM7_IRQHandler
  294. DMA2_Channel1_IRQHandler
  295. DMA2_Channel2_IRQHandler
  296. DMA2_Channel3_IRQHandler
  297. DMA2_Channel4_5_IRQHandler
  298.                 B .

  299.                 ENDP

  300.                 ALIGN

  301. ;*******************************************************************************
  302. ; User Stack and Heap initialization
  303. ;*******************************************************************************
  304.                  IF :DEF:__MICROLIB

  305.                  EXPORT __initial_sp
  306.                  EXPORT __heap_base
  307.                  EXPORT __heap_limit

  308.                  ELSE

  309.                  IMPORT __use_two_region_memory
  310.                  EXPORT __user_initial_stackheap

  311. __user_initial_stackheap

  312.                  LDR R0, = Heap_Mem
  313.                  LDR R1, =(Stack_Mem + Stack_Size)
  314.                  LDR R2, = (Heap_Mem + Heap_Size)
  315.                  LDR R3, = Stack_Mem
  316.                  BX LR

  317.                  ALIGN

  318.                  ENDIF

  319.                  END




2. 

3. 
阅读(2622) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~