当前位置:首页 >> 信息与通信 >>

ucos


Stm32 平台 ucOS_II 移植笔记
大家好,本文是我的 ucOS_II 在 stm32 上的移植笔记。本文采用边干边写的方式,学一点,写一点。难免产 生凌乱之感,盖本文目的旨在抛砖引玉,借群邮件之平台,以学会友,共同进步。 文中涉及的资料,都是在网上搜集的免费资料,我会将用到的都传在群共享里。另外,本文还会放在人人网 的“stm32 互助小组”里。 非常欢迎各位

将本文转载在自己的博客里,不过有一个小小的要求,就是希望将这段话也转载在文章里,我 的 目 的 只 有 一 个 , 就 是希 望 各 位 看 到 后 , 有 任何 技 术 问 题 , 能 够 和 我讨 论 , 大 家 共 同 进 步 。我 的 邮 箱 diaochengdong@qq.com。 废话少说,现在开始。

Stm32 启动代码分析
我用的编译工具是 keil,在用 keil 建立 stm32 工程时,一般会产生一个启动文件,STM32F10x.s,在 st 提供的 库函数里,用 cortexm3_macro.s 和 stm32f10x_vector.s 来代替这个文件。不过内容都大同小异。 我在 csdn 上搜到了一个在 stm32 上移植好的 ucos,打算在这个代码的基础上,添加注释,先学别人的,然后 再自己移植。 我获得的这份例程,使用了 startup_stm32f10x_md.s 作为启动文件,其中,删去了部分采用扩展 SRAM 的代 码。 其文件内容为 startup_stm32f10x_md.s ;******** (C) COPYRIGHT 2010 STMICROELECTRONICS ******************** ;* FILE NAME : STARTUP_STM32F10X_MD.S ;* AUTHOR : MCD APPLICATION TEAM ;* VERSION : V3.3.0 : 04/16/2010 ;* DATE ;* DESCRIPTION: STM32F10X MEDIUM DENSITY DEVICES VECTOR TABLE FOR RVMDK ;* TOOLCHAIN. ;* THIS MODULE PERFORMS: ;* - SET THE INITIAL SP ;* - SET THE INITIAL PC == RESET_HANDLER ;* - SET THE VECTOR TABLE ENTRIES WITH THE EXCEPTIONS ISR ADDRESS ;* - CONFIGURE THE CLOCK SYSTEM ;* - BRANCHES TO __MAIN IN THE C LIBRARY (WHICH EVENTUALLY ;* CALLS MAIN()). ;* AFTER RESET THE CORTEXM3 PROCESSOR IS IN THREAD MODE, ;* PRIORITY IS PRIVILEGED, AND THE STACK IS SET TO MAIN. ;* <<< USE CONFIGURATION WIZARD IN CONTEXT MENU >>>

;***************************************************************** ****** ; THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS ; WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. ; AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, ; INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE ; CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING ; INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. ;***************************************************************** ***** ; 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 ;?““栈大 ?“ 义 ? STACK_MEM __INITIAL_SP EQU 0X00000400

AREA STACK, NOINIT, READWRITE, ALIGN=3 SPACE STACK_SIZE

;‰??义 STACK 段 ‰? 处 口为 0X0000 0000 ?????U ‰ ,该段 口为__INITIAL_SP,这 值 这 处, 为 MSP ?????0 值, ;编译 时 , 编译器赋值。 编译器 编译器 SRAM,???\?Q 编译 编译器将其赋为 0X20001138,…S 到 果 ???\?Q ;__INITIAL_SP EQU 0X20000000 + STACK_SIZE 来 义 ; <H> HEAP CONFIGURATION ; <O> HEAP SIZE (IN BYTES) <0X0-0XFFFFFFFF:8> ; </H> HEAP_SIZE EQU AREA __HEAP_BASE HEAP_MEM __HEAP_LIMIT 0X00000200 HEAP, NOINIT, READWRITE, ALIGN=3 HEAP_SIZE

SPACE

PRESERVE8 THUMB

; VECTOR TABLE MAPPED TO ADDRESS 0 AT RESET ;?WK?:‰}‰~ 0X00000000 开 处 ?WK?:‰}‰~ 断 , 段 AREA RESET, DATA, READONLY EXPORT __VECTORS EXPORT __VECTORS_END EXPORT __VECTORS_SIZE __VECTORS

RESET ??更改, 编译器 可更改, 编译器 可 可更改

认 起 段

DCD __INITIAL_SP ; TOP OF STACK DCD RESET_HANDLER ; RESET HANDLER DCD NMI_HANDLER ; NMI HANDLER DCD HARDFAULT_HANDLER ; HARD FAULT HANDLER DCD MEMMANAGE_HANDLER ; MPU FAULT HANDLER DCD BUSFAULT_HANDLER ; BUS FAULT HANDLER DCD USAGEFAULT_HANDLER ; USAGE FAULT HANDLER DCD 0 ; RESERVED DCD 0 ; RESERVED DCD 0 ; RESERVED DCD 0 ; RESERVED DCD SVC_HANDLER ; SVCALL HANDLER DCD DEBUGMON_HANDLER ; DEBUG MONITOR HANDLER DCD 0 ; RESERVED ;DCD PENDSV_HANDLER ; PENDSV HANDLER OSPENDSV ; PENDSV HANDLER(FOR UCOS-II) DCD DCD SYSTICK_HANDLER ; SYSTICK HANDLER ; EXTERNAL INTERRUPTS DCD WWDG_IRQHANDLER ; WINDOW WATCHDOG DCD PVD_IRQHANDLER ; PVD THROUGH EXTI LINE DETECT DCD TAMPER_IRQHANDLER ; TAMPER DCD RTC_IRQHANDLER ; RTC DCD FLASH_IRQHANDLER ; FLASH DCD RCC_IRQHANDLER ; RCC DCD EXTI0_IRQHANDLER ; EXTI LINE 0 DCD EXTI1_IRQHANDLER ; EXTI LINE 1 DCD EXTI2_IRQHANDLER ; EXTI LINE 2 DCD EXTI3_IRQHANDLER ; EXTI LINE 3 DCD EXTI4_IRQHANDLER ; EXTI LINE 4 DCD DMA1_CHANNEL1_IRQHANDLER ; DMA1 CHANNEL 1 DCD DMA1_CHANNEL2_IRQHANDLER ; DMA1 CHANNEL 2 DCD DMA1_CHANNEL3_IRQHANDLER ; DMA1 CHANNEL 3 DCD DMA1_CHANNEL4_IRQHANDLER ; DMA1 CHANNEL 4 DCD DMA1_CHANNEL5_IRQHANDLER ; DMA1 CHANNEL 5

DCD DCD DCD DCD DCD RX0 DCD DCD DCD DCD DCD DCD DCD DCD DCD DCD DCD DCD DCD DCD DCD DCD DCD DCD DCD DCD DCD DCD __VECTORS_END

DMA1_CHANNEL6_IRQHANDLER ; DMA1 CHANNEL 6 DMA1_CHANNEL7_IRQHANDLER ; DMA1 CHANNEL 7 ADC1_2_IRQHANDLER ; ADC1_2 USB_HP_CAN1_TX_IRQHANDLER; USB HIGH PRIORITY OR CAN1 TX USB_LP_CAN1_RX0_IRQHANDLER;USB LOW PRIORITY OR CAN1 CAN1_RX1_IRQHANDLER ; CAN1 RX1 CAN1_SCE_IRQHANDLER ; CAN1 SCE EXTI9_5_IRQHANDLER ; EXTI LINE 9..5 TIM1_BRK_IRQHANDLER ; TIM1 BREAK TIM1_UP_IRQHANDLER ; TIM1 UPDATE TIM1_TRG_COM_IRQHANDLER ; TIM1 TRIGGER AND COMMUTATION TIM1_CC_IRQHANDLER ; TIM1 CAPTURE COMPARE TIM2_IRQHANDLER ; TIM2 TIM3_IRQHANDLER ; TIM3 TIM4_IRQHANDLER ; TIM4 I2C1_EV_IRQHANDLER ; I2C1 EVENT I2C1_ER_IRQHANDLER ; I2C1 ERROR I2C2_EV_IRQHANDLER ; I2C2 EVENT I2C2_ER_IRQHANDLER ; I2C2 ERROR SPI1_IRQHANDLER ; SPI1 SPI2_IRQHANDLER ; SPI2 USART1_IRQHANDLER ; USART1 USART2_IRQHANDLER ; USART2 USART3_IRQHANDLER ; USART3 EXTI15_10_IRQHANDLER ; EXTI LINE 15..10 RTCALARM_IRQHANDLER ; RTC ALARM THROUGH EXTI LINE USBWAKEUP_IRQHANDLER ; USB WAKEUP FROM SUSPEND

__VECTORS_SIZE EQU __VECTORS_END - __VECTORS AREA ; RESET HANDLER RESET_HANDLER ; ‰??删 ‰ 处 |.TEXT|, CODE, READONLY

PROC 关



EXPORT RESET_HANDLER IMPORT __MAIN IMPORT SYSTEMINIT LDR 跳到__ 跳到 MAIN BLX R0

SRAM ?? 码 , 看 来 这 个 代 [WEAK] 数, 来

认 内

SRAM ??? ?

;?:???0?/?1 等 ?:???0?/ ?1 RCC 设 ;这 多 这

MAIN 起来

R0, =SYSTEMINIT

个 SYSTEMINIT ?KK 调 , 来 ? 数

LDR R0, =__MAIN BX R0 ENDP ; DUMMY EXCEPTION HANDLERS (INFINITE LOOPS WHICH CAN BE MODIFIED) ;这 段 DCD ?TK IMPORT 来声 这 数 义 声 烦,其实, , PROC NMI_HANDLER EXPORT NMI_HANDLER [WEAK] B . ENDP HARDFAULT_HANDLER\ PROC EXPORT HARDFAULT_HANDLER [WEAK] B . ENDP MEMMANAGE_HANDLER\ PROC EXPORT MEMMANAGE_HANDLER [WEAK] B . ENDP BUSFAULT_HANDLER\ PROC EXPORT BUSFAULT_HANDLER [WEAK] B . ENDP USAGEFAULT_HANDLER\ PROC EXPORT USAGEFAULT_HANDLER [WEAK] B . ENDP SVC_HANDLER PROC EXPORT SVC_HANDLER [WEAK] B . ENDP DEBUGMON_HANDLER\ PROC EXPORT DEBUGMON_HANDLER [WEAK] B . ENDP ;PENDSV_HANDLER PROC ; EXPORT PENDSV_HANDLER [WEAK] ; (FOR UCOS-II) OSPENDSV PROC EXPORT OSPENDSV [WEAK]



B . ENDP SYSTICK_HANDLER PROC EXPORT SYSTICK_HANDLER B . ENDP DEFAULT_HANDLER PROC EXPORT EXPORT EXPORT EXPORT EXPORT EXPORT EXPORT EXPORT EXPORT EXPORT EXPORT EXPORT EXPORT EXPORT EXPORT EXPORT EXPORT EXPORT EXPORT EXPORT EXPORT EXPORT EXPORT EXPORT EXPORT EXPORT EXPORT EXPORT EXPORT EXPORT EXPORT EXPORT EXPORT EXPORT EXPORT

[WEAK]

WWDG_IRQHANDLER [WEAK] PVD_IRQHANDLER [WEAK] TAMPER_IRQHANDLER [WEAK] RTC_IRQHANDLER [WEAK] FLASH_IRQHANDLER [WEAK] RCC_IRQHANDLER [WEAK] EXTI0_IRQHANDLER [WEAK] EXTI1_IRQHANDLER [WEAK] EXTI2_IRQHANDLER [WEAK] EXTI3_IRQHANDLER [WEAK] EXTI4_IRQHANDLER [WEAK] DMA1_CHANNEL1_IRQHANDLER [WEAK] DMA1_CHANNEL2_IRQHANDLER [WEAK] DMA1_CHANNEL3_IRQHANDLER [WEAK] DMA1_CHANNEL4_IRQHANDLER [WEAK] DMA1_CHANNEL5_IRQHANDLER [WEAK] DMA1_CHANNEL6_IRQHANDLER [WEAK] DMA1_CHANNEL7_IRQHANDLER [WEAK] ADC1_2_IRQHANDLER [WEAK] USB_HP_CAN1_TX_IRQHANDLER [WEAK] USB_LP_CAN1_RX0_IRQHANDLER [WEAK] CAN1_RX1_IRQHANDLER [WEAK] CAN1_SCE_IRQHANDLER [WEAK] EXTI9_5_IRQHANDLER [WEAK] TIM1_BRK_IRQHANDLER [WEAK] TIM1_UP_IRQHANDLER [WEAK] TIM1_TRG_COM_IRQHANDLER [WEAK] TIM1_CC_IRQHANDLER [WEAK] TIM2_IRQHANDLER [WEAK] TIM3_IRQHANDLER [WEAK] TIM4_IRQHANDLER [WEAK] I2C1_EV_IRQHANDLER [WEAK] I2C1_ER_IRQHANDLER [WEAK] I2C2_EV_IRQHANDLER [WEAK] I2C2_ER_IRQHANDLER [WEAK]

EXPORT EXPORT EXPORT EXPORT EXPORT EXPORT EXPORT EXPORT

SPI1_IRQHANDLER [WEAK] SPI2_IRQHANDLER [WEAK] USART1_IRQHANDLER [WEAK] USART2_IRQHANDLER [WEAK] USART3_IRQHANDLER [WEAK] EXTI15_10_IRQHANDLER [WEAK] RTCALARM_IRQHANDLER [WEAK] USBWAKEUP_IRQHANDLER [WEAK]

WWDG_IRQHANDLER PVD_IRQHANDLER TAMPER_IRQHANDLER RTC_IRQHANDLER FLASH_IRQHANDLER RCC_IRQHANDLER EXTI0_IRQHANDLER EXTI1_IRQHANDLER EXTI2_IRQHANDLER EXTI3_IRQHANDLER EXTI4_IRQHANDLER DMA1_CHANNEL1_IRQHANDLER DMA1_CHANNEL2_IRQHANDLER DMA1_CHANNEL3_IRQHANDLER DMA1_CHANNEL4_IRQHANDLER DMA1_CHANNEL5_IRQHANDLER DMA1_CHANNEL6_IRQHANDLER DMA1_CHANNEL7_IRQHANDLER ADC1_2_IRQHANDLER USB_HP_CAN1_TX_IRQHANDLER USB_LP_CAN1_RX0_IRQHANDLER CAN1_RX1_IRQHANDLER CAN1_SCE_IRQHANDLER EXTI9_5_IRQHANDLER TIM1_BRK_IRQHANDLER TIM1_UP_IRQHANDLER TIM1_TRG_COM_IRQHANDLER TIM1_CC_IRQHANDLER TIM2_IRQHANDLER TIM3_IRQHANDLER TIM4_IRQHANDLER I2C1_EV_IRQHANDLER I2C1_ER_IRQHANDLER I2C2_EV_IRQHANDLER I2C2_ER_IRQHANDLER

SPI1_IRQHANDLER SPI2_IRQHANDLER USART1_IRQHANDLER USART2_IRQHANDLER USART3_IRQHANDLER EXTI15_10_IRQHANDLER RTCALARM_IRQHANDLER USBWAKEUP_IRQHANDLER B ENDP ALIGN ;***************************************************************** ************** ; USER STACK AND HEAP INITIALIZATION ;***************************************************************** ************** IF :DEF:__MICROLIB ;这 这 义 MICROLIB ???? 况, 单 机 ,都 义这个库 EXPORT __INITIAL_SP EXPORT __HEAP_BASE EXPORT __HEAP_LIMIT ELSE IMPORT __USE_TWO_REGION_MEMORY EXPORT __USER_INITIAL_STACKHEAP __USER_INITIAL_STACKHEAP LDR LDR LDR LDR BX ALIGN ENDIF END R0, = HEAP_MEM R1, =(STACK_MEM + STACK_SIZE) R2, = (HEAP_MEM + HEAP_SIZE) R3, = STACK_MEM LR .

;******************* (C) COPYRIGHT 2010 STMICROELECTRONICS *****END OF FILE***** startup_stm32f10x_md.s 结束 在上面标红字的地方,有一段函数声明,感觉那些声明很麻烦,其实,如果不用这种方式,在 DCD 的命令 前面用 IMPORT 声明会简洁很多。当然,这里面具体的差异还有些不太明白,希望懂的朋友解释一下。 下面是 stm32f10x_vector.s 里面的 import 方式 Stm32f10x_vector.s ; 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 SPACE STACK_SIZE

STACK_MEM

__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 AREA 0X00000C60 HEAP, NOINIT, READWRITE, ALIGN=3

__HEAP_BASE HEAP_MEM __HEAP_LIMIT

SPACE

HEAP_SIZE

THUMB PRESERVE8 ; IMPORT EXCEPTIONS HANDLERS IMPORT NMIEXCEPTION IMPORT HARDFAULTEXCEPTION IMPORT MEMMANAGEEXCEPTION IMPORT BUSFAULTEXCEPTION IMPORT USAGEFAULTEXCEPTION IMPORT SVCHANDLER IMPORT DEBUGMONITOR IMPORT PENDSVC 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 IMPORT IMPORT IMPORT IMPORT IMPORT IMPORT IMPORT IMPORT IMPORT IMPORT IMPORT IMPORT IMPORT IMPORT IMPORT IMPORT IMPORT IMPORT IMPORT IMPORT IMPORT IMPORT IMPORT IMPORT IMPORT IMPORT IMPORT IMPORT IMPORT IMPORT IMPORT IMPORT IMPORT

TIM1_TRG_COM_IRQHANDLER TIM1_CC_IRQHANDLER TIM2_IRQHANDLER TIM3_IRQHANDLER TIM4_IRQHANDLER I2C1_EV_IRQHANDLER I2C1_ER_IRQHANDLER I2C2_EV_IRQHANDLER I2C2_ER_IRQHANDLER SPI1_IRQHANDLER SPI2_IRQHANDLER USART1_IRQHANDLER USART2_IRQHANDLER USART3_IRQHANDLER EXTI15_10_IRQHANDLER RTCALARM_IRQHANDLER USBWAKEUP_IRQHANDLER TIM8_BRK_IRQHANDLER TIM8_UP_IRQHANDLER TIM8_TRG_COM_IRQHANDLER TIM8_CC_IRQHANDLER ADC3_IRQHANDLER FSMC_IRQHANDLER SDIO_IRQHANDLER TIM5_IRQHANDLER SPI3_IRQHANDLER UART4_IRQHANDLER UART5_IRQHANDLER TIM6_IRQHANDLER TIM7_IRQHANDLER DMA2_CHANNEL1_IRQHANDLER DMA2_CHANNEL2_IRQHANDLER DMA2_CHANNEL3_IRQHANDLER 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 DCD DCD DCD DCD DCD DCD DCD DCD DCD DCD DCD DCD DCD DCD DCD DCD DCD DCD DCD DCD DCD DCD DCD DCD DCD DCD DCD DCD DCD DCD DCD DCD DCD DCD DCD DCD DCD DCD DCD DCD DCD DCD DCD

RESET_HANDLER NMIEXCEPTION HARDFAULTEXCEPTION MEMMANAGEEXCEPTION BUSFAULTEXCEPTION USAGEFAULTEXCEPTION 0 ; RESERVED 0 ; RESERVED 0 ; RESERVED 0 ; RESERVED SVCHANDLER DEBUGMONITOR 0 ; RESERVED PENDSVC SYSTICKHANDLER WWDG_IRQHANDLER PVD_IRQHANDLER TAMPER_IRQHANDLER RTC_IRQHANDLER FLASH_IRQHANDLER RCC_IRQHANDLER EXTI0_IRQHANDLER EXTI1_IRQHANDLER EXTI2_IRQHANDLER EXTI3_IRQHANDLER EXTI4_IRQHANDLER DMA1_CHANNEL1_IRQHANDLER DMA1_CHANNEL2_IRQHANDLER DMA1_CHANNEL3_IRQHANDLER DMA1_CHANNEL4_IRQHANDLER DMA1_CHANNEL5_IRQHANDLER DMA1_CHANNEL6_IRQHANDLER DMA1_CHANNEL7_IRQHANDLER ADC1_2_IRQHANDLER USB_HP_CAN_TX_IRQHANDLER USB_LP_CAN_RX0_IRQHANDLER CAN_RX1_IRQHANDLER CAN_SCE_IRQHANDLER EXTI9_5_IRQHANDLER TIM1_BRK_IRQHANDLER TIM1_UP_IRQHANDLER TIM1_TRG_COM_IRQHANDLER TIM1_CC_IRQHANDLER TIM2_IRQHANDLER

DCD DCD DCD DCD DCD DCD DCD DCD DCD DCD DCD DCD DCD DCD DCD DCD DCD DCD DCD DCD DCD DCD DCD DCD DCD DCD DCD DCD DCD DCD DCD AREA

TIM3_IRQHANDLER TIM4_IRQHANDLER I2C1_EV_IRQHANDLER I2C1_ER_IRQHANDLER I2C2_EV_IRQHANDLER I2C2_ER_IRQHANDLER SPI1_IRQHANDLER SPI2_IRQHANDLER USART1_IRQHANDLER USART2_IRQHANDLER USART3_IRQHANDLER EXTI15_10_IRQHANDLER RTCALARM_IRQHANDLER USBWAKEUP_IRQHANDLER TIM8_BRK_IRQHANDLER TIM8_UP_IRQHANDLER TIM8_TRG_COM_IRQHANDLER TIM8_CC_IRQHANDLER ADC3_IRQHANDLER FSMC_IRQHANDLER SDIO_IRQHANDLER TIM5_IRQHANDLER SPI3_IRQHANDLER UART4_IRQHANDLER UART5_IRQHANDLER TIM6_IRQHANDLER TIM7_IRQHANDLER DMA2_CHANNEL1_IRQHANDLER DMA2_CHANNEL2_IRQHANDLER DMA2_CHANNEL3_IRQHANDLER DMA2_CHANNEL4_5_IRQHANDLER |.TEXT|, CODE, READONLY

; RESET HANDLER ROUTINE RESET_HANDLER PROC EXPORT RESET_HANDLER

IMPORT __MAIN LDR R0, =__MAIN BX R0 ENDP

ALIGN ;***************************************************************** ************** ; USER STACK AND HEAP INITIALIZATION ;***************************************************************** ************** IF :DEF:__MICROLIB EXPORT __INITIAL_SP EXPORT __HEAP_BASE EXPORT __HEAP_LIMIT ELSE IMPORT __USE_TWO_REGION_MEMORY EXPORT __USER_INITIAL_STACKHEAP __USER_INITIAL_STACKHEAP LDR LDR LDR LDR BX ALIGN ENDIF END ;******************* (C) COPYRIGHT 2008 STMICROELECTRONICS *****END OF FILE***** Stm32f10x_vector.s 结束 R0, = HEAP_MEM R1, =(STACK_MEM + STACK_SIZE) R2, = (HEAP_MEM + HEAP_SIZE) R3, = STACK_MEM LR

上面的两个文件, 个人比较喜欢 Stm32f10x_vector.s 这种方式, 代码比较简洁。 当然, 在使用 Stm32f10x_vector.s 这个文件时,应用程序的 main()里面要有 stm32 单片机的外设初始化步骤。而使用 startup_stm32f10x_md.s, 需要将初始化外设的步骤放在一个单独的函数 SystemInit ()里面。具体采用哪种方式,看个人习惯了。

还有一点需要补充的是,在跳转语句: LDR R0, =__MAIN BX R0 ENDP __MAIN 并不是你的应用程序中写的 main() ,而是编译器产生的几行代码,通过 keil 的模拟,定位到了如 下几个地方:

上述的几个代码执行完成之后,才跳转到用户编写的 main()里面。上面的这些代码,从其名称来看,应 该是初始化堆栈,初始化零代码区的功能。不过这个与我们的目标关系不大,暂且不去深究。


相关文章:
关于ucos中os_tmr.c中的代码分析
关于ucos中os_tmr.c中的代码分析_信息与通信_工程科技_专业资料。μCOSII中软件定时器关于ucos 中 os_tmr.c 中的代码分析 (2011-08-04 20:07:41) 转载...
μCOS-II中uCOS_II.H源码中文注释版
μCOS-II中uCOS_II.H源码中文注释版_计算机软件及应用_IT/计算机_专业资料 暂无评价|0人阅读|0次下载|举报文档 μCOS-II中uCOS_II.H源码中文注释版_计算机...
UCOS 复习题
UCOS学习总结 11页 免费U​C​O​S​ ​复​习​题 暂无评价|0人阅读|0次下载|举报文档 基​于​嵌​入​式​实​时​操​作...
uCOS_II中文注释
8页 免费 ucos ii 各函数的使用方法... 291页 1财富值如要投诉违规内容,请到百度文库投诉中心;如要提出功能问题或意见建议,请点击此处进行反馈。...
ucOS与Linux的比较
ucOS与Linux的比较_信息与通信_工程科技_专业资料。ucOS与Linux的比较uc/OS 与 Linux 的比较 Posted: 2005-12-5 9:18:17 随着现代计算机技术的飞速发展和互联...
uCos学习心得体会
uCos学习心得体会_计算机硬件及网络_IT/计算机_专业资料。老师布置的作业,自己按照真实情况写的。供大家参考。uCos-II 学习心得体会 从开始学习 uCos-II 到现在已经...
uCOS II中信号量的使用
uCOS II 中信号量的使用对于信号量,uCOS II 中共提供了六个函数:OSSemCreate 、OSSemDel、OSSemPend、OSSemPost、OS SemAccept、OSSemQuery。其中我们常用的只有三个...
VC环境下UCOS-II移植
VC环境下UCOS-II移植_信息与通信_工程科技_专业资料。VC环境下UCOS-II移植很有用。。比bc好多了。。。1 VC 下时钟的获得《嵌入式实时操作系统 uC/OS-II》这...
uCOS-II中关于信号量的使用总结
uCOS-II中关于信号量的使用总结_调查/报告_表格/模板_实用文档。有关uCOS—II信号量的一些理解 uCOS-II 中关于信号量的使用总结在 ucos-II 中,为了实现任务之间...
ucos下lwip应用心得
ucos下lwip应用心得_专业资料。lwip ucos 下 lwip 应用心得 经过几天调试除掉几个 bug 以后,ucos+lwip 在我的 44b0+8019 开发板上终于跑得比较稳定了. 一只...
更多相关标签: