├── .gitattributes ├── LICENSE ├── README.md ├── README_ZH.md ├── cm_backtrace ├── Languages │ ├── README.md │ ├── en-US │ │ └── cmb_en_US.h │ └── zh-CN │ │ ├── cmb_zh_CN.h │ │ └── cmb_zh_CN_UTF8.h ├── cm_backtrace.c ├── cm_backtrace.h ├── cmb_cfg.h ├── cmb_def.h └── fault_handler │ ├── gcc │ └── cmb_fault.S │ ├── ghs │ └── cmb_fault.s │ ├── iar │ └── cmb_fault.S │ └── keil │ └── cmb_fault.S ├── demos ├── non_os │ └── stm32f10x │ │ ├── EWARM │ │ ├── .gitignore │ │ ├── CmBacktrace.ewp │ │ ├── CmBacktrace.ewt │ │ ├── CmBacktrace.eww │ │ └── settings │ │ │ ├── CmBacktrace.crun │ │ │ └── CmBacktrace.wspos │ │ ├── Libraries │ │ ├── CMSIS_EWARM │ │ │ ├── CM3 │ │ │ │ └── DeviceSupport │ │ │ │ │ └── ST │ │ │ │ │ └── STM32F10x │ │ │ │ │ ├── Release_Notes.html │ │ │ │ │ ├── startup │ │ │ │ │ └── iar │ │ │ │ │ │ ├── startup_stm32f10x_cl.s │ │ │ │ │ │ ├── startup_stm32f10x_hd.s │ │ │ │ │ │ ├── startup_stm32f10x_hd_vl.s │ │ │ │ │ │ ├── startup_stm32f10x_ld.s │ │ │ │ │ │ ├── startup_stm32f10x_ld_vl.s │ │ │ │ │ │ ├── startup_stm32f10x_md.s │ │ │ │ │ │ ├── startup_stm32f10x_md_vl.s │ │ │ │ │ │ └── startup_stm32f10x_xl.s │ │ │ │ │ ├── stm32f10x.h │ │ │ │ │ ├── system_stm32f10x.c │ │ │ │ │ └── system_stm32f10x.h │ │ │ ├── CMSIS END USER LICENCE AGREEMENT.pdf │ │ │ ├── CMSIS debug support.htm │ │ │ ├── CMSIS_changes.htm │ │ │ ├── Documentation │ │ │ │ └── CMSIS_Core.htm │ │ │ ├── Include │ │ │ │ ├── arm_common_tables.h │ │ │ │ ├── arm_math.h │ │ │ │ ├── core_cm0.h │ │ │ │ ├── core_cm0plus.h │ │ │ │ ├── core_cm3.h │ │ │ │ ├── core_cm4.h │ │ │ │ ├── core_cm4_simd.h │ │ │ │ ├── core_cmFunc.h │ │ │ │ ├── core_cmInstr.h │ │ │ │ ├── core_sc000.h │ │ │ │ └── core_sc300.h │ │ │ ├── License.doc │ │ │ ├── README.txt │ │ │ ├── index.htm │ │ │ └── readme_patch.txt │ │ ├── CMSIS_RVMDK │ │ │ ├── CM3 │ │ │ │ ├── CoreSupport │ │ │ │ │ ├── core_cm3.c │ │ │ │ │ └── core_cm3.h │ │ │ │ └── DeviceSupport │ │ │ │ │ └── ST │ │ │ │ │ ├── Release_Notes_for_STM32F10x_CMSIS.html │ │ │ │ │ └── STM32F10x │ │ │ │ │ ├── Release_Notes.html │ │ │ │ │ ├── startup │ │ │ │ │ └── arm │ │ │ │ │ │ ├── startup_stm32f10x_cl.s │ │ │ │ │ │ ├── startup_stm32f10x_hd.s │ │ │ │ │ │ ├── startup_stm32f10x_hd_vl.s │ │ │ │ │ │ ├── startup_stm32f10x_ld.s │ │ │ │ │ │ ├── startup_stm32f10x_ld_vl.s │ │ │ │ │ │ ├── startup_stm32f10x_md.s │ │ │ │ │ │ ├── startup_stm32f10x_md_vl.s │ │ │ │ │ │ └── startup_stm32f10x_xl.s │ │ │ │ │ ├── stm32f10x.h │ │ │ │ │ ├── system_stm32f10x.c │ │ │ │ │ └── system_stm32f10x.h │ │ │ ├── CMSIS debug support.htm │ │ │ ├── CMSIS_changes.htm │ │ │ ├── Documentation │ │ │ │ └── CMSIS_Core.htm │ │ │ └── License.doc │ │ ├── SConscript │ │ └── STM32F10x_StdPeriph_Driver │ │ │ ├── Release_Notes.html │ │ │ ├── Release_Notes_for_STM32F10x_StdPeriph_Driver.html │ │ │ ├── inc │ │ │ ├── misc.h │ │ │ ├── stm32f10x_adc.h │ │ │ ├── stm32f10x_bkp.h │ │ │ ├── stm32f10x_can.h │ │ │ ├── stm32f10x_cec.h │ │ │ ├── stm32f10x_crc.h │ │ │ ├── stm32f10x_dac.h │ │ │ ├── stm32f10x_dbgmcu.h │ │ │ ├── stm32f10x_dma.h │ │ │ ├── stm32f10x_exti.h │ │ │ ├── stm32f10x_flash.h │ │ │ ├── stm32f10x_fsmc.h │ │ │ ├── stm32f10x_gpio.h │ │ │ ├── stm32f10x_i2c.h │ │ │ ├── stm32f10x_iwdg.h │ │ │ ├── stm32f10x_pwr.h │ │ │ ├── stm32f10x_rcc.h │ │ │ ├── stm32f10x_rtc.h │ │ │ ├── stm32f10x_sdio.h │ │ │ ├── stm32f10x_spi.h │ │ │ ├── stm32f10x_tim.h │ │ │ ├── stm32f10x_usart.h │ │ │ └── stm32f10x_wwdg.h │ │ │ └── src │ │ │ ├── misc.c │ │ │ ├── stm32f10x_adc.c │ │ │ ├── stm32f10x_bkp.c │ │ │ ├── stm32f10x_can.c │ │ │ ├── stm32f10x_cec.c │ │ │ ├── stm32f10x_crc.c │ │ │ ├── stm32f10x_dac.c │ │ │ ├── stm32f10x_dbgmcu.c │ │ │ ├── stm32f10x_dma.c │ │ │ ├── stm32f10x_exti.c │ │ │ ├── stm32f10x_flash.c │ │ │ ├── stm32f10x_fsmc.c │ │ │ ├── stm32f10x_gpio.c │ │ │ ├── stm32f10x_i2c.c │ │ │ ├── stm32f10x_iwdg.c │ │ │ ├── stm32f10x_pwr.c │ │ │ ├── stm32f10x_rcc.c │ │ │ ├── stm32f10x_rtc.c │ │ │ ├── stm32f10x_sdio.c │ │ │ ├── stm32f10x_spi.c │ │ │ ├── stm32f10x_tim.c │ │ │ ├── stm32f10x_usart.c │ │ │ └── stm32f10x_wwdg.c │ │ ├── README.md │ │ ├── RVMDK │ │ ├── .gitignore │ │ ├── CmBacktrace.uvopt │ │ ├── CmBacktrace.uvproj │ │ ├── JLink Regs CM3.txt │ │ ├── JLinkLog.txt │ │ └── JLinkSettings.ini │ │ ├── app │ │ ├── inc │ │ │ ├── stm32f10x_conf.h │ │ │ └── stm32f10x_it.h │ │ └── src │ │ │ ├── app.c │ │ │ ├── fault_test.c │ │ │ └── stm32f10x_it.c │ │ └── components │ │ ├── cm_backtrace │ │ └── cmb_cfg.h │ │ └── others │ │ ├── bsp.c │ │ ├── bsp.h │ │ ├── stm32f103xB.icf │ │ ├── stm32f103xE.icf │ │ └── types.h └── os │ ├── freertos │ └── stm32f10x │ │ ├── EWARM │ │ ├── .gitignore │ │ ├── CmBacktrace.ewp │ │ ├── CmBacktrace.ewt │ │ ├── CmBacktrace.eww │ │ └── settings │ │ │ ├── CmBacktrace.crun │ │ │ └── CmBacktrace.wspos │ │ ├── FreeRTOS │ │ ├── FreeRTOSConfig.h │ │ ├── croutine.c │ │ ├── event_groups.c │ │ ├── include │ │ │ ├── FreeRTOS.h │ │ │ ├── StackMacros.h │ │ │ ├── croutine.h │ │ │ ├── deprecated_definitions.h │ │ │ ├── event_groups.h │ │ │ ├── list.h │ │ │ ├── mpu_prototypes.h │ │ │ ├── mpu_wrappers.h │ │ │ ├── portable.h │ │ │ ├── projdefs.h │ │ │ ├── queue.h │ │ │ ├── semphr.h │ │ │ ├── stdint.readme │ │ │ ├── task.h │ │ │ └── timers.h │ │ ├── list.c │ │ ├── portable │ │ │ ├── IAR │ │ │ │ └── ARM_CM3 │ │ │ │ │ ├── port.c │ │ │ │ │ ├── portasm.s │ │ │ │ │ └── portmacro.h │ │ │ ├── Keil │ │ │ │ └── See-also-the-RVDS-directory.txt │ │ │ ├── MemMang │ │ │ │ ├── ReadMe.url │ │ │ │ ├── heap_1.c │ │ │ │ ├── heap_2.c │ │ │ │ ├── heap_3.c │ │ │ │ ├── heap_4.c │ │ │ │ └── heap_5.c │ │ │ ├── RVDS │ │ │ │ └── ARM_CM3 │ │ │ │ │ ├── port.c │ │ │ │ │ └── portmacro.h │ │ │ └── readme.txt │ │ ├── queue.c │ │ ├── readme.txt │ │ ├── tasks.c │ │ └── timers.c │ │ ├── Libraries │ │ ├── CMSIS_EWARM │ │ │ ├── CM3 │ │ │ │ └── DeviceSupport │ │ │ │ │ └── ST │ │ │ │ │ └── STM32F10x │ │ │ │ │ ├── Release_Notes.html │ │ │ │ │ ├── startup │ │ │ │ │ └── iar │ │ │ │ │ │ ├── startup_stm32f10x_cl.s │ │ │ │ │ │ ├── startup_stm32f10x_hd.s │ │ │ │ │ │ ├── startup_stm32f10x_hd_vl.s │ │ │ │ │ │ ├── startup_stm32f10x_ld.s │ │ │ │ │ │ ├── startup_stm32f10x_ld_vl.s │ │ │ │ │ │ ├── startup_stm32f10x_md.s │ │ │ │ │ │ ├── startup_stm32f10x_md_vl.s │ │ │ │ │ │ └── startup_stm32f10x_xl.s │ │ │ │ │ ├── stm32f10x.h │ │ │ │ │ ├── system_stm32f10x.c │ │ │ │ │ └── system_stm32f10x.h │ │ │ ├── CMSIS END USER LICENCE AGREEMENT.pdf │ │ │ ├── CMSIS debug support.htm │ │ │ ├── CMSIS_changes.htm │ │ │ ├── Documentation │ │ │ │ └── CMSIS_Core.htm │ │ │ ├── Include │ │ │ │ ├── arm_common_tables.h │ │ │ │ ├── arm_math.h │ │ │ │ ├── core_cm0.h │ │ │ │ ├── core_cm0plus.h │ │ │ │ ├── core_cm3.h │ │ │ │ ├── core_cm4.h │ │ │ │ ├── core_cm4_simd.h │ │ │ │ ├── core_cmFunc.h │ │ │ │ ├── core_cmInstr.h │ │ │ │ ├── core_sc000.h │ │ │ │ └── core_sc300.h │ │ │ ├── License.doc │ │ │ ├── README.txt │ │ │ ├── index.htm │ │ │ └── readme_patch.txt │ │ ├── CMSIS_RVMDK │ │ │ ├── CM3 │ │ │ │ ├── CoreSupport │ │ │ │ │ ├── core_cm3.c │ │ │ │ │ └── core_cm3.h │ │ │ │ └── DeviceSupport │ │ │ │ │ └── ST │ │ │ │ │ ├── Release_Notes_for_STM32F10x_CMSIS.html │ │ │ │ │ └── STM32F10x │ │ │ │ │ ├── Release_Notes.html │ │ │ │ │ ├── startup │ │ │ │ │ └── arm │ │ │ │ │ │ ├── startup_stm32f10x_cl.s │ │ │ │ │ │ ├── startup_stm32f10x_hd.s │ │ │ │ │ │ ├── startup_stm32f10x_hd_vl.s │ │ │ │ │ │ ├── startup_stm32f10x_ld.s │ │ │ │ │ │ ├── startup_stm32f10x_ld_vl.s │ │ │ │ │ │ ├── startup_stm32f10x_md.s │ │ │ │ │ │ ├── startup_stm32f10x_md_vl.s │ │ │ │ │ │ └── startup_stm32f10x_xl.s │ │ │ │ │ ├── stm32f10x.h │ │ │ │ │ ├── system_stm32f10x.c │ │ │ │ │ └── system_stm32f10x.h │ │ │ ├── CMSIS debug support.htm │ │ │ ├── CMSIS_changes.htm │ │ │ ├── Documentation │ │ │ │ └── CMSIS_Core.htm │ │ │ └── License.doc │ │ ├── SConscript │ │ └── STM32F10x_StdPeriph_Driver │ │ │ ├── Release_Notes.html │ │ │ ├── Release_Notes_for_STM32F10x_StdPeriph_Driver.html │ │ │ ├── inc │ │ │ ├── misc.h │ │ │ ├── stm32f10x_adc.h │ │ │ ├── stm32f10x_bkp.h │ │ │ ├── stm32f10x_can.h │ │ │ ├── stm32f10x_cec.h │ │ │ ├── stm32f10x_crc.h │ │ │ ├── stm32f10x_dac.h │ │ │ ├── stm32f10x_dbgmcu.h │ │ │ ├── stm32f10x_dma.h │ │ │ ├── stm32f10x_exti.h │ │ │ ├── stm32f10x_flash.h │ │ │ ├── stm32f10x_fsmc.h │ │ │ ├── stm32f10x_gpio.h │ │ │ ├── stm32f10x_i2c.h │ │ │ ├── stm32f10x_iwdg.h │ │ │ ├── stm32f10x_pwr.h │ │ │ ├── stm32f10x_rcc.h │ │ │ ├── stm32f10x_rtc.h │ │ │ ├── stm32f10x_sdio.h │ │ │ ├── stm32f10x_spi.h │ │ │ ├── stm32f10x_tim.h │ │ │ ├── stm32f10x_usart.h │ │ │ └── stm32f10x_wwdg.h │ │ │ └── src │ │ │ ├── misc.c │ │ │ ├── stm32f10x_adc.c │ │ │ ├── stm32f10x_bkp.c │ │ │ ├── stm32f10x_can.c │ │ │ ├── stm32f10x_cec.c │ │ │ ├── stm32f10x_crc.c │ │ │ ├── stm32f10x_dac.c │ │ │ ├── stm32f10x_dbgmcu.c │ │ │ ├── stm32f10x_dma.c │ │ │ ├── stm32f10x_exti.c │ │ │ ├── stm32f10x_flash.c │ │ │ ├── stm32f10x_fsmc.c │ │ │ ├── stm32f10x_gpio.c │ │ │ ├── stm32f10x_i2c.c │ │ │ ├── stm32f10x_iwdg.c │ │ │ ├── stm32f10x_pwr.c │ │ │ ├── stm32f10x_rcc.c │ │ │ ├── stm32f10x_rtc.c │ │ │ ├── stm32f10x_sdio.c │ │ │ ├── stm32f10x_spi.c │ │ │ ├── stm32f10x_tim.c │ │ │ ├── stm32f10x_usart.c │ │ │ └── stm32f10x_wwdg.c │ │ ├── README.md │ │ ├── RVMDK │ │ ├── .gitignore │ │ ├── CmBacktrace.uvproj │ │ ├── JLink Regs CM3.txt │ │ ├── JLinkLog.txt │ │ └── JLinkSettings.ini │ │ ├── app │ │ ├── inc │ │ │ ├── app_cfg.h │ │ │ ├── cpu_cfg.h │ │ │ ├── os_cfg.h │ │ │ ├── stm32f10x_conf.h │ │ │ └── stm32f10x_it.h │ │ └── src │ │ │ ├── app.c │ │ │ ├── fault_test.c │ │ │ └── stm32f10x_it.c │ │ └── components │ │ ├── cm_backtrace │ │ └── cmb_cfg.h │ │ └── others │ │ ├── bsp.c │ │ ├── bsp.h │ │ ├── stm32f103xB.icf │ │ ├── stm32f103xE.icf │ │ └── types.h │ ├── rtthread │ └── stm32f4xx │ │ ├── EWARM │ │ ├── .gitignore │ │ ├── CmBacktrace.ewp │ │ ├── CmBacktrace.ewt │ │ ├── CmBacktrace.eww │ │ └── settings │ │ │ ├── CmBacktrace.crun │ │ │ └── CmBacktrace.wspos │ │ ├── Libraries │ │ ├── CMSIS │ │ │ ├── CMSIS_END_USER_LICENCE_AGREEMENT.pdf │ │ │ ├── CMSIS_END_USER_LICENCE_AGREEMENT.rtf │ │ │ ├── Device │ │ │ │ └── ST │ │ │ │ │ └── STM32F4xx │ │ │ │ │ ├── Include │ │ │ │ │ ├── stm32f4xx.h │ │ │ │ │ └── system_stm32f4xx.h │ │ │ │ │ ├── Release_Notes.html │ │ │ │ │ └── Source │ │ │ │ │ └── Templates │ │ │ │ │ ├── TASKING │ │ │ │ │ └── cstart_thumb2.asm │ │ │ │ │ ├── TrueSTUDIO │ │ │ │ │ ├── startup_stm32f401xx.s │ │ │ │ │ ├── startup_stm32f40_41xxx.s │ │ │ │ │ ├── startup_stm32f40xx.s │ │ │ │ │ ├── startup_stm32f411xe.s │ │ │ │ │ ├── startup_stm32f427_437xx.s │ │ │ │ │ ├── startup_stm32f427xx.s │ │ │ │ │ ├── startup_stm32f429_439xx.s │ │ │ │ │ └── startup_stm32f446xx.s │ │ │ │ │ ├── arm │ │ │ │ │ ├── startup_stm32f401xx.s │ │ │ │ │ ├── startup_stm32f40_41xxx.s │ │ │ │ │ ├── startup_stm32f40xx.s │ │ │ │ │ ├── startup_stm32f411xe.s │ │ │ │ │ ├── startup_stm32f427_437xx.s │ │ │ │ │ ├── startup_stm32f427x.s │ │ │ │ │ ├── startup_stm32f429_439xx.s │ │ │ │ │ └── startup_stm32f446xx.s │ │ │ │ │ ├── gcc_ride7 │ │ │ │ │ ├── startup_stm32f401xx.s │ │ │ │ │ ├── startup_stm32f40_41xxx.s │ │ │ │ │ ├── startup_stm32f40xx.s │ │ │ │ │ ├── startup_stm32f427_437xx.s │ │ │ │ │ ├── startup_stm32f427x.s │ │ │ │ │ └── startup_stm32f429_439xx.s │ │ │ │ │ ├── iar │ │ │ │ │ ├── startup_stm32f401xx.s │ │ │ │ │ ├── startup_stm32f40_41xxx.s │ │ │ │ │ ├── startup_stm32f40xx.s │ │ │ │ │ ├── startup_stm32f411xe.s │ │ │ │ │ ├── startup_stm32f427_437xx.s │ │ │ │ │ ├── startup_stm32f427x.s │ │ │ │ │ ├── startup_stm32f429_439xx.s │ │ │ │ │ └── startup_stm32f446xx.s │ │ │ │ │ └── system_stm32f4xx.c │ │ │ ├── Include │ │ │ │ ├── arm_common_tables.h │ │ │ │ ├── arm_const_structs.h │ │ │ │ ├── arm_math.h │ │ │ │ ├── core_cm0.h │ │ │ │ ├── core_cm0plus.h │ │ │ │ ├── core_cm3.h │ │ │ │ ├── core_cm4.h │ │ │ │ ├── core_cm7.h │ │ │ │ ├── core_cmFunc.h │ │ │ │ ├── core_cmInstr.h │ │ │ │ ├── core_cmSimd.h │ │ │ │ ├── core_sc000.h │ │ │ │ └── core_sc300.h │ │ │ ├── README.txt │ │ │ └── index.html │ │ └── STM32F4xx_StdPeriph_Driver │ │ │ ├── Release_Notes.html │ │ │ ├── inc │ │ │ ├── misc.h │ │ │ ├── stm32f4xx_adc.h │ │ │ ├── stm32f4xx_can.h │ │ │ ├── stm32f4xx_cec.h │ │ │ ├── stm32f4xx_crc.h │ │ │ ├── stm32f4xx_cryp.h │ │ │ ├── stm32f4xx_dac.h │ │ │ ├── stm32f4xx_dbgmcu.h │ │ │ ├── stm32f4xx_dcmi.h │ │ │ ├── stm32f4xx_dma.h │ │ │ ├── stm32f4xx_dma2d.h │ │ │ ├── stm32f4xx_exti.h │ │ │ ├── stm32f4xx_flash.h │ │ │ ├── stm32f4xx_flash_ramfunc.h │ │ │ ├── stm32f4xx_fmc.h │ │ │ ├── stm32f4xx_fmpi2c.h │ │ │ ├── stm32f4xx_fsmc.h │ │ │ ├── stm32f4xx_gpio.h │ │ │ ├── stm32f4xx_hash.h │ │ │ ├── stm32f4xx_i2c.h │ │ │ ├── stm32f4xx_iwdg.h │ │ │ ├── stm32f4xx_ltdc.h │ │ │ ├── stm32f4xx_pwr.h │ │ │ ├── stm32f4xx_qspi.h │ │ │ ├── stm32f4xx_rcc.h │ │ │ ├── stm32f4xx_rng.h │ │ │ ├── stm32f4xx_rtc.h │ │ │ ├── stm32f4xx_sai.h │ │ │ ├── stm32f4xx_sdio.h │ │ │ ├── stm32f4xx_spdifrx.h │ │ │ ├── stm32f4xx_spi.h │ │ │ ├── stm32f4xx_syscfg.h │ │ │ ├── stm32f4xx_tim.h │ │ │ ├── stm32f4xx_usart.h │ │ │ └── stm32f4xx_wwdg.h │ │ │ └── src │ │ │ ├── misc.c │ │ │ ├── stm32f4xx_adc.c │ │ │ ├── stm32f4xx_can.c │ │ │ ├── stm32f4xx_cec.c │ │ │ ├── stm32f4xx_crc.c │ │ │ ├── stm32f4xx_cryp.c │ │ │ ├── stm32f4xx_cryp_aes.c │ │ │ ├── stm32f4xx_cryp_des.c │ │ │ ├── stm32f4xx_cryp_tdes.c │ │ │ ├── stm32f4xx_dac.c │ │ │ ├── stm32f4xx_dbgmcu.c │ │ │ ├── stm32f4xx_dcmi.c │ │ │ ├── stm32f4xx_dma.c │ │ │ ├── stm32f4xx_dma2d.c │ │ │ ├── stm32f4xx_exti.c │ │ │ ├── stm32f4xx_flash.c │ │ │ ├── stm32f4xx_flash_ramfunc.c │ │ │ ├── stm32f4xx_fmc.c │ │ │ ├── stm32f4xx_fmpi2c.c │ │ │ ├── stm32f4xx_fsmc.c │ │ │ ├── stm32f4xx_gpio.c │ │ │ ├── stm32f4xx_hash.c │ │ │ ├── stm32f4xx_hash_md5.c │ │ │ ├── stm32f4xx_hash_sha1.c │ │ │ ├── stm32f4xx_i2c.c │ │ │ ├── stm32f4xx_iwdg.c │ │ │ ├── stm32f4xx_ltdc.c │ │ │ ├── stm32f4xx_pwr.c │ │ │ ├── stm32f4xx_qspi.c │ │ │ ├── stm32f4xx_rcc.c │ │ │ ├── stm32f4xx_rng.c │ │ │ ├── stm32f4xx_rtc.c │ │ │ ├── stm32f4xx_sai.c │ │ │ ├── stm32f4xx_sdio.c │ │ │ ├── stm32f4xx_spdifrx.c │ │ │ ├── stm32f4xx_spi.c │ │ │ ├── stm32f4xx_syscfg.c │ │ │ ├── stm32f4xx_tim.c │ │ │ ├── stm32f4xx_usart.c │ │ │ └── stm32f4xx_wwdg.c │ │ ├── README.md │ │ ├── RT-Thread-1.2.2 │ │ ├── AUTHORS │ │ ├── COPYING │ │ ├── components │ │ │ ├── SConscript │ │ │ ├── drivers │ │ │ │ ├── SConscript │ │ │ │ ├── include │ │ │ │ │ ├── drivers │ │ │ │ │ │ ├── alarm.h │ │ │ │ │ │ ├── i2c-bit-ops.h │ │ │ │ │ │ ├── i2c.h │ │ │ │ │ │ ├── i2c_dev.h │ │ │ │ │ │ ├── mmcsd_card.h │ │ │ │ │ │ ├── mmcsd_cmd.h │ │ │ │ │ │ ├── mmcsd_core.h │ │ │ │ │ │ ├── mmcsd_host.h │ │ │ │ │ │ ├── mtd_nand.h │ │ │ │ │ │ ├── mtd_nor.h │ │ │ │ │ │ ├── rtc.h │ │ │ │ │ │ ├── sd.h │ │ │ │ │ │ ├── sdio.h │ │ │ │ │ │ ├── sdio_func_ids.h │ │ │ │ │ │ ├── serial.h │ │ │ │ │ │ ├── spi.h │ │ │ │ │ │ ├── usb_common.h │ │ │ │ │ │ ├── usb_device.h │ │ │ │ │ │ └── usb_host.h │ │ │ │ │ └── rtdevice.h │ │ │ │ ├── serial │ │ │ │ │ ├── SConscript │ │ │ │ │ └── serial.c │ │ │ │ └── src │ │ │ │ │ ├── SConscript │ │ │ │ │ ├── completion.c │ │ │ │ │ ├── dataqueue.c │ │ │ │ │ ├── pipe.c │ │ │ │ │ ├── portal.c │ │ │ │ │ ├── ringbuffer.c │ │ │ │ │ └── wrokqueue.c │ │ │ └── finsh │ │ │ │ ├── SConscript │ │ │ │ ├── cmd.c │ │ │ │ ├── finsh.h │ │ │ │ ├── finsh_compiler.c │ │ │ │ ├── finsh_error.c │ │ │ │ ├── finsh_error.h │ │ │ │ ├── finsh_heap.c │ │ │ │ ├── finsh_heap.h │ │ │ │ ├── finsh_init.c │ │ │ │ ├── finsh_node.c │ │ │ │ ├── finsh_node.h │ │ │ │ ├── finsh_ops.c │ │ │ │ ├── finsh_ops.h │ │ │ │ ├── finsh_parser.c │ │ │ │ ├── finsh_parser.h │ │ │ │ ├── finsh_token.c │ │ │ │ ├── finsh_token.h │ │ │ │ ├── finsh_var.c │ │ │ │ ├── finsh_var.h │ │ │ │ ├── finsh_vm.c │ │ │ │ ├── finsh_vm.h │ │ │ │ ├── msh.c │ │ │ │ ├── msh.h │ │ │ │ ├── msh_cmd.c │ │ │ │ ├── shell.c │ │ │ │ ├── shell.h │ │ │ │ └── symbol.c │ │ ├── include │ │ │ ├── cpuusage.h │ │ │ ├── rtdebug.h │ │ │ ├── rtdef.h │ │ │ ├── rthw.h │ │ │ ├── rtm.h │ │ │ ├── rtservice.h │ │ │ └── rtthread.h │ │ ├── libcpu │ │ │ ├── SConscript │ │ │ └── arm │ │ │ │ └── cortex-m4 │ │ │ │ ├── context_gcc.S │ │ │ │ ├── context_iar.S │ │ │ │ ├── context_rvds.S │ │ │ │ └── cpuport.c │ │ └── src │ │ │ ├── SConscript │ │ │ ├── clock.c │ │ │ ├── cpuusage.c │ │ │ ├── device.c │ │ │ ├── idle.c │ │ │ ├── ipc.c │ │ │ ├── irq.c │ │ │ ├── kservice.c │ │ │ ├── mem.c │ │ │ ├── memheap.c │ │ │ ├── mempool.c │ │ │ ├── module.c │ │ │ ├── module.h │ │ │ ├── object.c │ │ │ ├── scheduler.c │ │ │ ├── slab.c │ │ │ ├── thread.c │ │ │ └── timer.c │ │ ├── RVMDK │ │ ├── .gitignore │ │ └── README.md │ │ ├── app │ │ ├── inc │ │ │ ├── app_task.h │ │ │ ├── delay_conf.h │ │ │ ├── rtconfig.h │ │ │ ├── stm32f4xx_conf.h │ │ │ └── stm32f4xx_it.h │ │ └── src │ │ │ ├── app.c │ │ │ ├── app_task.c │ │ │ ├── fault_test.c │ │ │ ├── stm32f4xx_it.c │ │ │ └── user_finsh_cmd.c │ │ └── components │ │ ├── cm_backtrace │ │ └── cmb_cfg.h │ │ ├── others │ │ ├── bsp.c │ │ ├── bsp.h │ │ ├── stm32f405xG.icf │ │ ├── types.h │ │ ├── utils.c │ │ └── utils.h │ │ └── rtt_uart │ │ ├── usart.c │ │ └── usart.h │ └── ucosii │ └── stm32f10x │ ├── EWARM │ ├── .gitignore │ ├── CmBacktrace.ewp │ ├── CmBacktrace.ewt │ ├── CmBacktrace.eww │ └── settings │ │ ├── CmBacktrace.crun │ │ └── CmBacktrace.wspos │ ├── Libraries │ ├── CMSIS_EWARM │ │ ├── CM3 │ │ │ └── DeviceSupport │ │ │ │ └── ST │ │ │ │ └── STM32F10x │ │ │ │ ├── Release_Notes.html │ │ │ │ ├── startup │ │ │ │ └── iar │ │ │ │ │ ├── startup_stm32f10x_cl.s │ │ │ │ │ ├── startup_stm32f10x_hd.s │ │ │ │ │ ├── startup_stm32f10x_hd_vl.s │ │ │ │ │ ├── startup_stm32f10x_ld.s │ │ │ │ │ ├── startup_stm32f10x_ld_vl.s │ │ │ │ │ ├── startup_stm32f10x_md.s │ │ │ │ │ ├── startup_stm32f10x_md_vl.s │ │ │ │ │ └── startup_stm32f10x_xl.s │ │ │ │ ├── stm32f10x.h │ │ │ │ ├── system_stm32f10x.c │ │ │ │ └── system_stm32f10x.h │ │ ├── CMSIS END USER LICENCE AGREEMENT.pdf │ │ ├── CMSIS debug support.htm │ │ ├── CMSIS_changes.htm │ │ ├── Documentation │ │ │ └── CMSIS_Core.htm │ │ ├── Include │ │ │ ├── arm_common_tables.h │ │ │ ├── arm_math.h │ │ │ ├── core_cm0.h │ │ │ ├── core_cm0plus.h │ │ │ ├── core_cm3.h │ │ │ ├── core_cm4.h │ │ │ ├── core_cm4_simd.h │ │ │ ├── core_cmFunc.h │ │ │ ├── core_cmInstr.h │ │ │ ├── core_sc000.h │ │ │ └── core_sc300.h │ │ ├── License.doc │ │ ├── README.txt │ │ ├── index.htm │ │ └── readme_patch.txt │ ├── CMSIS_RVMDK │ │ ├── CM3 │ │ │ ├── CoreSupport │ │ │ │ ├── core_cm3.c │ │ │ │ └── core_cm3.h │ │ │ └── DeviceSupport │ │ │ │ └── ST │ │ │ │ ├── Release_Notes_for_STM32F10x_CMSIS.html │ │ │ │ └── STM32F10x │ │ │ │ ├── Release_Notes.html │ │ │ │ ├── startup │ │ │ │ └── arm │ │ │ │ │ ├── startup_stm32f10x_cl.s │ │ │ │ │ ├── startup_stm32f10x_hd.s │ │ │ │ │ ├── startup_stm32f10x_hd_vl.s │ │ │ │ │ ├── startup_stm32f10x_ld.s │ │ │ │ │ ├── startup_stm32f10x_ld_vl.s │ │ │ │ │ ├── startup_stm32f10x_md.s │ │ │ │ │ ├── startup_stm32f10x_md_vl.s │ │ │ │ │ └── startup_stm32f10x_xl.s │ │ │ │ ├── stm32f10x.h │ │ │ │ ├── system_stm32f10x.c │ │ │ │ └── system_stm32f10x.h │ │ ├── CMSIS debug support.htm │ │ ├── CMSIS_changes.htm │ │ ├── Documentation │ │ │ └── CMSIS_Core.htm │ │ └── License.doc │ ├── SConscript │ └── STM32F10x_StdPeriph_Driver │ │ ├── Release_Notes.html │ │ ├── Release_Notes_for_STM32F10x_StdPeriph_Driver.html │ │ ├── inc │ │ ├── misc.h │ │ ├── stm32f10x_adc.h │ │ ├── stm32f10x_bkp.h │ │ ├── stm32f10x_can.h │ │ ├── stm32f10x_cec.h │ │ ├── stm32f10x_crc.h │ │ ├── stm32f10x_dac.h │ │ ├── stm32f10x_dbgmcu.h │ │ ├── stm32f10x_dma.h │ │ ├── stm32f10x_exti.h │ │ ├── stm32f10x_flash.h │ │ ├── stm32f10x_fsmc.h │ │ ├── stm32f10x_gpio.h │ │ ├── stm32f10x_i2c.h │ │ ├── stm32f10x_iwdg.h │ │ ├── stm32f10x_pwr.h │ │ ├── stm32f10x_rcc.h │ │ ├── stm32f10x_rtc.h │ │ ├── stm32f10x_sdio.h │ │ ├── stm32f10x_spi.h │ │ ├── stm32f10x_tim.h │ │ ├── stm32f10x_usart.h │ │ └── stm32f10x_wwdg.h │ │ └── src │ │ ├── misc.c │ │ ├── stm32f10x_adc.c │ │ ├── stm32f10x_bkp.c │ │ ├── stm32f10x_can.c │ │ ├── stm32f10x_cec.c │ │ ├── stm32f10x_crc.c │ │ ├── stm32f10x_dac.c │ │ ├── stm32f10x_dbgmcu.c │ │ ├── stm32f10x_dma.c │ │ ├── stm32f10x_exti.c │ │ ├── stm32f10x_flash.c │ │ ├── stm32f10x_fsmc.c │ │ ├── stm32f10x_gpio.c │ │ ├── stm32f10x_i2c.c │ │ ├── stm32f10x_iwdg.c │ │ ├── stm32f10x_pwr.c │ │ ├── stm32f10x_rcc.c │ │ ├── stm32f10x_rtc.c │ │ ├── stm32f10x_sdio.c │ │ ├── stm32f10x_spi.c │ │ ├── stm32f10x_tim.c │ │ ├── stm32f10x_usart.c │ │ └── stm32f10x_wwdg.c │ ├── README.md │ ├── RVMDK │ ├── .gitignore │ ├── CmBacktrace.uvopt │ ├── CmBacktrace.uvproj │ ├── JLink Regs CM3.txt │ ├── JLinkLog.txt │ └── JLinkSettings.ini │ ├── app │ ├── inc │ │ ├── app_cfg.h │ │ ├── cpu_cfg.h │ │ ├── os_cfg.h │ │ ├── stm32f10x_conf.h │ │ └── stm32f10x_it.h │ └── src │ │ ├── app.c │ │ ├── fault_test.c │ │ └── stm32f10x_it.c │ ├── components │ ├── cm_backtrace │ │ └── cmb_cfg.h │ └── others │ │ ├── bsp.c │ │ ├── bsp.h │ │ ├── stm32f103xB.icf │ │ ├── stm32f103xE.icf │ │ └── types.h │ └── ucosii │ ├── Ports │ └── ARM-Cortex-M3 │ │ └── Generic │ │ ├── GNU │ │ ├── os_cpu.h │ │ ├── os_cpu_a.asm │ │ ├── os_cpu_c.c │ │ └── os_dbg.c │ │ ├── IAR │ │ ├── os_cpu.h │ │ ├── os_cpu_a.asm │ │ ├── os_cpu_c.c │ │ └── os_dbg.c │ │ └── RealView │ │ ├── os_cpu.h │ │ ├── os_cpu_a.asm │ │ ├── os_cpu_c.c │ │ └── os_dbg.c │ ├── Source │ ├── os_core.c │ ├── os_flag.c │ ├── os_mbox.c │ ├── os_mem.c │ ├── os_mutex.c │ ├── os_q.c │ ├── os_sem.c │ ├── os_task.c │ ├── os_time.c │ ├── os_tmr.c │ ├── ucos_ii.c │ └── ucos_ii.h │ ├── uC-CPU │ ├── ARM-Cortex-M3 │ │ ├── GNU │ │ │ ├── cpu.h │ │ │ ├── cpu_a.s │ │ │ └── cpu_c.c │ │ ├── IAR │ │ │ ├── cpu.h │ │ │ ├── cpu_a.asm │ │ │ └── cpu_c.c │ │ └── RealView │ │ │ ├── cpu.h │ │ │ ├── cpu_a.asm │ │ │ └── cpu_c.c │ ├── cpu_core.c │ ├── cpu_core.h │ └── cpu_def.h │ └── uC-LIB │ ├── Ports │ └── ARM-Cortex-M3 │ │ ├── IAR │ │ └── lib_mem_a.asm │ │ └── RealView │ │ └── lib_mem_a.asm │ ├── lib_ascii.c │ ├── lib_ascii.h │ ├── lib_def.h │ ├── lib_math.c │ ├── lib_math.h │ ├── lib_mem.c │ ├── lib_mem.h │ ├── lib_str.c │ └── lib_str.h ├── docs ├── README.md └── zh │ ├── enable_c99_for_keil_iar_gcc.md │ ├── how_to_use_addr2line_for_call_stack.md │ └── images │ ├── cm_backtrace_demo.gif │ ├── demo │ ├── CmBacktrace.uga │ ├── call_stack_basic_info.png │ ├── call_stack_details.png │ ├── cd_exe_dir.png │ ├── demo_code.png │ ├── fault_diagnosis.png │ └── paste_cmd.png │ ├── iar_enable_c99.png │ ├── keil4_enable_c99.jpg │ └── keil5_enable_c99.jpg └── tools └── addr2line ├── win32 └── addr2line.exe └── win64 └── addr2line.exe /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | 3 | *.S text 4 | *.asm text 5 | *.c text 6 | *.cc text 7 | *.cpp text 8 | *.cxx text 9 | *.h text 10 | *.htm text 11 | *.html text 12 | *.in text 13 | *.ld text 14 | *.m4 text 15 | *.mak text 16 | *.mk text 17 | *.py text 18 | *.rb text 19 | *.s text 20 | *.sct text 21 | *.sh text 22 | *.txt text 23 | *.xml text 24 | Makefile text 25 | AUTHORS text 26 | COPYING text 27 | 28 | *.LZO -text 29 | *.Opt -text 30 | *.Uv2 -text 31 | *.ewp -text 32 | *.eww -text 33 | *.vcproj -text 34 | *.bat -text 35 | *.dos -text 36 | *.icf -text 37 | *.inf -text 38 | *.ini -text 39 | *.sct -text 40 | *.xsd -text 41 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016-2019 Armink (armink.ztl@gmail.com) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | 'Software'), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 20 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 21 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /cm_backtrace/Languages/README.md: -------------------------------------------------------------------------------- 1 | # CmBacktrace: ARM Cortex-M 系列 MCU 错误追踪库 2 | 3 | ## 多语言支持 4 | 5 | | Language | Location (or type) | Language tag | 6 | |----------------------|----------------------------|--------------| 7 | | English | United States | en-US | 8 | | Chinese (Simplified) | People's Republic of China | zh-CN | -------------------------------------------------------------------------------- /cm_backtrace/Languages/zh-CN/cmb_zh_CN.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/CmBacktrace/4bec5c8a6c4ac65310174bf13ceb57830dd2d3f3/cm_backtrace/Languages/zh-CN/cmb_zh_CN.h -------------------------------------------------------------------------------- /cm_backtrace/cm_backtrace.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the CmBacktrace Library. 3 | * 4 | * Copyright (c) 2016, Armink, 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining 7 | * a copy of this software and associated documentation files (the 8 | * 'Software'), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, 10 | * distribute, sublicense, and/or sell copies of the Software, and to 11 | * permit persons to whom the Software is furnished to do so, subject to 12 | * the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 20 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 21 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 22 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 23 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | * 25 | * Function: It is an head file for this library. You can see all be called functions. 26 | * Created on: 2016-12-15 27 | */ 28 | 29 | #ifndef _CORTEXM_BACKTRACE_H_ 30 | #define _CORTEXM_BACKTRACE_H_ 31 | 32 | #include "cmb_def.h" 33 | 34 | #ifdef __cplusplus 35 | extern "C" { 36 | #endif 37 | 38 | void cm_backtrace_init(const char *firmware_name, const char *hardware_ver, const char *software_ver); 39 | void cm_backtrace_firmware_info(void); 40 | size_t cm_backtrace_call_stack(uint32_t *buffer, size_t size, uint32_t sp); 41 | void cm_backtrace_assert(uint32_t sp); 42 | void cm_backtrace_fault(uint32_t fault_handler_lr, uint32_t fault_handler_sp); 43 | 44 | #ifdef __cplusplus 45 | } 46 | #endif 47 | 48 | #endif /* _CORTEXM_BACKTRACE_H_ */ 49 | -------------------------------------------------------------------------------- /cm_backtrace/cmb_cfg.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the CmBacktrace Library. 3 | * 4 | * Copyright (c) 2016, Armink, 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining 7 | * a copy of this software and associated documentation files (the 8 | * 'Software'), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, 10 | * distribute, sublicense, and/or sell copies of the Software, and to 11 | * permit persons to whom the Software is furnished to do so, subject to 12 | * the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 20 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 21 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 22 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 23 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | * 25 | * Function: It is the configure head file for this library. 26 | * Created on: 2016-12-15 27 | */ 28 | 29 | #ifndef _CMB_CFG_H_ 30 | #define _CMB_CFG_H_ 31 | 32 | #ifdef CMB_USER_CFG 33 | #include "cmb_user_cfg.h" 34 | #else 35 | /* print line, must config by user */ 36 | #define cmb_println(...) /* e.g., printf(__VA_ARGS__);printf("\r\n") or SEGGER_RTT_printf(0, __VA_ARGS__);SEGGER_RTT_WriteString(0, "\r\n") */ 37 | /* enable bare metal(no OS) platform */ 38 | /* #define CMB_USING_BARE_METAL_PLATFORM */ 39 | /* enable OS platform */ 40 | /* #define CMB_USING_OS_PLATFORM */ 41 | /* OS platform type, must config when CMB_USING_OS_PLATFORM is enable */ 42 | /* #define CMB_OS_PLATFORM_TYPE CMB_OS_PLATFORM_RTT or CMB_OS_PLATFORM_UCOSII or CMB_OS_PLATFORM_UCOSIII or CMB_OS_PLATFORM_FREERTOS or CMB_OS_PLATFORM_RTX5 or CMB_OS_PLATFORM_THREADX */ 43 | /* cpu platform type, must config by user */ 44 | #define CMB_CPU_PLATFORM_TYPE /* CMB_CPU_ARM_CORTEX_M0 or CMB_CPU_ARM_CORTEX_M3 or CMB_CPU_ARM_CORTEX_M4 or CMB_CPU_ARM_CORTEX_M7 or CMB_CPU_ARM_CORTEX_M33 */ 45 | /* enable dump stack information */ 46 | /* #define CMB_USING_DUMP_STACK_INFO */ 47 | /* language of print information */ 48 | /* #define CMB_PRINT_LANGUAGE CMB_PRINT_LANGUAGE_ENGLISH(default) or CMB_PRINT_LANGUAGE_CHINESE or CMB_PRINT_LANGUAGE_CHINESE_UTF8 */ 49 | #endif 50 | 51 | #endif /* _CMB_CFG_H_ */ 52 | -------------------------------------------------------------------------------- /cm_backtrace/fault_handler/gcc/cmb_fault.S: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the CmBacktrace Library. 3 | * 4 | * Copyright (c) 2016, Armink, 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining 7 | * a copy of this software and associated documentation files (the 8 | * 'Software'), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, 10 | * distribute, sublicense, and/or sell copies of the Software, and to 11 | * permit persons to whom the Software is furnished to do so, subject to 12 | * the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 20 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 21 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 22 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 23 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | * 25 | * Function: Fault handler by GCC assembly code 26 | * Created on: 2016-12-16 27 | */ 28 | 29 | .syntax unified 30 | .thumb 31 | .text 32 | 33 | /* NOTE: If use this file's HardFault_Handler, please comments the HardFault_Handler code on other file. */ 34 | 35 | .global HardFault_Handler 36 | .type HardFault_Handler, %function 37 | HardFault_Handler: 38 | MOV r0, lr /* get lr */ 39 | MOV r1, sp /* get stack pointer (current is MSP) */ 40 | BL cm_backtrace_fault 41 | 42 | Fault_Loop: 43 | BL Fault_Loop /* while(1) */ 44 | -------------------------------------------------------------------------------- /cm_backtrace/fault_handler/ghs/cmb_fault.s: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the CmBacktrace Library. 3 | * 4 | * Copyright (c) 2016, Armink, 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining 7 | * a copy of this software and associated documentation files (the 8 | * 'Software'), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, 10 | * distribute, sublicense, and/or sell copies of the Software, and to 11 | * permit persons to whom the Software is furnished to do so, subject to 12 | * the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 20 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 21 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 22 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 23 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | * 25 | * Function: Fault handler by GCC assembly code 26 | * Created on: 2016-12-16 27 | */ 28 | 29 | .thumb 30 | .text 31 | 32 | /* NOTE: If use this file's HardFault_Handler, please comments the HardFault_Handler code on other file. */ 33 | 34 | .global HardFault_Handler 35 | HardFault_Handler: 36 | MOV r0, lr /* get lr */ 37 | MOV r1, sp /* get stack pointer (current is MSP) */ 38 | BL cm_backtrace_fault 39 | 40 | Fault_Loop: 41 | BL Fault_Loop /* while(1) */ 42 | -------------------------------------------------------------------------------- /cm_backtrace/fault_handler/iar/cmb_fault.S: -------------------------------------------------------------------------------- 1 | ;/* 2 | ; * This file is part of the CmBacktrace Library. 3 | ; * 4 | ; * Copyright (c) 2016, Armink, 5 | ; * 6 | ; * Permission is hereby granted, free of charge, to any person obtaining 7 | ; * a copy of this software and associated documentation files (the 8 | ; * 'Software'), to deal in the Software without restriction, including 9 | ; * without limitation the rights to use, copy, modify, merge, publish, 10 | ; * distribute, sublicense, and/or sell copies of the Software, and to 11 | ; * permit persons to whom the Software is furnished to do so, subject to 12 | ; * the following conditions: 13 | ; * 14 | ; * The above copyright notice and this permission notice shall be 15 | ; * included in all copies or substantial portions of the Software. 16 | ; * 17 | ; * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 18 | ; * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | ; * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 20 | ; * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 21 | ; * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 22 | ; * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 23 | ; * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | ; * 25 | ; * Function: Fault handler by EWARM assembly code 26 | ; * Created on: 2016-12-16 27 | ; */ 28 | 29 | SECTION .text:CODE(2) 30 | THUMB 31 | REQUIRE8 32 | PRESERVE8 33 | 34 | ; NOTE: If use this file's HardFault_Handler, please comments the HardFault_Handler code on other file. 35 | IMPORT cm_backtrace_fault 36 | EXPORT HardFault_Handler 37 | 38 | HardFault_Handler: 39 | MOV r0, lr ; get lr 40 | MOV r1, sp ; get stack pointer (current is MSP) 41 | BL cm_backtrace_fault 42 | 43 | Fault_Loop 44 | BL Fault_Loop ;while(1) 45 | 46 | END 47 | -------------------------------------------------------------------------------- /cm_backtrace/fault_handler/keil/cmb_fault.S: -------------------------------------------------------------------------------- 1 | ;/* 2 | ; * This file is part of the CmBacktrace Library. 3 | ; * 4 | ; * Copyright (c) 2016, Armink, 5 | ; * 6 | ; * Permission is hereby granted, free of charge, to any person obtaining 7 | ; * a copy of this software and associated documentation files (the 8 | ; * 'Software'), to deal in the Software without restriction, including 9 | ; * without limitation the rights to use, copy, modify, merge, publish, 10 | ; * distribute, sublicense, and/or sell copies of the Software, and to 11 | ; * permit persons to whom the Software is furnished to do so, subject to 12 | ; * the following conditions: 13 | ; * 14 | ; * The above copyright notice and this permission notice shall be 15 | ; * included in all copies or substantial portions of the Software. 16 | ; * 17 | ; * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 18 | ; * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | ; * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 20 | ; * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 21 | ; * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 22 | ; * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 23 | ; * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | ; * 25 | ; * Function: Fault handler by MDK-ARM assembly code 26 | ; * Created on: 2016-12-16 27 | ; */ 28 | 29 | AREA |.text|, CODE, READONLY, ALIGN=2 30 | THUMB 31 | REQUIRE8 32 | PRESERVE8 33 | 34 | ; NOTE: If use this file's HardFault_Handler, please comments the HardFault_Handler code on other file. 35 | IMPORT cm_backtrace_fault 36 | EXPORT HardFault_Handler 37 | 38 | HardFault_Handler PROC 39 | MOV r0, lr ; get lr 40 | MOV r1, sp ; get stack pointer (current is MSP) 41 | BL cm_backtrace_fault 42 | 43 | Fault_Loop 44 | BL Fault_Loop ;while(1) 45 | ENDP 46 | 47 | END 48 | -------------------------------------------------------------------------------- /demos/non_os/stm32f10x/EWARM/.gitignore: -------------------------------------------------------------------------------- 1 | /stm32f103xB 2 | /stm32f103xE 3 | /Debug 4 | /Release 5 | /settings/*.dbgdt 6 | /settings/*.dni 7 | /settings/*.bat 8 | /settings/*.xcl 9 | /settings/*.wsdt 10 | /settings/*.jlink 11 | *.dep 12 | *.ewd 13 | -------------------------------------------------------------------------------- /demos/non_os/stm32f10x/EWARM/CmBacktrace.eww: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | $WS_DIR$\CmBacktrace.ewp 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /demos/non_os/stm32f10x/EWARM/settings/CmBacktrace.crun: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1 5 | 6 | 7 | * 8 | * 9 | * 10 | 0 11 | 1 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /demos/non_os/stm32f10x/EWARM/settings/CmBacktrace.wspos: -------------------------------------------------------------------------------- 1 | [MainWindow] 2 | WindowPlacement=_ 210 137 1470 874 3 3 | -------------------------------------------------------------------------------- /demos/non_os/stm32f10x/Libraries/CMSIS_EWARM/CM3/DeviceSupport/ST/STM32F10x/stm32f10x.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/CmBacktrace/4bec5c8a6c4ac65310174bf13ceb57830dd2d3f3/demos/non_os/stm32f10x/Libraries/CMSIS_EWARM/CM3/DeviceSupport/ST/STM32F10x/stm32f10x.h -------------------------------------------------------------------------------- /demos/non_os/stm32f10x/Libraries/CMSIS_EWARM/CM3/DeviceSupport/ST/STM32F10x/system_stm32f10x.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file system_stm32f10x.h 4 | * @author MCD Application Team 5 | * @version V3.5.0 6 | * @date 11-March-2011 7 | * @brief CMSIS Cortex-M3 Device Peripheral Access Layer System Header File. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 17 | * 18 | *

© COPYRIGHT 2011 STMicroelectronics

19 | ****************************************************************************** 20 | */ 21 | 22 | /** @addtogroup CMSIS 23 | * @{ 24 | */ 25 | 26 | /** @addtogroup stm32f10x_system 27 | * @{ 28 | */ 29 | 30 | /** 31 | * @brief Define to prevent recursive inclusion 32 | */ 33 | #ifndef __SYSTEM_STM32F10X_H 34 | #define __SYSTEM_STM32F10X_H 35 | 36 | #ifdef __cplusplus 37 | extern "C" { 38 | #endif 39 | 40 | /** @addtogroup STM32F10x_System_Includes 41 | * @{ 42 | */ 43 | 44 | /** 45 | * @} 46 | */ 47 | 48 | 49 | /** @addtogroup STM32F10x_System_Exported_types 50 | * @{ 51 | */ 52 | 53 | extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */ 54 | 55 | /** 56 | * @} 57 | */ 58 | 59 | /** @addtogroup STM32F10x_System_Exported_Constants 60 | * @{ 61 | */ 62 | 63 | /** 64 | * @} 65 | */ 66 | 67 | /** @addtogroup STM32F10x_System_Exported_Macros 68 | * @{ 69 | */ 70 | 71 | /** 72 | * @} 73 | */ 74 | 75 | /** @addtogroup STM32F10x_System_Exported_Functions 76 | * @{ 77 | */ 78 | 79 | extern void SystemInit(void); 80 | extern void SystemCoreClockUpdate(void); 81 | /** 82 | * @} 83 | */ 84 | 85 | #ifdef __cplusplus 86 | } 87 | #endif 88 | 89 | #endif /*__SYSTEM_STM32F10X_H */ 90 | 91 | /** 92 | * @} 93 | */ 94 | 95 | /** 96 | * @} 97 | */ 98 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 99 | -------------------------------------------------------------------------------- /demos/non_os/stm32f10x/Libraries/CMSIS_EWARM/CMSIS END USER LICENCE AGREEMENT.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/CmBacktrace/4bec5c8a6c4ac65310174bf13ceb57830dd2d3f3/demos/non_os/stm32f10x/Libraries/CMSIS_EWARM/CMSIS END USER LICENCE AGREEMENT.pdf -------------------------------------------------------------------------------- /demos/non_os/stm32f10x/Libraries/CMSIS_EWARM/CMSIS debug support.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/CmBacktrace/4bec5c8a6c4ac65310174bf13ceb57830dd2d3f3/demos/non_os/stm32f10x/Libraries/CMSIS_EWARM/CMSIS debug support.htm -------------------------------------------------------------------------------- /demos/non_os/stm32f10x/Libraries/CMSIS_EWARM/Documentation/CMSIS_Core.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/CmBacktrace/4bec5c8a6c4ac65310174bf13ceb57830dd2d3f3/demos/non_os/stm32f10x/Libraries/CMSIS_EWARM/Documentation/CMSIS_Core.htm -------------------------------------------------------------------------------- /demos/non_os/stm32f10x/Libraries/CMSIS_EWARM/Include/arm_common_tables.h: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Copyright (C) 2010 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 11. November 2010 5 | * $Revision: V1.0.2 6 | * 7 | * Project: CMSIS DSP Library 8 | * Title: arm_common_tables.h 9 | * 10 | * Description: This file has extern declaration for common tables like Bitreverse, reciprocal etc which are used across different functions 11 | * 12 | * Target Processor: Cortex-M4/Cortex-M3 13 | * 14 | * Version 1.0.2 2010/11/11 15 | * Documentation updated. 16 | * 17 | * Version 1.0.1 2010/10/05 18 | * Production release and review comments incorporated. 19 | * 20 | * Version 1.0.0 2010/09/20 21 | * Production release and review comments incorporated. 22 | * -------------------------------------------------------------------- */ 23 | 24 | #ifndef _ARM_COMMON_TABLES_H 25 | #define _ARM_COMMON_TABLES_H 26 | 27 | #include "arm_math.h" 28 | 29 | extern const uint16_t armBitRevTable[1024]; 30 | extern const q15_t armRecipTableQ15[64]; 31 | extern const q31_t armRecipTableQ31[64]; 32 | extern const q31_t realCoefAQ31[1024]; 33 | extern const q31_t realCoefBQ31[1024]; 34 | extern const float32_t twiddleCoef[6144]; 35 | extern const q31_t twiddleCoefQ31[6144]; 36 | extern const q15_t twiddleCoefQ15[6144]; 37 | 38 | #endif /* ARM_COMMON_TABLES_H */ 39 | -------------------------------------------------------------------------------- /demos/non_os/stm32f10x/Libraries/CMSIS_EWARM/License.doc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/CmBacktrace/4bec5c8a6c4ac65310174bf13ceb57830dd2d3f3/demos/non_os/stm32f10x/Libraries/CMSIS_EWARM/License.doc -------------------------------------------------------------------------------- /demos/non_os/stm32f10x/Libraries/CMSIS_EWARM/README.txt: -------------------------------------------------------------------------------- 1 | * ------------------------------------------------------------------- 2 | * Copyright (C) 2011-2012 ARM Limited. All rights reserved. 3 | * 4 | * Date: 07 March 2012 5 | * Revision: V3.01 6 | * 7 | * Project: Cortex Microcontroller Software Interface Standard (CMSIS) 8 | * Title: Release Note for CMSIS 9 | * 10 | * ------------------------------------------------------------------- 11 | 12 | 13 | NOTE - Open the index.html file to access CMSIS documentation 14 | 15 | 16 | The Cortex Microcontroller Software Interface Standard (CMSIS) provides a single standard across all 17 | Cortex-Mx processor series vendors. It enables code re-use and code sharing across software projects 18 | and reduces time-to-market for new embedded applications. 19 | 20 | CMSIS is released under the terms of the end user license agreement ("CMSIS END USER LICENCE AGREEMENT.pdf"). 21 | Any user of the software package is bound to the terms and conditions of the end user license agreement. 22 | 23 | 24 | You will find the following sub-directories: 25 | 26 | Documentation - Contains CMSIS documentation. 27 | 28 | DSP_Lib - MDK project files, Examples and source files etc.. to build the 29 | CMSIS DSP Software Library for Cortex-M0, Cortex-M3, Cortex-M4 processors. 30 | 31 | Include - CMSIS Core Support and CMSIS DSP Include Files. 32 | 33 | Lib - CMSIS DSP Libraries. 34 | 35 | RTOS - CMSIS RTOS API template header file. 36 | 37 | SVD - CMSIS SVD Schema files and Conversion Utility. 38 | -------------------------------------------------------------------------------- /demos/non_os/stm32f10x/Libraries/CMSIS_EWARM/index.htm: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Redirect to the CMSIS main page after 0 seconds 5 | 6 | 7 | 8 | 9 | 10 | 11 | If the automatic redirection is failing, click open CMSIS Documentation. 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /demos/non_os/stm32f10x/Libraries/CMSIS_EWARM/readme_patch.txt: -------------------------------------------------------------------------------- 1 | No CMSIS patch is included in this version. 2 | -------------------------------------------------------------------------------- /demos/non_os/stm32f10x/Libraries/CMSIS_RVMDK/CM3/DeviceSupport/ST/STM32F10x/stm32f10x.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/CmBacktrace/4bec5c8a6c4ac65310174bf13ceb57830dd2d3f3/demos/non_os/stm32f10x/Libraries/CMSIS_RVMDK/CM3/DeviceSupport/ST/STM32F10x/stm32f10x.h -------------------------------------------------------------------------------- /demos/non_os/stm32f10x/Libraries/CMSIS_RVMDK/CM3/DeviceSupport/ST/STM32F10x/system_stm32f10x.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file system_stm32f10x.h 4 | * @author MCD Application Team 5 | * @version V3.5.0 6 | * @date 11-March-2011 7 | * @brief CMSIS Cortex-M3 Device Peripheral Access Layer System Header File. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 17 | * 18 | *

© COPYRIGHT 2011 STMicroelectronics

19 | ****************************************************************************** 20 | */ 21 | 22 | /** @addtogroup CMSIS 23 | * @{ 24 | */ 25 | 26 | /** @addtogroup stm32f10x_system 27 | * @{ 28 | */ 29 | 30 | /** 31 | * @brief Define to prevent recursive inclusion 32 | */ 33 | #ifndef __SYSTEM_STM32F10X_H 34 | #define __SYSTEM_STM32F10X_H 35 | 36 | #ifdef __cplusplus 37 | extern "C" { 38 | #endif 39 | 40 | /** @addtogroup STM32F10x_System_Includes 41 | * @{ 42 | */ 43 | 44 | /** 45 | * @} 46 | */ 47 | 48 | 49 | /** @addtogroup STM32F10x_System_Exported_types 50 | * @{ 51 | */ 52 | 53 | extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */ 54 | 55 | /** 56 | * @} 57 | */ 58 | 59 | /** @addtogroup STM32F10x_System_Exported_Constants 60 | * @{ 61 | */ 62 | 63 | /** 64 | * @} 65 | */ 66 | 67 | /** @addtogroup STM32F10x_System_Exported_Macros 68 | * @{ 69 | */ 70 | 71 | /** 72 | * @} 73 | */ 74 | 75 | /** @addtogroup STM32F10x_System_Exported_Functions 76 | * @{ 77 | */ 78 | 79 | extern void SystemInit(void); 80 | extern void SystemCoreClockUpdate(void); 81 | /** 82 | * @} 83 | */ 84 | 85 | #ifdef __cplusplus 86 | } 87 | #endif 88 | 89 | #endif /*__SYSTEM_STM32F10X_H */ 90 | 91 | /** 92 | * @} 93 | */ 94 | 95 | /** 96 | * @} 97 | */ 98 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 99 | -------------------------------------------------------------------------------- /demos/non_os/stm32f10x/Libraries/CMSIS_RVMDK/CMSIS debug support.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/CmBacktrace/4bec5c8a6c4ac65310174bf13ceb57830dd2d3f3/demos/non_os/stm32f10x/Libraries/CMSIS_RVMDK/CMSIS debug support.htm -------------------------------------------------------------------------------- /demos/non_os/stm32f10x/Libraries/CMSIS_RVMDK/Documentation/CMSIS_Core.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/CmBacktrace/4bec5c8a6c4ac65310174bf13ceb57830dd2d3f3/demos/non_os/stm32f10x/Libraries/CMSIS_RVMDK/Documentation/CMSIS_Core.htm -------------------------------------------------------------------------------- /demos/non_os/stm32f10x/Libraries/CMSIS_RVMDK/License.doc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/CmBacktrace/4bec5c8a6c4ac65310174bf13ceb57830dd2d3f3/demos/non_os/stm32f10x/Libraries/CMSIS_RVMDK/License.doc -------------------------------------------------------------------------------- /demos/non_os/stm32f10x/Libraries/SConscript: -------------------------------------------------------------------------------- 1 | import rtconfig 2 | Import('RTT_ROOT') 3 | from building import * 4 | 5 | # get current directory 6 | cwd = GetCurrentDir() 7 | 8 | # The set of source files associated with this SConscript file. 9 | src = Split(""" 10 | CMSIS/CM3/CoreSupport/core_cm3.c 11 | CMSIS/CM3/DeviceSupport/ST/STM32F10x/system_stm32f10x.c 12 | STM32F10x_StdPeriph_Driver/src/stm32f10x_crc.c 13 | STM32F10x_StdPeriph_Driver/src/stm32f10x_rcc.c 14 | STM32F10x_StdPeriph_Driver/src/stm32f10x_wwdg.c 15 | STM32F10x_StdPeriph_Driver/src/stm32f10x_pwr.c 16 | STM32F10x_StdPeriph_Driver/src/stm32f10x_exti.c 17 | STM32F10x_StdPeriph_Driver/src/stm32f10x_bkp.c 18 | STM32F10x_StdPeriph_Driver/src/stm32f10x_i2c.c 19 | STM32F10x_StdPeriph_Driver/src/stm32f10x_adc.c 20 | STM32F10x_StdPeriph_Driver/src/stm32f10x_dac.c 21 | STM32F10x_StdPeriph_Driver/src/stm32f10x_rtc.c 22 | STM32F10x_StdPeriph_Driver/src/stm32f10x_fsmc.c 23 | STM32F10x_StdPeriph_Driver/src/stm32f10x_tim.c 24 | STM32F10x_StdPeriph_Driver/src/stm32f10x_iwdg.c 25 | STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c 26 | STM32F10x_StdPeriph_Driver/src/stm32f10x_flash.c 27 | STM32F10x_StdPeriph_Driver/src/stm32f10x_sdio.c 28 | STM32F10x_StdPeriph_Driver/src/stm32f10x_gpio.c 29 | STM32F10x_StdPeriph_Driver/src/stm32f10x_usart.c 30 | STM32F10x_StdPeriph_Driver/src/stm32f10x_dbgmcu.c 31 | STM32F10x_StdPeriph_Driver/src/stm32f10x_dma.c 32 | STM32F10x_StdPeriph_Driver/src/stm32f10x_can.c 33 | STM32F10x_StdPeriph_Driver/src/stm32f10x_cec.c 34 | STM32F10x_StdPeriph_Driver/src/misc.c 35 | """) 36 | 37 | # starupt scripts for each STM32 kind 38 | startup_scripts = {} 39 | startup_scripts['STM32F10X_CL'] = 'startup_stm32f10x_cl.s' 40 | startup_scripts['STM32F10X_HD'] = 'startup_stm32f10x_hd.s' 41 | startup_scripts['STM32F10X_HD_VL'] = 'startup_stm32f10x_hd_vl.s' 42 | startup_scripts['STM32F10X_LD'] = 'startup_stm32f10x_ld.s' 43 | startup_scripts['STM32F10X_LD_VL'] = 'startup_stm32f10x_ld_vl.s' 44 | startup_scripts['STM32F10X_MD'] = 'startup_stm32f10x_md.s' 45 | startup_scripts['STM32F10X_MD_VL'] = 'startup_stm32f10x_md_vl.s' 46 | startup_scripts['STM32F10X_XL'] = 'startup_stm32f10x_xl.s' 47 | 48 | # add for startup script 49 | if rtconfig.CROSS_TOOL == 'gcc': 50 | src = src + ['CMSIS/CM3/DeviceSupport/ST/STM32F10x/startup/gcc_ride7/' + startup_scripts[rtconfig.STM32_TYPE]] 51 | elif rtconfig.CROSS_TOOL == 'keil': 52 | src = src + ['CMSIS/CM3/DeviceSupport/ST/STM32F10x/startup/arm/' + startup_scripts[rtconfig.STM32_TYPE]] 53 | elif rtconfig.CROSS_TOOL == 'iar': 54 | src = src + ['CMSIS/CM3/DeviceSupport/ST/STM32F10x/startup/iar/' + startup_scripts[rtconfig.STM32_TYPE]] 55 | 56 | path = [cwd + '/STM32F10x_StdPeriph_Driver/inc', 57 | cwd + '/CMSIS/CM3/CoreSupport', 58 | cwd + '/CMSIS/CM3/DeviceSupport/ST/STM32F10x'] 59 | 60 | CPPDEFINES = ['USE_STDPERIPH_DRIVER', rtconfig.STM32_TYPE] 61 | group = DefineGroup('STM32_StdPeriph', src, depend = [''], CPPPATH = path, CPPDEFINES = CPPDEFINES) 62 | 63 | Return('group') 64 | -------------------------------------------------------------------------------- /demos/non_os/stm32f10x/Libraries/STM32F10x_StdPeriph_Driver/inc/stm32f10x_crc.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_crc.h 4 | * @author MCD Application Team 5 | * @version V3.5.0 6 | * @date 11-March-2011 7 | * @brief This file contains all the functions prototypes for the CRC firmware 8 | * library. 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 13 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 14 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 15 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 16 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 17 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 18 | * 19 | *

© COPYRIGHT 2011 STMicroelectronics

20 | ****************************************************************************** 21 | */ 22 | 23 | /* Define to prevent recursive inclusion -------------------------------------*/ 24 | #ifndef __STM32F10x_CRC_H 25 | #define __STM32F10x_CRC_H 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | /* Includes ------------------------------------------------------------------*/ 32 | #include "stm32f10x.h" 33 | 34 | /** @addtogroup STM32F10x_StdPeriph_Driver 35 | * @{ 36 | */ 37 | 38 | /** @addtogroup CRC 39 | * @{ 40 | */ 41 | 42 | /** @defgroup CRC_Exported_Types 43 | * @{ 44 | */ 45 | 46 | /** 47 | * @} 48 | */ 49 | 50 | /** @defgroup CRC_Exported_Constants 51 | * @{ 52 | */ 53 | 54 | /** 55 | * @} 56 | */ 57 | 58 | /** @defgroup CRC_Exported_Macros 59 | * @{ 60 | */ 61 | 62 | /** 63 | * @} 64 | */ 65 | 66 | /** @defgroup CRC_Exported_Functions 67 | * @{ 68 | */ 69 | 70 | void CRC_ResetDR(void); 71 | uint32_t CRC_CalcCRC(uint32_t Data); 72 | uint32_t CRC_CalcBlockCRC(uint32_t pBuffer[], uint32_t BufferLength); 73 | uint32_t CRC_GetCRC(void); 74 | void CRC_SetIDRegister(uint8_t IDValue); 75 | uint8_t CRC_GetIDRegister(void); 76 | 77 | #ifdef __cplusplus 78 | } 79 | #endif 80 | 81 | #endif /* __STM32F10x_CRC_H */ 82 | /** 83 | * @} 84 | */ 85 | 86 | /** 87 | * @} 88 | */ 89 | 90 | /** 91 | * @} 92 | */ 93 | 94 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 95 | -------------------------------------------------------------------------------- /demos/non_os/stm32f10x/Libraries/STM32F10x_StdPeriph_Driver/src/stm32f10x_flash.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/CmBacktrace/4bec5c8a6c4ac65310174bf13ceb57830dd2d3f3/demos/non_os/stm32f10x/Libraries/STM32F10x_StdPeriph_Driver/src/stm32f10x_flash.c -------------------------------------------------------------------------------- /demos/non_os/stm32f10x/Libraries/STM32F10x_StdPeriph_Driver/src/stm32f10x_i2c.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/CmBacktrace/4bec5c8a6c4ac65310174bf13ceb57830dd2d3f3/demos/non_os/stm32f10x/Libraries/STM32F10x_StdPeriph_Driver/src/stm32f10x_i2c.c -------------------------------------------------------------------------------- /demos/non_os/stm32f10x/Libraries/STM32F10x_StdPeriph_Driver/src/stm32f10x_usart.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/CmBacktrace/4bec5c8a6c4ac65310174bf13ceb57830dd2d3f3/demos/non_os/stm32f10x/Libraries/STM32F10x_StdPeriph_Driver/src/stm32f10x_usart.c -------------------------------------------------------------------------------- /demos/non_os/stm32f10x/README.md: -------------------------------------------------------------------------------- 1 | # stm32f10x non-os Demo 2 | 3 | ## STEP 1 4 | 5 | 文件夹 `RVMDK` 下为 Keil 工程,`EMARM` 下为 IAR 工程。打开工程后,在 `app/src/app.c` 中有 `fault_test_by_unalign()` 及 `fault_test_by_div0()` 两个 HardFault 测试函数,可以选择性的执行测试函数。 6 | 7 | ## STEP 2 8 | 9 | 将程序下载至开发板,并将其串口1 与电脑串口连接。 10 | 11 | ## STEP 3 12 | 13 | 电脑上打开该串口,串口配置 115200 8 1 N ,给开发板上电,即可看到类似如下的输出信息,故障原因也已被准确的诊断出来: 14 | 15 | ``` 16 | Firmware name: CmBacktrace, hardware version: V1.0.0, software version: V0.1.0 17 | Fault on interrupt or bare metal(no OS) environment 18 | ====== Main stack information ====== 19 | addr: 20001140 data: 00000000 20 | addr: 20001144 data: e000ed14 21 | addr: 20001148 data: 0000000a 22 | addr: 2000114c data: 00000000 23 | addr: 20001150 data: a046ac2b 24 | addr: 20001154 data: 08000145 25 | addr: 20001158 data: e000ed14 26 | addr: 2000115c data: 08003143 27 | ==================================== 28 | =================== Registers information ==================== 29 | R0 : 00000000 R1 : 200012ec R2 : 00000000 R3 : 00000000 30 | R12: 00008080 LR : 08000145 PC : 08000a60 PSR: 61000000 31 | ============================================================== 32 | Usage fault is caused by Indicates a divide by zero has taken place (can be set only if DIV_0_TRP is set) 33 | Show more call stack info by run: addr2line -e CmBacktrace.out -a -f 08000a60 08000141 0800313f 34 | ``` 35 | 36 | ## STEP 4 37 | 38 | 打开电脑上的命令行工具,进入项目工程的可执行文件所在路径(Keil 一般在 `Output` 下,可执行文件后缀 `.axf`;IAR 一般在 ` Exe` 下,可执行文件后缀 `.out`),将 STEP 3 最后输出的 `addr2line -e CmBacktrace.out -a -f 08000a60 08000141 0800313f` 拷贝至控制台,并执行([点击查看 addr2line 工具的使用教程](https://github.com/armink/CmBacktrace/blob/master/docs/zh/how_to_use_addr2line_for_call_stack.md)),可看到类似如下,包含函数名称及代码行号的函数调用栈信息: 39 | 40 | ``` 41 | D:\Program\STM32\CmBacktrace\demo\non_os\stm32f10x\EWARM\stm32f103xE\Exe>addr2line -e CmBacktrace.out -a -f 08000a60 08000141 0800313f 42 | 0x08000a60 43 | fault_test_by_div0 44 | D:\Program\STM32\CmBacktrace\demo\non_os\stm32f10x\app\src/fault_test.c:38 45 | 0x08000141 46 | main 47 | D:\Program\STM32\CmBacktrace\demo\non_os\stm32f10x\app\src/app.c:20 48 | 0x0800313f 49 | _call_main 50 | ??:? 51 | 52 | D:\Program\STM32\CmBacktrace\demo\non_os\stm32f10x\EWARM\stm32f103xE\Exe> 53 | ``` 54 | -------------------------------------------------------------------------------- /demos/non_os/stm32f10x/RVMDK/.gitignore: -------------------------------------------------------------------------------- 1 | /Output 2 | *.uvgui.* 3 | 4 | -------------------------------------------------------------------------------- /demos/non_os/stm32f10x/RVMDK/JLink Regs CM3.txt: -------------------------------------------------------------------------------- 1 | 0: R0: 0x00 2 | 1: R1: 0x01 3 | 2: R2: 0x02 4 | 3: R3: 0x03 5 | 4: R4: 0x04 6 | 5: R5: 0x05 7 | 6: R6: 0x06 8 | 7: R7: 0x07 9 | 8: R8: 0x08 10 | 9: R9: 0x09 11 | 10: R10: 0x0a 12 | 11: R11: 0x0b 13 | 12: R12: 0x0c 14 | 13: R13: 0x0d 15 | 14: R14: 0x0e 16 | 15: R15: 0x0f 17 | 16: XPSR: 0x10 18 | 17: MSP: 0x11 19 | 18: PSP: 0x12 20 | 19: RAZ: 0x13 21 | 20: CFBP: 0x14 22 | 21: APSR: 0x15 23 | 22: EPSR: 0x16 24 | 23: IPSR: 0x17 25 | 24: PRIMASK: 0x18 26 | 25: BASEPRI: 0x19 27 | 26: FAULTMASK: 0x1a 28 | 27: CONTROL: 0x1b 29 | 28: BASEPRI_MAX: 0x1c 30 | 29: IAPSR: 0x1d 31 | 30: EAPSR: 0x1e 32 | 31: IEPSR: 0x1f 33 | -------------------------------------------------------------------------------- /demos/non_os/stm32f10x/RVMDK/JLinkSettings.ini: -------------------------------------------------------------------------------- 1 | [FLASH] 2 | SkipProgOnCRCMatch = 1 3 | VerifyDownload = 1 4 | AllowCaching = 1 5 | EnableFlashDL = 2 6 | Override = 0 7 | Device="ADUC7020X62" 8 | [BREAKPOINTS] 9 | ShowInfoWin = 1 10 | EnableFlashBP = 2 11 | BPDuringExecution = 0 12 | [CPU] 13 | OverrideMemMap = 0 14 | AllowSimulation = 1 15 | ScriptFile="" 16 | [SWO] 17 | SWOLogFile="" 18 | -------------------------------------------------------------------------------- /demos/non_os/stm32f10x/app/inc/stm32f10x_it.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file Project/Template/stm32f10x_it.h 4 | * @author MCD Application Team 5 | * @version V3.1.0 6 | * @date 06/19/2009 7 | * @brief This file contains the headers of the interrupt handlers. 8 | ****************************************************************************** 9 | * @copy 10 | * 11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 17 | * 18 | *

© COPYRIGHT 2009 STMicroelectronics

19 | */ 20 | 21 | /* Define to prevent recursive inclusion -------------------------------------*/ 22 | #ifndef __STM32F10x_IT_H 23 | #define __STM32F10x_IT_H 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | /* Includes ------------------------------------------------------------------*/ 30 | 31 | #include "bsp.h" 32 | 33 | /* Exported types ------------------------------------------------------------*/ 34 | /* Exported constants --------------------------------------------------------*/ 35 | /* Exported macro ------------------------------------------------------------*/ 36 | /* Exported functions ------------------------------------------------------- */ 37 | 38 | void NMI_Handler(void); 39 | void HardFault_Handler(void); 40 | void MemManage_Handler(void); 41 | void BusFault_Handler(void); 42 | void UsageFault_Handler(void); 43 | void SVC_Handler(void); 44 | void DebugMon_Handler(void); 45 | void PendSV_Handler(void); 46 | void SysTick_Handler(void); 47 | 48 | #ifdef __cplusplus 49 | } 50 | #endif 51 | 52 | #endif /* __STM32F10x_IT_H */ 53 | 54 | /******************* (C) COPYRIGHT 2009 STMicroelectronics *****END OF FILE****/ 55 | -------------------------------------------------------------------------------- /demos/non_os/stm32f10x/app/src/app.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #define HARDWARE_VERSION "V1.0.0" 6 | #define SOFTWARE_VERSION "V0.1.0" 7 | 8 | extern void fault_test_by_unalign(void); 9 | extern void fault_test_by_div0(void); 10 | 11 | int main(void){ 12 | uint8_t _continue; 13 | 14 | BSP_Init(); 15 | 16 | /* CmBacktrace initialize */ 17 | cm_backtrace_init("CmBacktrace", HARDWARE_VERSION, SOFTWARE_VERSION); 18 | 19 | // fault_test_by_unalign(); 20 | fault_test_by_div0(); 21 | 22 | _continue = 1; 23 | while(_continue == 1) { 24 | LED_RUN_ON; 25 | delay(1000000); 26 | LED_RUN_OFF; 27 | delay(1000000); 28 | } 29 | 30 | return 0; 31 | } 32 | -------------------------------------------------------------------------------- /demos/non_os/stm32f10x/app/src/fault_test.c: -------------------------------------------------------------------------------- 1 | /* 2 | * fault_test.c 3 | * 4 | * Created on: 2016/12/25 5 | * Author: Armink 6 | */ 7 | 8 | #include 9 | 10 | void fault_test_by_unalign(void) { 11 | volatile int * SCB_CCR = (volatile int *) 0xE000ED14; // SCB->CCR 12 | volatile int * p; 13 | volatile int value; 14 | 15 | *SCB_CCR |= (1 << 3); /* bit3: UNALIGN_TRP. */ 16 | 17 | p = (int *) 0x00; 18 | value = *p; 19 | printf("addr:0x%02X value:0x%08X\r\n", (int) p, value); 20 | 21 | p = (int *) 0x04; 22 | value = *p; 23 | printf("addr:0x%02X value:0x%08X\r\n", (int) p, value); 24 | 25 | p = (int *) 0x03; 26 | value = *p; 27 | printf("addr:0x%02X value:0x%08X\r\n", (int) p, value); 28 | } 29 | 30 | void fault_test_by_div0(void) { 31 | volatile int * SCB_CCR = (volatile int *) 0xE000ED14; // SCB->CCR 32 | int x, y, z; 33 | 34 | *SCB_CCR |= (1 << 4); /* bit4: DIV_0_TRP. */ 35 | 36 | x = 10; 37 | y = 0; 38 | z = x / y; 39 | printf("z:%d\n", z); 40 | } 41 | -------------------------------------------------------------------------------- /demos/non_os/stm32f10x/components/cm_backtrace/cmb_cfg.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the CmBacktrace Library. 3 | * 4 | * Copyright (c) 2016, Armink, 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining 7 | * a copy of this software and associated documentation files (the 8 | * 'Software'), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, 10 | * distribute, sublicense, and/or sell copies of the Software, and to 11 | * permit persons to whom the Software is furnished to do so, subject to 12 | * the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 20 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 21 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 22 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 23 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | * 25 | * Function: It is the configure head file for this library. 26 | * Created on: 2016-12-15 27 | */ 28 | 29 | #ifndef _CMB_CFG_H_ 30 | #define _CMB_CFG_H_ 31 | 32 | /* print line, must config by user */ 33 | #define cmb_println(...) printf(__VA_ARGS__);printf("\r\n") 34 | /* enable bare metal(no OS) platform */ 35 | #define CMB_USING_BARE_METAL_PLATFORM 36 | /* cpu platform type, must config by user */ 37 | #define CMB_CPU_PLATFORM_TYPE CMB_CPU_ARM_CORTEX_M3 38 | /* enable dump stack information */ 39 | #define CMB_USING_DUMP_STACK_INFO 40 | /* language of print information */ 41 | #define CMB_PRINT_LANGUAGE CMB_PRINT_LANGUAGE_ENGLISH 42 | #endif /* _CMB_CFG_H_ */ 43 | -------------------------------------------------------------------------------- /demos/non_os/stm32f10x/components/others/bsp.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/CmBacktrace/4bec5c8a6c4ac65310174bf13ceb57830dd2d3f3/demos/non_os/stm32f10x/components/others/bsp.c -------------------------------------------------------------------------------- /demos/non_os/stm32f10x/components/others/stm32f103xB.icf: -------------------------------------------------------------------------------- 1 | /*###ICF### Section handled by ICF editor, don't touch! ****/ 2 | /*-Editor annotation file-*/ 3 | /* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */ 4 | /*-Specials-*/ 5 | define symbol __ICFEDIT_intvec_start__ = 0x08000000; 6 | /* software version and hardware version store start address */ 7 | define symbol __ICFEDIT_version_start__ = __ICFEDIT_intvec_start__ + 512; 8 | /*-Memory Regions-*/ 9 | define symbol __ICFEDIT_region_ROM_start__ = __ICFEDIT_intvec_start__; 10 | define symbol __ICFEDIT_region_ROM_end__ = 0x0801FFFF; 11 | define symbol __ICFEDIT_region_RAM_start__ = 0x20000000; 12 | define symbol __ICFEDIT_region_RAM_end__ = 0x20004FFF; 13 | /*-Sizes-*/ 14 | define symbol __ICFEDIT_size_cstack__ = 0x800; 15 | define symbol __ICFEDIT_size_heap__ = 0x800; 16 | 17 | /**** End of ICF editor section. ###ICF###*/ 18 | 19 | define memory mem with size = 4G; 20 | define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__]; 21 | define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__]; 22 | 23 | define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { }; 24 | define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { }; 25 | 26 | initialize by copy { readwrite }; 27 | do not initialize { section .noinit }; 28 | 29 | place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec }; 30 | 31 | place in ROM_region { readonly }; 32 | place in RAM_region { readwrite, 33 | block CSTACK, block HEAP }; 34 | 35 | /* armink add for version storage */ 36 | keep { section .version }; 37 | place at address mem:__ICFEDIT_version_start__ { readonly section .version }; 38 | 39 | /* armink add for rtt finsh */ 40 | keep { section FSymTab }; 41 | keep { section VSymTab }; -------------------------------------------------------------------------------- /demos/non_os/stm32f10x/components/others/stm32f103xE.icf: -------------------------------------------------------------------------------- 1 | /*###ICF### Section handled by ICF editor, don't touch! ****/ 2 | /*-Editor annotation file-*/ 3 | /* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */ 4 | /*-Specials-*/ 5 | define symbol __ICFEDIT_intvec_start__ = 0x08000000; 6 | /* software version and hardware version store start address */ 7 | define symbol __ICFEDIT_version_start__ = __ICFEDIT_intvec_start__ + 512; 8 | /*-Memory Regions-*/ 9 | define symbol __ICFEDIT_region_ROM_start__ = __ICFEDIT_intvec_start__; 10 | define symbol __ICFEDIT_region_ROM_end__ = 0x0807FFFF; 11 | define symbol __ICFEDIT_region_RAM_start__ = 0x20000000; 12 | define symbol __ICFEDIT_region_RAM_end__ = 0x2000FFFF; 13 | /*-Sizes-*/ 14 | define symbol __ICFEDIT_size_cstack__ = 0x1000; 15 | define symbol __ICFEDIT_size_heap__ = 0x1000; 16 | 17 | /**** End of ICF editor section. ###ICF###*/ 18 | 19 | define memory mem with size = 4G; 20 | define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__]; 21 | define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__]; 22 | 23 | define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { }; 24 | define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { }; 25 | 26 | initialize by copy { readwrite }; 27 | do not initialize { section .noinit }; 28 | 29 | place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec }; 30 | 31 | place in ROM_region { readonly }; 32 | place in RAM_region { readwrite, 33 | block CSTACK, block HEAP }; 34 | 35 | /* armink add for version storage */ 36 | keep { section .version }; 37 | place at address mem:__ICFEDIT_version_start__ { readonly section .version }; 38 | 39 | /* armink add for rtt finsh */ 40 | keep { section FSymTab }; 41 | keep { section VSymTab }; -------------------------------------------------------------------------------- /demos/non_os/stm32f10x/components/others/types.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef TYPES_H_ 3 | #define TYPES_H_ 4 | 5 | #include 6 | #include 7 | typedef int bool_t; /**< boolean type */ 8 | 9 | #ifndef TRUE 10 | #define TRUE 1 11 | #endif 12 | 13 | #ifndef FALSE 14 | #define FALSE 0 15 | #endif 16 | 17 | #ifndef NULL 18 | #define NULL 0 19 | #endif 20 | 21 | #define success 0 22 | #define fail 1 23 | 24 | 25 | #ifndef disable 26 | #define disable 0 27 | #endif 28 | 29 | #ifndef enable 30 | #define enable 1 31 | #endif 32 | 33 | #endif /* TYPES_H_ */ 34 | -------------------------------------------------------------------------------- /demos/os/freertos/stm32f10x/EWARM/.gitignore: -------------------------------------------------------------------------------- 1 | /stm32f103xB 2 | /stm32f103xE 3 | /Debug 4 | /Release 5 | /settings/*.dbgdt 6 | /settings/*.dni 7 | /settings/*.bat 8 | /settings/*.xcl 9 | /settings/*.wsdt 10 | /settings/*.jlink 11 | *.dep 12 | *.ewd 13 | -------------------------------------------------------------------------------- /demos/os/freertos/stm32f10x/EWARM/CmBacktrace.eww: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | $WS_DIR$\CmBacktrace.ewp 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /demos/os/freertos/stm32f10x/EWARM/settings/CmBacktrace.crun: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1 5 | 6 | 7 | * 8 | * 9 | * 10 | 0 11 | 1 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /demos/os/freertos/stm32f10x/EWARM/settings/CmBacktrace.wspos: -------------------------------------------------------------------------------- 1 | [MainWindow] 2 | WindowPlacement=_ 210 137 1470 874 3 3 | -------------------------------------------------------------------------------- /demos/os/freertos/stm32f10x/FreeRTOS/include/stdint.readme: -------------------------------------------------------------------------------- 1 | 2 | #ifndef FREERTOS_STDINT 3 | #define FREERTOS_STDINT 4 | 5 | /******************************************************************************* 6 | * THIS IS NOT A FULL stdint.h IMPLEMENTATION - It only contains the definitions 7 | * necessary to build the FreeRTOS code. It is provided to allow FreeRTOS to be 8 | * built using compilers that do not provide their own stdint.h definition. 9 | * 10 | * To use this file: 11 | * 12 | * 1) Copy this file into the directory that contains your FreeRTOSConfig.h 13 | * header file, as that directory will already be in the compilers include 14 | * path. 15 | * 16 | * 2) Rename the copied file stdint.h. 17 | * 18 | */ 19 | 20 | typedef signed char int8_t; 21 | typedef unsigned char uint8_t; 22 | typedef short int16_t; 23 | typedef unsigned short uint16_t; 24 | typedef long int32_t; 25 | typedef unsigned long uint32_t; 26 | 27 | #endif /* FREERTOS_STDINT */ 28 | -------------------------------------------------------------------------------- /demos/os/freertos/stm32f10x/FreeRTOS/portable/Keil/See-also-the-RVDS-directory.txt: -------------------------------------------------------------------------------- 1 | Nothing to see here. -------------------------------------------------------------------------------- /demos/os/freertos/stm32f10x/FreeRTOS/portable/MemMang/ReadMe.url: -------------------------------------------------------------------------------- 1 | [{000214A0-0000-0000-C000-000000000046}] 2 | Prop3=19,2 3 | [InternetShortcut] 4 | URL=http://www.freertos.org/a00111.html 5 | IDList= 6 | -------------------------------------------------------------------------------- /demos/os/freertos/stm32f10x/FreeRTOS/portable/readme.txt: -------------------------------------------------------------------------------- 1 | Each real time kernel port consists of three files that contain the core kernel 2 | components and are common to every port, and one or more files that are 3 | specific to a particular microcontroller and/or compiler. 4 | 5 | 6 | + The FreeRTOS/Source/Portable/MemMang directory contains the five sample 7 | memory allocators as described on the http://www.FreeRTOS.org WEB site. 8 | 9 | + The other directories each contain files specific to a particular 10 | microcontroller or compiler, where the directory name denotes the compiler 11 | specific files the directory contains. 12 | 13 | 14 | 15 | For example, if you are interested in the [compiler] port for the [architecture] 16 | microcontroller, then the port specific files are contained in 17 | FreeRTOS/Source/Portable/[compiler]/[architecture] directory. If this is the 18 | only port you are interested in then all the other directories can be 19 | ignored. 20 | 21 | -------------------------------------------------------------------------------- /demos/os/freertos/stm32f10x/FreeRTOS/readme.txt: -------------------------------------------------------------------------------- 1 | Each real time kernel port consists of three files that contain the core kernel 2 | components and are common to every port, and one or more files that are 3 | specific to a particular microcontroller and or compiler. 4 | 5 | + The FreeRTOS/Source directory contains the three files that are common to 6 | every port - list.c, queue.c and tasks.c. The kernel is contained within these 7 | three files. croutine.c implements the optional co-routine functionality - which 8 | is normally only used on very memory limited systems. 9 | 10 | + The FreeRTOS/Source/Portable directory contains the files that are specific to 11 | a particular microcontroller and or compiler. 12 | 13 | + The FreeRTOS/Source/include directory contains the real time kernel header 14 | files. 15 | 16 | See the readme file in the FreeRTOS/Source/Portable directory for more 17 | information. -------------------------------------------------------------------------------- /demos/os/freertos/stm32f10x/Libraries/CMSIS_EWARM/CM3/DeviceSupport/ST/STM32F10x/stm32f10x.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/CmBacktrace/4bec5c8a6c4ac65310174bf13ceb57830dd2d3f3/demos/os/freertos/stm32f10x/Libraries/CMSIS_EWARM/CM3/DeviceSupport/ST/STM32F10x/stm32f10x.h -------------------------------------------------------------------------------- /demos/os/freertos/stm32f10x/Libraries/CMSIS_EWARM/CM3/DeviceSupport/ST/STM32F10x/system_stm32f10x.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file system_stm32f10x.h 4 | * @author MCD Application Team 5 | * @version V3.5.0 6 | * @date 11-March-2011 7 | * @brief CMSIS Cortex-M3 Device Peripheral Access Layer System Header File. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 17 | * 18 | *

© COPYRIGHT 2011 STMicroelectronics

19 | ****************************************************************************** 20 | */ 21 | 22 | /** @addtogroup CMSIS 23 | * @{ 24 | */ 25 | 26 | /** @addtogroup stm32f10x_system 27 | * @{ 28 | */ 29 | 30 | /** 31 | * @brief Define to prevent recursive inclusion 32 | */ 33 | #ifndef __SYSTEM_STM32F10X_H 34 | #define __SYSTEM_STM32F10X_H 35 | 36 | #ifdef __cplusplus 37 | extern "C" { 38 | #endif 39 | 40 | /** @addtogroup STM32F10x_System_Includes 41 | * @{ 42 | */ 43 | 44 | /** 45 | * @} 46 | */ 47 | 48 | 49 | /** @addtogroup STM32F10x_System_Exported_types 50 | * @{ 51 | */ 52 | 53 | extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */ 54 | 55 | /** 56 | * @} 57 | */ 58 | 59 | /** @addtogroup STM32F10x_System_Exported_Constants 60 | * @{ 61 | */ 62 | 63 | /** 64 | * @} 65 | */ 66 | 67 | /** @addtogroup STM32F10x_System_Exported_Macros 68 | * @{ 69 | */ 70 | 71 | /** 72 | * @} 73 | */ 74 | 75 | /** @addtogroup STM32F10x_System_Exported_Functions 76 | * @{ 77 | */ 78 | 79 | extern void SystemInit(void); 80 | extern void SystemCoreClockUpdate(void); 81 | /** 82 | * @} 83 | */ 84 | 85 | #ifdef __cplusplus 86 | } 87 | #endif 88 | 89 | #endif /*__SYSTEM_STM32F10X_H */ 90 | 91 | /** 92 | * @} 93 | */ 94 | 95 | /** 96 | * @} 97 | */ 98 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 99 | -------------------------------------------------------------------------------- /demos/os/freertos/stm32f10x/Libraries/CMSIS_EWARM/CMSIS END USER LICENCE AGREEMENT.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/CmBacktrace/4bec5c8a6c4ac65310174bf13ceb57830dd2d3f3/demos/os/freertos/stm32f10x/Libraries/CMSIS_EWARM/CMSIS END USER LICENCE AGREEMENT.pdf -------------------------------------------------------------------------------- /demos/os/freertos/stm32f10x/Libraries/CMSIS_EWARM/CMSIS debug support.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/CmBacktrace/4bec5c8a6c4ac65310174bf13ceb57830dd2d3f3/demos/os/freertos/stm32f10x/Libraries/CMSIS_EWARM/CMSIS debug support.htm -------------------------------------------------------------------------------- /demos/os/freertos/stm32f10x/Libraries/CMSIS_EWARM/Documentation/CMSIS_Core.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/CmBacktrace/4bec5c8a6c4ac65310174bf13ceb57830dd2d3f3/demos/os/freertos/stm32f10x/Libraries/CMSIS_EWARM/Documentation/CMSIS_Core.htm -------------------------------------------------------------------------------- /demos/os/freertos/stm32f10x/Libraries/CMSIS_EWARM/Include/arm_common_tables.h: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Copyright (C) 2010 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 11. November 2010 5 | * $Revision: V1.0.2 6 | * 7 | * Project: CMSIS DSP Library 8 | * Title: arm_common_tables.h 9 | * 10 | * Description: This file has extern declaration for common tables like Bitreverse, reciprocal etc which are used across different functions 11 | * 12 | * Target Processor: Cortex-M4/Cortex-M3 13 | * 14 | * Version 1.0.2 2010/11/11 15 | * Documentation updated. 16 | * 17 | * Version 1.0.1 2010/10/05 18 | * Production release and review comments incorporated. 19 | * 20 | * Version 1.0.0 2010/09/20 21 | * Production release and review comments incorporated. 22 | * -------------------------------------------------------------------- */ 23 | 24 | #ifndef _ARM_COMMON_TABLES_H 25 | #define _ARM_COMMON_TABLES_H 26 | 27 | #include "arm_math.h" 28 | 29 | extern const uint16_t armBitRevTable[1024]; 30 | extern const q15_t armRecipTableQ15[64]; 31 | extern const q31_t armRecipTableQ31[64]; 32 | extern const q31_t realCoefAQ31[1024]; 33 | extern const q31_t realCoefBQ31[1024]; 34 | extern const float32_t twiddleCoef[6144]; 35 | extern const q31_t twiddleCoefQ31[6144]; 36 | extern const q15_t twiddleCoefQ15[6144]; 37 | 38 | #endif /* ARM_COMMON_TABLES_H */ 39 | -------------------------------------------------------------------------------- /demos/os/freertos/stm32f10x/Libraries/CMSIS_EWARM/License.doc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/CmBacktrace/4bec5c8a6c4ac65310174bf13ceb57830dd2d3f3/demos/os/freertos/stm32f10x/Libraries/CMSIS_EWARM/License.doc -------------------------------------------------------------------------------- /demos/os/freertos/stm32f10x/Libraries/CMSIS_EWARM/README.txt: -------------------------------------------------------------------------------- 1 | * ------------------------------------------------------------------- 2 | * Copyright (C) 2011-2012 ARM Limited. All rights reserved. 3 | * 4 | * Date: 07 March 2012 5 | * Revision: V3.01 6 | * 7 | * Project: Cortex Microcontroller Software Interface Standard (CMSIS) 8 | * Title: Release Note for CMSIS 9 | * 10 | * ------------------------------------------------------------------- 11 | 12 | 13 | NOTE - Open the index.html file to access CMSIS documentation 14 | 15 | 16 | The Cortex Microcontroller Software Interface Standard (CMSIS) provides a single standard across all 17 | Cortex-Mx processor series vendors. It enables code re-use and code sharing across software projects 18 | and reduces time-to-market for new embedded applications. 19 | 20 | CMSIS is released under the terms of the end user license agreement ("CMSIS END USER LICENCE AGREEMENT.pdf"). 21 | Any user of the software package is bound to the terms and conditions of the end user license agreement. 22 | 23 | 24 | You will find the following sub-directories: 25 | 26 | Documentation - Contains CMSIS documentation. 27 | 28 | DSP_Lib - MDK project files, Examples and source files etc.. to build the 29 | CMSIS DSP Software Library for Cortex-M0, Cortex-M3, Cortex-M4 processors. 30 | 31 | Include - CMSIS Core Support and CMSIS DSP Include Files. 32 | 33 | Lib - CMSIS DSP Libraries. 34 | 35 | RTOS - CMSIS RTOS API template header file. 36 | 37 | SVD - CMSIS SVD Schema files and Conversion Utility. 38 | -------------------------------------------------------------------------------- /demos/os/freertos/stm32f10x/Libraries/CMSIS_EWARM/index.htm: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Redirect to the CMSIS main page after 0 seconds 5 | 6 | 7 | 8 | 9 | 10 | 11 | If the automatic redirection is failing, click open CMSIS Documentation. 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /demos/os/freertos/stm32f10x/Libraries/CMSIS_EWARM/readme_patch.txt: -------------------------------------------------------------------------------- 1 | No CMSIS patch is included in this version. 2 | -------------------------------------------------------------------------------- /demos/os/freertos/stm32f10x/Libraries/CMSIS_RVMDK/CM3/DeviceSupport/ST/STM32F10x/stm32f10x.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/CmBacktrace/4bec5c8a6c4ac65310174bf13ceb57830dd2d3f3/demos/os/freertos/stm32f10x/Libraries/CMSIS_RVMDK/CM3/DeviceSupport/ST/STM32F10x/stm32f10x.h -------------------------------------------------------------------------------- /demos/os/freertos/stm32f10x/Libraries/CMSIS_RVMDK/CM3/DeviceSupport/ST/STM32F10x/system_stm32f10x.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file system_stm32f10x.h 4 | * @author MCD Application Team 5 | * @version V3.5.0 6 | * @date 11-March-2011 7 | * @brief CMSIS Cortex-M3 Device Peripheral Access Layer System Header File. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 17 | * 18 | *

© COPYRIGHT 2011 STMicroelectronics

19 | ****************************************************************************** 20 | */ 21 | 22 | /** @addtogroup CMSIS 23 | * @{ 24 | */ 25 | 26 | /** @addtogroup stm32f10x_system 27 | * @{ 28 | */ 29 | 30 | /** 31 | * @brief Define to prevent recursive inclusion 32 | */ 33 | #ifndef __SYSTEM_STM32F10X_H 34 | #define __SYSTEM_STM32F10X_H 35 | 36 | #ifdef __cplusplus 37 | extern "C" { 38 | #endif 39 | 40 | /** @addtogroup STM32F10x_System_Includes 41 | * @{ 42 | */ 43 | 44 | /** 45 | * @} 46 | */ 47 | 48 | 49 | /** @addtogroup STM32F10x_System_Exported_types 50 | * @{ 51 | */ 52 | 53 | extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */ 54 | 55 | /** 56 | * @} 57 | */ 58 | 59 | /** @addtogroup STM32F10x_System_Exported_Constants 60 | * @{ 61 | */ 62 | 63 | /** 64 | * @} 65 | */ 66 | 67 | /** @addtogroup STM32F10x_System_Exported_Macros 68 | * @{ 69 | */ 70 | 71 | /** 72 | * @} 73 | */ 74 | 75 | /** @addtogroup STM32F10x_System_Exported_Functions 76 | * @{ 77 | */ 78 | 79 | extern void SystemInit(void); 80 | extern void SystemCoreClockUpdate(void); 81 | /** 82 | * @} 83 | */ 84 | 85 | #ifdef __cplusplus 86 | } 87 | #endif 88 | 89 | #endif /*__SYSTEM_STM32F10X_H */ 90 | 91 | /** 92 | * @} 93 | */ 94 | 95 | /** 96 | * @} 97 | */ 98 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 99 | -------------------------------------------------------------------------------- /demos/os/freertos/stm32f10x/Libraries/CMSIS_RVMDK/CMSIS debug support.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/CmBacktrace/4bec5c8a6c4ac65310174bf13ceb57830dd2d3f3/demos/os/freertos/stm32f10x/Libraries/CMSIS_RVMDK/CMSIS debug support.htm -------------------------------------------------------------------------------- /demos/os/freertos/stm32f10x/Libraries/CMSIS_RVMDK/Documentation/CMSIS_Core.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/CmBacktrace/4bec5c8a6c4ac65310174bf13ceb57830dd2d3f3/demos/os/freertos/stm32f10x/Libraries/CMSIS_RVMDK/Documentation/CMSIS_Core.htm -------------------------------------------------------------------------------- /demos/os/freertos/stm32f10x/Libraries/CMSIS_RVMDK/License.doc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/CmBacktrace/4bec5c8a6c4ac65310174bf13ceb57830dd2d3f3/demos/os/freertos/stm32f10x/Libraries/CMSIS_RVMDK/License.doc -------------------------------------------------------------------------------- /demos/os/freertos/stm32f10x/Libraries/SConscript: -------------------------------------------------------------------------------- 1 | import rtconfig 2 | Import('RTT_ROOT') 3 | from building import * 4 | 5 | # get current directory 6 | cwd = GetCurrentDir() 7 | 8 | # The set of source files associated with this SConscript file. 9 | src = Split(""" 10 | CMSIS/CM3/CoreSupport/core_cm3.c 11 | CMSIS/CM3/DeviceSupport/ST/STM32F10x/system_stm32f10x.c 12 | STM32F10x_StdPeriph_Driver/src/stm32f10x_crc.c 13 | STM32F10x_StdPeriph_Driver/src/stm32f10x_rcc.c 14 | STM32F10x_StdPeriph_Driver/src/stm32f10x_wwdg.c 15 | STM32F10x_StdPeriph_Driver/src/stm32f10x_pwr.c 16 | STM32F10x_StdPeriph_Driver/src/stm32f10x_exti.c 17 | STM32F10x_StdPeriph_Driver/src/stm32f10x_bkp.c 18 | STM32F10x_StdPeriph_Driver/src/stm32f10x_i2c.c 19 | STM32F10x_StdPeriph_Driver/src/stm32f10x_adc.c 20 | STM32F10x_StdPeriph_Driver/src/stm32f10x_dac.c 21 | STM32F10x_StdPeriph_Driver/src/stm32f10x_rtc.c 22 | STM32F10x_StdPeriph_Driver/src/stm32f10x_fsmc.c 23 | STM32F10x_StdPeriph_Driver/src/stm32f10x_tim.c 24 | STM32F10x_StdPeriph_Driver/src/stm32f10x_iwdg.c 25 | STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c 26 | STM32F10x_StdPeriph_Driver/src/stm32f10x_flash.c 27 | STM32F10x_StdPeriph_Driver/src/stm32f10x_sdio.c 28 | STM32F10x_StdPeriph_Driver/src/stm32f10x_gpio.c 29 | STM32F10x_StdPeriph_Driver/src/stm32f10x_usart.c 30 | STM32F10x_StdPeriph_Driver/src/stm32f10x_dbgmcu.c 31 | STM32F10x_StdPeriph_Driver/src/stm32f10x_dma.c 32 | STM32F10x_StdPeriph_Driver/src/stm32f10x_can.c 33 | STM32F10x_StdPeriph_Driver/src/stm32f10x_cec.c 34 | STM32F10x_StdPeriph_Driver/src/misc.c 35 | """) 36 | 37 | # starupt scripts for each STM32 kind 38 | startup_scripts = {} 39 | startup_scripts['STM32F10X_CL'] = 'startup_stm32f10x_cl.s' 40 | startup_scripts['STM32F10X_HD'] = 'startup_stm32f10x_hd.s' 41 | startup_scripts['STM32F10X_HD_VL'] = 'startup_stm32f10x_hd_vl.s' 42 | startup_scripts['STM32F10X_LD'] = 'startup_stm32f10x_ld.s' 43 | startup_scripts['STM32F10X_LD_VL'] = 'startup_stm32f10x_ld_vl.s' 44 | startup_scripts['STM32F10X_MD'] = 'startup_stm32f10x_md.s' 45 | startup_scripts['STM32F10X_MD_VL'] = 'startup_stm32f10x_md_vl.s' 46 | startup_scripts['STM32F10X_XL'] = 'startup_stm32f10x_xl.s' 47 | 48 | # add for startup script 49 | if rtconfig.CROSS_TOOL == 'gcc': 50 | src = src + ['CMSIS/CM3/DeviceSupport/ST/STM32F10x/startup/gcc_ride7/' + startup_scripts[rtconfig.STM32_TYPE]] 51 | elif rtconfig.CROSS_TOOL == 'keil': 52 | src = src + ['CMSIS/CM3/DeviceSupport/ST/STM32F10x/startup/arm/' + startup_scripts[rtconfig.STM32_TYPE]] 53 | elif rtconfig.CROSS_TOOL == 'iar': 54 | src = src + ['CMSIS/CM3/DeviceSupport/ST/STM32F10x/startup/iar/' + startup_scripts[rtconfig.STM32_TYPE]] 55 | 56 | path = [cwd + '/STM32F10x_StdPeriph_Driver/inc', 57 | cwd + '/CMSIS/CM3/CoreSupport', 58 | cwd + '/CMSIS/CM3/DeviceSupport/ST/STM32F10x'] 59 | 60 | CPPDEFINES = ['USE_STDPERIPH_DRIVER', rtconfig.STM32_TYPE] 61 | group = DefineGroup('STM32_StdPeriph', src, depend = [''], CPPPATH = path, CPPDEFINES = CPPDEFINES) 62 | 63 | Return('group') 64 | -------------------------------------------------------------------------------- /demos/os/freertos/stm32f10x/Libraries/STM32F10x_StdPeriph_Driver/inc/stm32f10x_crc.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_crc.h 4 | * @author MCD Application Team 5 | * @version V3.5.0 6 | * @date 11-March-2011 7 | * @brief This file contains all the functions prototypes for the CRC firmware 8 | * library. 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 13 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 14 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 15 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 16 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 17 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 18 | * 19 | *

© COPYRIGHT 2011 STMicroelectronics

20 | ****************************************************************************** 21 | */ 22 | 23 | /* Define to prevent recursive inclusion -------------------------------------*/ 24 | #ifndef __STM32F10x_CRC_H 25 | #define __STM32F10x_CRC_H 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | /* Includes ------------------------------------------------------------------*/ 32 | #include "stm32f10x.h" 33 | 34 | /** @addtogroup STM32F10x_StdPeriph_Driver 35 | * @{ 36 | */ 37 | 38 | /** @addtogroup CRC 39 | * @{ 40 | */ 41 | 42 | /** @defgroup CRC_Exported_Types 43 | * @{ 44 | */ 45 | 46 | /** 47 | * @} 48 | */ 49 | 50 | /** @defgroup CRC_Exported_Constants 51 | * @{ 52 | */ 53 | 54 | /** 55 | * @} 56 | */ 57 | 58 | /** @defgroup CRC_Exported_Macros 59 | * @{ 60 | */ 61 | 62 | /** 63 | * @} 64 | */ 65 | 66 | /** @defgroup CRC_Exported_Functions 67 | * @{ 68 | */ 69 | 70 | void CRC_ResetDR(void); 71 | uint32_t CRC_CalcCRC(uint32_t Data); 72 | uint32_t CRC_CalcBlockCRC(uint32_t pBuffer[], uint32_t BufferLength); 73 | uint32_t CRC_GetCRC(void); 74 | void CRC_SetIDRegister(uint8_t IDValue); 75 | uint8_t CRC_GetIDRegister(void); 76 | 77 | #ifdef __cplusplus 78 | } 79 | #endif 80 | 81 | #endif /* __STM32F10x_CRC_H */ 82 | /** 83 | * @} 84 | */ 85 | 86 | /** 87 | * @} 88 | */ 89 | 90 | /** 91 | * @} 92 | */ 93 | 94 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 95 | -------------------------------------------------------------------------------- /demos/os/freertos/stm32f10x/Libraries/STM32F10x_StdPeriph_Driver/src/stm32f10x_flash.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/CmBacktrace/4bec5c8a6c4ac65310174bf13ceb57830dd2d3f3/demos/os/freertos/stm32f10x/Libraries/STM32F10x_StdPeriph_Driver/src/stm32f10x_flash.c -------------------------------------------------------------------------------- /demos/os/freertos/stm32f10x/Libraries/STM32F10x_StdPeriph_Driver/src/stm32f10x_i2c.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/CmBacktrace/4bec5c8a6c4ac65310174bf13ceb57830dd2d3f3/demos/os/freertos/stm32f10x/Libraries/STM32F10x_StdPeriph_Driver/src/stm32f10x_i2c.c -------------------------------------------------------------------------------- /demos/os/freertos/stm32f10x/Libraries/STM32F10x_StdPeriph_Driver/src/stm32f10x_usart.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/CmBacktrace/4bec5c8a6c4ac65310174bf13ceb57830dd2d3f3/demos/os/freertos/stm32f10x/Libraries/STM32F10x_StdPeriph_Driver/src/stm32f10x_usart.c -------------------------------------------------------------------------------- /demos/os/freertos/stm32f10x/README.md: -------------------------------------------------------------------------------- 1 | # stm32f10x FreeRTOS Demo 2 | 3 | ## STEP 1 4 | 5 | 文件夹 `RVMDK` 下为 Keil 工程,`EMARM` 下为 IAR 工程。打开工程后,在 `app/src/app.c` 中有 `fault_test_by_unalign()` 及 `fault_test_by_div0()` 两个 HardFault 测试函数,可以选择性的执行测试函数。 6 | 7 | ## STEP 2 8 | 9 | 将程序下载至开发板,并将其串口1 与电脑串口连接。 10 | 11 | ## STEP 3 12 | 13 | 电脑上打开该串口,串口配置 115200 8 1 N ,给开发板上电,即可看到类似如下的输出信息,故障原因也已被准确的诊断出来: 14 | 15 | ``` 16 | Firmware name: CmBacktrace, hardware version: V1.0.0, software version: V0.1.0 17 | Fault on thread app_start 18 | ===== Thread stack information ===== 19 | addr: 200011f0 data: a5a5a5a5 20 | addr: 200011f4 data: 00000000 21 | addr: 200011f8 data: a5a5a5a5 22 | addr: 200011fc data: a5a5a5a5 23 | addr: 20001200 data: a5a5a5a5 24 | addr: 20001204 data: 08000171 25 | addr: 20001208 data: a5a5a5a5 26 | addr: 2000120c data: 080026ed 27 | addr: 20001210 data: a5a5a5a5 28 | addr: 20001214 data: a5a5a5a5 29 | ==================================== 30 | =================== Registers information ==================== 31 | R0 : 00000000 R1 : a5a5a5a5 R2 : a5a5a5a5 R3 : a5a5a5a5 32 | R12: a5a5a5a5 LR : 08000171 PC : 08001788 PSR: 41000000 33 | ============================================================== 34 | Usage fault is caused by Indicates a divide by zero has taken place (can be set only if DIV_0_TRP is set) 35 | Show more call stack info by run: addr2line -e CmBacktrace.out -a -f 08001788 0800016d 080026e9 36 | ``` 37 | 38 | ## STEP 4 39 | 40 | 打开电脑上的命令行工具,进入项目工程的可执行文件所在路径(Keil 一般在 `Output` 下,可执行文件后缀 `.axf`;IAR 一般在 ` Exe` 下,可执行文件后缀 `.out`),将 STEP 3 最后输出的 `addr2line -e CmBacktrace.out -a -f 08001788 0800016d 080026e9` 拷贝至控制台,并执行([点击查看 addr2line 工具的使用教程](https://github.com/armink/CmBacktrace/blob/master/docs/zh/how_to_use_addr2line_for_call_stack.md)),可看到类似如下,包含函数名称及代码行号的函数调用栈信息: 41 | 42 | ``` 43 | D:\Program\STM32\CmBacktrace\demos\os\freertos\stm32f10x\EWARM\stm32f103xE\Exe>addr2line -e CmBacktrace.out -a -f 08001788 0800016d 080026e9 44 | 0x08001788 45 | fault_test_by_div0 46 | D:\Program\STM32\CmBacktrace\demos\os\freertos\stm32f10x\app\src/fault_test.c:38 47 | 0x0800016d 48 | AppTaskStart 49 | D:\Program\STM32\CmBacktrace\demos\os\freertos\stm32f10x\app\src/app.c:33 50 | 0x080026e9 51 | pxPortInitialiseStack 52 | D:\Program\STM32\CmBacktrace\demos\os\freertos\stm32f10x\FreeRTOS\portable\IAR\ARM_CM3/port.c:224 53 | 54 | D:\Program\STM32\CmBacktrace\demos\os\freertos\stm32f10x\EWARM\stm32f103xE\Exe> 55 | ``` 56 | 57 | ## FreeRTOS 源码修改说明 58 | 59 | 因为 FreeRTOS 的 TCB 中没有 StackSize 信息,所以修改了其源码(基于 V9.0.0),在 `FreeRTOS/tasks.c` 中增加了 `uxSizeOfStack` 字段, 以及 `vTaskStackAddr()` 、 `vTaskStackSize()` 、 `vTaskName()` 函数。 60 | -------------------------------------------------------------------------------- /demos/os/freertos/stm32f10x/RVMDK/.gitignore: -------------------------------------------------------------------------------- 1 | /Output 2 | *.uvgui.* 3 | 4 | -------------------------------------------------------------------------------- /demos/os/freertos/stm32f10x/RVMDK/JLink Regs CM3.txt: -------------------------------------------------------------------------------- 1 | 0: R0: 0x00 2 | 1: R1: 0x01 3 | 2: R2: 0x02 4 | 3: R3: 0x03 5 | 4: R4: 0x04 6 | 5: R5: 0x05 7 | 6: R6: 0x06 8 | 7: R7: 0x07 9 | 8: R8: 0x08 10 | 9: R9: 0x09 11 | 10: R10: 0x0a 12 | 11: R11: 0x0b 13 | 12: R12: 0x0c 14 | 13: R13: 0x0d 15 | 14: R14: 0x0e 16 | 15: R15: 0x0f 17 | 16: XPSR: 0x10 18 | 17: MSP: 0x11 19 | 18: PSP: 0x12 20 | 19: RAZ: 0x13 21 | 20: CFBP: 0x14 22 | 21: APSR: 0x15 23 | 22: EPSR: 0x16 24 | 23: IPSR: 0x17 25 | 24: PRIMASK: 0x18 26 | 25: BASEPRI: 0x19 27 | 26: FAULTMASK: 0x1a 28 | 27: CONTROL: 0x1b 29 | 28: BASEPRI_MAX: 0x1c 30 | 29: IAPSR: 0x1d 31 | 30: EAPSR: 0x1e 32 | 31: IEPSR: 0x1f 33 | -------------------------------------------------------------------------------- /demos/os/freertos/stm32f10x/RVMDK/JLinkSettings.ini: -------------------------------------------------------------------------------- 1 | [FLASH] 2 | SkipProgOnCRCMatch = 1 3 | VerifyDownload = 1 4 | AllowCaching = 1 5 | EnableFlashDL = 2 6 | Override = 0 7 | Device="ADUC7020X62" 8 | [BREAKPOINTS] 9 | ShowInfoWin = 1 10 | EnableFlashBP = 2 11 | BPDuringExecution = 0 12 | [CPU] 13 | OverrideMemMap = 0 14 | AllowSimulation = 1 15 | ScriptFile="" 16 | [SWO] 17 | SWOLogFile="" 18 | -------------------------------------------------------------------------------- /demos/os/freertos/stm32f10x/app/inc/os_cfg.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/CmBacktrace/4bec5c8a6c4ac65310174bf13ceb57830dd2d3f3/demos/os/freertos/stm32f10x/app/inc/os_cfg.h -------------------------------------------------------------------------------- /demos/os/freertos/stm32f10x/app/inc/stm32f10x_it.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file Project/Template/stm32f10x_it.h 4 | * @author MCD Application Team 5 | * @version V3.1.0 6 | * @date 06/19/2009 7 | * @brief This file contains the headers of the interrupt handlers. 8 | ****************************************************************************** 9 | * @copy 10 | * 11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 17 | * 18 | *

© COPYRIGHT 2009 STMicroelectronics

19 | */ 20 | 21 | /* Define to prevent recursive inclusion -------------------------------------*/ 22 | #ifndef __STM32F10x_IT_H 23 | #define __STM32F10x_IT_H 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | /* Includes ------------------------------------------------------------------*/ 30 | 31 | #include "bsp.h" 32 | 33 | /* Exported types ------------------------------------------------------------*/ 34 | /* Exported constants --------------------------------------------------------*/ 35 | /* Exported macro ------------------------------------------------------------*/ 36 | /* Exported functions ------------------------------------------------------- */ 37 | 38 | void NMI_Handler(void); 39 | void HardFault_Handler(void); 40 | void MemManage_Handler(void); 41 | void BusFault_Handler(void); 42 | void UsageFault_Handler(void); 43 | void SVC_Handler(void); 44 | void DebugMon_Handler(void); 45 | void PendSV_Handler(void); 46 | void SysTick_Handler(void); 47 | 48 | #ifdef __cplusplus 49 | } 50 | #endif 51 | 52 | #endif /* __STM32F10x_IT_H */ 53 | 54 | /******************* (C) COPYRIGHT 2009 STMicroelectronics *****END OF FILE****/ 55 | -------------------------------------------------------------------------------- /demos/os/freertos/stm32f10x/app/src/app.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | #define HARDWARE_VERSION "V1.0.0" 8 | #define SOFTWARE_VERSION "V0.1.0" 9 | 10 | static void AppTaskStart(void *p_arg); 11 | extern void fault_test_by_unalign(void); 12 | extern void fault_test_by_div0(void); 13 | 14 | int main(void) 15 | { 16 | 17 | BSP_Init(); 18 | /* CmBacktrace initialize */ 19 | cm_backtrace_init("CmBacktrace", HARDWARE_VERSION, SOFTWARE_VERSION); 20 | 21 | xTaskCreate( AppTaskStart, "app_start", 40, NULL, tskIDLE_PRIORITY+2, NULL ); 22 | 23 | printf("System initialize finish. Starting..\r\n"); 24 | 25 | vTaskStartScheduler(); 26 | 27 | return (1); 28 | } 29 | 30 | static void AppTaskStart (void *p_arg) 31 | { 32 | // fault_test_by_unalign(); 33 | fault_test_by_div0(); 34 | 35 | while (1) { 36 | LED_RUN_ON; 37 | vTaskDelay(500/portTICK_RATE_MS); 38 | LED_RUN_OFF; 39 | vTaskDelay(500/portTICK_RATE_MS); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /demos/os/freertos/stm32f10x/app/src/fault_test.c: -------------------------------------------------------------------------------- 1 | /* 2 | * fault_test.c 3 | * 4 | * Created on: 2016/12/25 5 | * Author: Armink 6 | */ 7 | 8 | #include 9 | 10 | void fault_test_by_unalign(void) { 11 | volatile int * SCB_CCR = (volatile int *) 0xE000ED14; // SCB->CCR 12 | volatile int * p; 13 | volatile int value; 14 | 15 | *SCB_CCR |= (1 << 3); /* bit3: UNALIGN_TRP. */ 16 | 17 | p = (int *) 0x00; 18 | value = *p; 19 | printf("addr:0x%02X value:0x%08X\r\n", (int) p, value); 20 | 21 | p = (int *) 0x04; 22 | value = *p; 23 | printf("addr:0x%02X value:0x%08X\r\n", (int) p, value); 24 | 25 | p = (int *) 0x03; 26 | value = *p; 27 | printf("addr:0x%02X value:0x%08X\r\n", (int) p, value); 28 | } 29 | 30 | void fault_test_by_div0(void) { 31 | volatile int * SCB_CCR = (volatile int *) 0xE000ED14; // SCB->CCR 32 | int x, y, z; 33 | 34 | *SCB_CCR |= (1 << 4); /* bit4: DIV_0_TRP. */ 35 | 36 | x = 10; 37 | y = 0; 38 | z = x / y; 39 | printf("z:%d\n", z); 40 | } 41 | -------------------------------------------------------------------------------- /demos/os/freertos/stm32f10x/components/cm_backtrace/cmb_cfg.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the CmBacktrace Library. 3 | * 4 | * Copyright (c) 2016, Armink, 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining 7 | * a copy of this software and associated documentation files (the 8 | * 'Software'), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, 10 | * distribute, sublicense, and/or sell copies of the Software, and to 11 | * permit persons to whom the Software is furnished to do so, subject to 12 | * the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 20 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 21 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 22 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 23 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | * 25 | * Function: It is the configure head file for this library. 26 | * Created on: 2016-12-15 27 | */ 28 | 29 | #ifndef _CMB_CFG_H_ 30 | #define _CMB_CFG_H_ 31 | 32 | /* print line, must config by user */ 33 | #define cmb_println(...) printf(__VA_ARGS__);printf("\r\n") 34 | /* enable OS platform */ 35 | #define CMB_USING_OS_PLATFORM 36 | /* OS platform type, must config when CMB_USING_OS_PLATFORM is enable */ 37 | #define CMB_OS_PLATFORM_TYPE CMB_OS_PLATFORM_FREERTOS 38 | /* cpu platform type, must config by user */ 39 | #define CMB_CPU_PLATFORM_TYPE CMB_CPU_ARM_CORTEX_M3 40 | /* enable dump stack information */ 41 | #define CMB_USING_DUMP_STACK_INFO 42 | /* language of print information */ 43 | #define CMB_PRINT_LANGUAGE CMB_PRINT_LANGUAGE_ENGLISH 44 | #endif /* _CMB_CFG_H_ */ 45 | -------------------------------------------------------------------------------- /demos/os/freertos/stm32f10x/components/others/bsp.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/CmBacktrace/4bec5c8a6c4ac65310174bf13ceb57830dd2d3f3/demos/os/freertos/stm32f10x/components/others/bsp.c -------------------------------------------------------------------------------- /demos/os/freertos/stm32f10x/components/others/stm32f103xB.icf: -------------------------------------------------------------------------------- 1 | /*###ICF### Section handled by ICF editor, don't touch! ****/ 2 | /*-Editor annotation file-*/ 3 | /* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */ 4 | /*-Specials-*/ 5 | define symbol __ICFEDIT_intvec_start__ = 0x08000000; 6 | /* software version and hardware version store start address */ 7 | define symbol __ICFEDIT_version_start__ = __ICFEDIT_intvec_start__ + 512; 8 | /*-Memory Regions-*/ 9 | define symbol __ICFEDIT_region_ROM_start__ = __ICFEDIT_intvec_start__; 10 | define symbol __ICFEDIT_region_ROM_end__ = 0x0801FFFF; 11 | define symbol __ICFEDIT_region_RAM_start__ = 0x20000000; 12 | define symbol __ICFEDIT_region_RAM_end__ = 0x20004FFF; 13 | /*-Sizes-*/ 14 | define symbol __ICFEDIT_size_cstack__ = 0x800; 15 | define symbol __ICFEDIT_size_heap__ = 0x800; 16 | 17 | /**** End of ICF editor section. ###ICF###*/ 18 | 19 | define memory mem with size = 4G; 20 | define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__]; 21 | define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__]; 22 | 23 | define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { }; 24 | define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { }; 25 | 26 | initialize by copy { readwrite }; 27 | do not initialize { section .noinit }; 28 | 29 | place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec }; 30 | 31 | place in ROM_region { readonly }; 32 | place in RAM_region { readwrite, 33 | block CSTACK, block HEAP }; 34 | 35 | /* armink add for version storage */ 36 | keep { section .version }; 37 | place at address mem:__ICFEDIT_version_start__ { readonly section .version }; 38 | 39 | /* armink add for rtt finsh */ 40 | keep { section FSymTab }; 41 | keep { section VSymTab }; -------------------------------------------------------------------------------- /demos/os/freertos/stm32f10x/components/others/stm32f103xE.icf: -------------------------------------------------------------------------------- 1 | /*###ICF### Section handled by ICF editor, don't touch! ****/ 2 | /*-Editor annotation file-*/ 3 | /* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */ 4 | /*-Specials-*/ 5 | define symbol __ICFEDIT_intvec_start__ = 0x08000000; 6 | /* software version and hardware version store start address */ 7 | define symbol __ICFEDIT_version_start__ = __ICFEDIT_intvec_start__ + 512; 8 | /*-Memory Regions-*/ 9 | define symbol __ICFEDIT_region_ROM_start__ = __ICFEDIT_intvec_start__; 10 | define symbol __ICFEDIT_region_ROM_end__ = 0x0807FFFF; 11 | define symbol __ICFEDIT_region_RAM_start__ = 0x20000000; 12 | define symbol __ICFEDIT_region_RAM_end__ = 0x2000FFFF; 13 | /*-Sizes-*/ 14 | define symbol __ICFEDIT_size_cstack__ = 0x1000; 15 | define symbol __ICFEDIT_size_heap__ = 0x1000; 16 | 17 | /**** End of ICF editor section. ###ICF###*/ 18 | 19 | define memory mem with size = 4G; 20 | define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__]; 21 | define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__]; 22 | 23 | define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { }; 24 | define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { }; 25 | 26 | initialize by copy { readwrite }; 27 | do not initialize { section .noinit }; 28 | 29 | place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec }; 30 | 31 | place in ROM_region { readonly }; 32 | place in RAM_region { readwrite, 33 | block CSTACK, block HEAP }; 34 | 35 | /* armink add for version storage */ 36 | keep { section .version }; 37 | place at address mem:__ICFEDIT_version_start__ { readonly section .version }; 38 | 39 | /* armink add for rtt finsh */ 40 | keep { section FSymTab }; 41 | keep { section VSymTab }; -------------------------------------------------------------------------------- /demos/os/freertos/stm32f10x/components/others/types.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef TYPES_H_ 3 | #define TYPES_H_ 4 | 5 | #include 6 | #include 7 | typedef int bool_t; /**< boolean type */ 8 | 9 | #ifndef TRUE 10 | #define TRUE 1 11 | #endif 12 | 13 | #ifndef FALSE 14 | #define FALSE 0 15 | #endif 16 | 17 | #ifndef NULL 18 | #define NULL 0 19 | #endif 20 | 21 | #define success 0 22 | #define fail 1 23 | 24 | 25 | #ifndef disable 26 | #define disable 0 27 | #endif 28 | 29 | #ifndef enable 30 | #define enable 1 31 | #endif 32 | 33 | #endif /* TYPES_H_ */ 34 | -------------------------------------------------------------------------------- /demos/os/rtthread/stm32f4xx/EWARM/.gitignore: -------------------------------------------------------------------------------- 1 | /STM32F405RG 2 | /Debug 3 | /Release 4 | /settings/*.dbgdt 5 | /settings/*.dni 6 | /settings/*.bat 7 | /settings/*.xcl 8 | /settings/*.wsdt 9 | /settings/*.jlink 10 | *.dep 11 | *.ewd 12 | -------------------------------------------------------------------------------- /demos/os/rtthread/stm32f4xx/EWARM/CmBacktrace.eww: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | $WS_DIR$\CmBacktrace.ewp 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /demos/os/rtthread/stm32f4xx/EWARM/settings/CmBacktrace.crun: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1 5 | 6 | 7 | * 8 | * 9 | * 10 | 0 11 | 1 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /demos/os/rtthread/stm32f4xx/EWARM/settings/CmBacktrace.wspos: -------------------------------------------------------------------------------- 1 | [MainWindow] 2 | WindowPlacement=_ 210 137 1470 874 3 3 | -------------------------------------------------------------------------------- /demos/os/rtthread/stm32f4xx/Libraries/CMSIS/CMSIS_END_USER_LICENCE_AGREEMENT.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/CmBacktrace/4bec5c8a6c4ac65310174bf13ceb57830dd2d3f3/demos/os/rtthread/stm32f4xx/Libraries/CMSIS/CMSIS_END_USER_LICENCE_AGREEMENT.pdf -------------------------------------------------------------------------------- /demos/os/rtthread/stm32f4xx/Libraries/CMSIS/Device/ST/STM32F4xx/Include/stm32f4xx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/CmBacktrace/4bec5c8a6c4ac65310174bf13ceb57830dd2d3f3/demos/os/rtthread/stm32f4xx/Libraries/CMSIS/Device/ST/STM32F4xx/Include/stm32f4xx.h -------------------------------------------------------------------------------- /demos/os/rtthread/stm32f4xx/Libraries/CMSIS/Device/ST/STM32F4xx/Include/system_stm32f4xx.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file system_stm32f4xx.h 4 | * @author MCD Application Team 5 | * @version V1.5.0 6 | * @date 06-March-2015 7 | * @brief CMSIS Cortex-M4 Device System Source File for STM32F4xx devices. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2015 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /** @addtogroup CMSIS 29 | * @{ 30 | */ 31 | 32 | /** @addtogroup stm32f4xx_system 33 | * @{ 34 | */ 35 | 36 | /** 37 | * @brief Define to prevent recursive inclusion 38 | */ 39 | #ifndef __SYSTEM_STM32F4XX_H 40 | #define __SYSTEM_STM32F4XX_H 41 | 42 | #ifdef __cplusplus 43 | extern "C" { 44 | #endif 45 | 46 | /** @addtogroup STM32F4xx_System_Includes 47 | * @{ 48 | */ 49 | 50 | /** 51 | * @} 52 | */ 53 | 54 | 55 | /** @addtogroup STM32F4xx_System_Exported_types 56 | * @{ 57 | */ 58 | 59 | extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */ 60 | 61 | 62 | /** 63 | * @} 64 | */ 65 | 66 | /** @addtogroup STM32F4xx_System_Exported_Constants 67 | * @{ 68 | */ 69 | 70 | /** 71 | * @} 72 | */ 73 | 74 | /** @addtogroup STM32F4xx_System_Exported_Macros 75 | * @{ 76 | */ 77 | 78 | /** 79 | * @} 80 | */ 81 | 82 | /** @addtogroup STM32F4xx_System_Exported_Functions 83 | * @{ 84 | */ 85 | 86 | extern void SystemInit(void); 87 | extern void SystemCoreClockUpdate(void); 88 | /** 89 | * @} 90 | */ 91 | 92 | #ifdef __cplusplus 93 | } 94 | #endif 95 | 96 | #endif /*__SYSTEM_STM32F4XX_H */ 97 | 98 | /** 99 | * @} 100 | */ 101 | 102 | /** 103 | * @} 104 | */ 105 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 106 | -------------------------------------------------------------------------------- /demos/os/rtthread/stm32f4xx/Libraries/CMSIS/Device/ST/STM32F4xx/Source/Templates/system_stm32f4xx.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/CmBacktrace/4bec5c8a6c4ac65310174bf13ceb57830dd2d3f3/demos/os/rtthread/stm32f4xx/Libraries/CMSIS/Device/ST/STM32F4xx/Source/Templates/system_stm32f4xx.c -------------------------------------------------------------------------------- /demos/os/rtthread/stm32f4xx/Libraries/CMSIS/README.txt: -------------------------------------------------------------------------------- 1 | * ------------------------------------------------------------------- 2 | * Copyright (C) 2011-2014 ARM Limited. All rights reserved. 3 | * 4 | * Date: 17 February 2014 5 | * Revision: V4.00 6 | * 7 | * Project: Cortex Microcontroller Software Interface Standard (CMSIS) 8 | * Title: Release Note for CMSIS 9 | * 10 | * ------------------------------------------------------------------- 11 | 12 | 13 | NOTE - Open the index.html file to access CMSIS documentation 14 | 15 | 16 | The Cortex Microcontroller Software Interface Standard (CMSIS) provides a single standard across all 17 | Cortex-Mx processor series vendors. It enables code re-use and code sharing across software projects 18 | and reduces time-to-market for new embedded applications. 19 | 20 | CMSIS is released under the terms of the end user license agreement ("CMSIS_END_USER_LICENCE_AGREEMENT.pdf"). 21 | Any user of the software package is bound to the terms and conditions of the end user license agreement. 22 | 23 | 24 | You will find the following sub-directories: 25 | 26 | Documentation - Contains CMSIS documentation. 27 | 28 | DSP_Lib - MDK project files, Examples and source files etc.. to build the 29 | CMSIS DSP Software Library for Cortex-M0, Cortex-M3, Cortex-M4 processors. 30 | 31 | Include - CMSIS Core Support and CMSIS DSP Include Files. 32 | 33 | Lib - CMSIS DSP Libraries. 34 | 35 | RTOS - CMSIS RTOS API template header file. 36 | 37 | Driver - CMSIS Peripheral Driver Interface. 38 | 39 | Pack - CMSIS Software Packs. 40 | Mechanism to install software, device support, APIs, and example projects. 41 | 42 | SVD - CMSIS SVD Schema files and Conversion Utility. 43 | -------------------------------------------------------------------------------- /demos/os/rtthread/stm32f4xx/Libraries/CMSIS/index.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Redirect to the CMSIS main page after 0 seconds 5 | 6 | 7 | 8 | 9 | 10 | 11 | If the automatic redirection is failing, click open CMSIS Documentation. 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /demos/os/rtthread/stm32f4xx/Libraries/STM32F4xx_StdPeriph_Driver/Release_Notes.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/CmBacktrace/4bec5c8a6c4ac65310174bf13ceb57830dd2d3f3/demos/os/rtthread/stm32f4xx/Libraries/STM32F4xx_StdPeriph_Driver/Release_Notes.html -------------------------------------------------------------------------------- /demos/os/rtthread/stm32f4xx/Libraries/STM32F4xx_StdPeriph_Driver/inc/stm32f4xx_crc.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f4xx_crc.h 4 | * @author MCD Application Team 5 | * @version V1.5.0 6 | * @date 06-March-2015 7 | * @brief This file contains all the functions prototypes for the CRC firmware 8 | * library. 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | *

© COPYRIGHT 2015 STMicroelectronics

13 | * 14 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 15 | * You may not use this file except in compliance with the License. 16 | * You may obtain a copy of the License at: 17 | * 18 | * http://www.st.com/software_license_agreement_liberty_v2 19 | * 20 | * Unless required by applicable law or agreed to in writing, software 21 | * distributed under the License is distributed on an "AS IS" BASIS, 22 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 23 | * See the License for the specific language governing permissions and 24 | * limitations under the License. 25 | * 26 | ****************************************************************************** 27 | */ 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __STM32F4xx_CRC_H 31 | #define __STM32F4xx_CRC_H 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | /* Includes ------------------------------------------------------------------*/ 38 | #include "stm32f4xx.h" 39 | 40 | /** @addtogroup STM32F4xx_StdPeriph_Driver 41 | * @{ 42 | */ 43 | 44 | /** @addtogroup CRC 45 | * @{ 46 | */ 47 | 48 | /* Exported types ------------------------------------------------------------*/ 49 | /* Exported constants --------------------------------------------------------*/ 50 | 51 | /** @defgroup CRC_Exported_Constants 52 | * @{ 53 | */ 54 | 55 | /** 56 | * @} 57 | */ 58 | 59 | /* Exported macro ------------------------------------------------------------*/ 60 | /* Exported functions --------------------------------------------------------*/ 61 | 62 | void CRC_ResetDR(void); 63 | uint32_t CRC_CalcCRC(uint32_t Data); 64 | uint32_t CRC_CalcBlockCRC(uint32_t pBuffer[], uint32_t BufferLength); 65 | uint32_t CRC_GetCRC(void); 66 | void CRC_SetIDRegister(uint8_t IDValue); 67 | uint8_t CRC_GetIDRegister(void); 68 | 69 | #ifdef __cplusplus 70 | } 71 | #endif 72 | 73 | #endif /* __STM32F4xx_CRC_H */ 74 | 75 | /** 76 | * @} 77 | */ 78 | 79 | /** 80 | * @} 81 | */ 82 | 83 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 84 | -------------------------------------------------------------------------------- /demos/os/rtthread/stm32f4xx/Libraries/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_qspi.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/CmBacktrace/4bec5c8a6c4ac65310174bf13ceb57830dd2d3f3/demos/os/rtthread/stm32f4xx/Libraries/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_qspi.c -------------------------------------------------------------------------------- /demos/os/rtthread/stm32f4xx/README.md: -------------------------------------------------------------------------------- 1 | # stm32f4xx RT-Thread Demo 2 | 3 | ## STEP 1 4 | 5 | 文件夹 `RVMDK` 下为 Keil 工程,`EMARM` 下为 IAR 工程。打开工程后,在 `app/src/app_task.c` 中有 `fault_test_by_unalign()` 及 `fault_test_by_div0()` 两个 HardFault 测试函数,可以选择性的执行测试函数。 6 | 7 | ## STEP 2 8 | 9 | 将程序下载至开发板,并将其串口 1 与电脑串口连接。 10 | 11 | ## STEP 3 12 | 13 | 电脑上打开该串口,串口配置 115200 8 1 N ,给开发板上电,即可看到类似如下的输出信息,故障原因也已被准确的诊断出来: 14 | 15 | ``` 16 | Firmware name: CmBacktrace, hardware version: V1.0.0, software version: V0.1.0 17 | Fault on thread sys_monitor 18 | ===== Thread stack information ===== 19 | addr: 10002d58 data: 00000000 20 | addr: 10002d5c data: 00000000 21 | addr: 10002d60 data: deadbeef 22 | addr: 10002d64 data: deadbeef 23 | addr: 10002d68 data: deadbeef 24 | addr: 10002d6c data: 08000191 25 | addr: 10002d70 data: deadbeef 26 | addr: 10002d74 data: 080009e5 27 | ==================================== 28 | =================== Registers information ==================== 29 | R0 : 00000000 R1 : 00000000 R2 : 00000000 R3 : 00000000 30 | R12: 00000000 LR : 08000191 PC : 0800035c PSR: 41000000 31 | ============================================================== 32 | Usage fault is caused by Indicates a divide by zero has taken place (can be set only if DIV_0_TRP is set) 33 | Show more call stack info by run: addr2line -e CmBacktrace.out -a -f 0800035c 0800018d 080009e1 34 | ``` 35 | 36 | ## STEP 4 37 | 38 | 打开电脑上的命令行工具,进入项目工程的可执行文件所在路径(Keil 一般在 `Output` 下,可执行文件后缀 `.axf`;IAR 一般在 ` Exe` 下,可执行文件后缀 `.out`),将 STEP 3 最后输出的 `addr2line -e CmBacktrace.out -a -f 0800035c 0800018d 080009e1` 拷贝至控制台,并执行([点击查看 addr2line 工具的使用教程](https://github.com/armink/CmBacktrace/blob/master/docs/zh/how_to_use_addr2line_for_call_stack.md)),可看到类似如下,包含函数名称及代码行号的函数调用栈信息: 39 | 40 | ``` 41 | D:\Program\STM32\CmBacktrace\demos\os\rtthread\stm32f4xx\EWARM\STM32F405RG\Exe>addr2line -e CmBacktrace.out -a -f 0800035c 0800018d 080009e1 42 | 0x0800035c 43 | fault_test_by_div0 44 | D:\Program\STM32\CmBacktrace\demos\os\rtthread\stm32f4xx\app\src/fault_test.c:38 45 | 0x0800018d 46 | thread_entry_sys_monitor 47 | D:\Program\STM32\CmBacktrace\demos\os\rtthread\stm32f4xx\app\src/app_task.c:36 48 | 0x080009e1 49 | rt_list_remove 50 | D:\Program\STM32\CmBacktrace\demos\os\rtthread\stm32f4xx\RT-Thread-1.2.2\include/rtservice.h:95 51 | 52 | D:\Program\STM32\CmBacktrace\demos\os\rtthread\stm32f4xx\EWARM\STM32F405RG\Exe> 53 | ``` 54 | -------------------------------------------------------------------------------- /demos/os/rtthread/stm32f4xx/RT-Thread-1.2.2/AUTHORS: -------------------------------------------------------------------------------- 1 | Kernel Design & Implementation 2 | - Bernard Xiong 3 | 4 | LwIP 1.3.0/1.3.1/1.3.2/1.4.0 5 | - Porting 6 | Qiu Yi 7 | Mbbill 8 | - Testing 9 | Bernard Xiong 10 | 11 | Filesystem 12 | - Porting and Add Virtual Filesystem 13 | - Testing 14 | Qiu Yi 15 | prife 16 | 17 | RTGUI 18 | - Design and Implemenation 19 | Bernard Xiong 20 | Grissiom 21 | 22 | BSP 23 | Bernard Xiong 24 | - ATMEL AT91SAM7S64 & AT91SAM7X256 Porting 25 | - STM32 Porting 26 | - S3C4510 Porting 27 | 28 | Mbbill 29 | - ATMEL AT91SAM7X256 30 | 31 | Xulong Cao 32 | - QEMU/x86 33 | 34 | Aozima 35 | - LPC 2148 Porting 36 | - STM32 Porting 37 | 38 | Jing Lee 39 | - LPC 2478 Porting 40 | 41 | Qiu Yi 42 | - S3C2410 & S3C2440 Porting 43 | - TI LM3S 44 | 45 | others... 46 | -------------------------------------------------------------------------------- /demos/os/rtthread/stm32f4xx/RT-Thread-1.2.2/components/SConscript: -------------------------------------------------------------------------------- 1 | # for module compiling 2 | import os 3 | Import('remove_components') 4 | from building import * 5 | 6 | objs = [] 7 | cwd = GetCurrentDir() 8 | list = os.listdir(cwd) 9 | 10 | for item in list: 11 | if item in remove_components: 12 | continue 13 | 14 | if os.path.isfile(os.path.join(cwd, item, 'SConscript')): 15 | objs = objs + SConscript(os.path.join(item, 'SConscript')) 16 | 17 | Return('objs') 18 | -------------------------------------------------------------------------------- /demos/os/rtthread/stm32f4xx/RT-Thread-1.2.2/components/drivers/SConscript: -------------------------------------------------------------------------------- 1 | # for module compiling 2 | import os 3 | from building import * 4 | 5 | cwd = GetCurrentDir() 6 | objs = [] 7 | list = os.listdir(cwd) 8 | 9 | for d in list: 10 | path = os.path.join(cwd, d) 11 | if os.path.isfile(os.path.join(path, 'SConscript')): 12 | objs = objs + SConscript(os.path.join(d, 'SConscript')) 13 | 14 | Return('objs') 15 | -------------------------------------------------------------------------------- /demos/os/rtthread/stm32f4xx/RT-Thread-1.2.2/components/drivers/include/drivers/i2c-bit-ops.h: -------------------------------------------------------------------------------- 1 | /* 2 | * File : i2c-bit-ops.h 3 | * This file is part of RT-Thread RTOS 4 | * COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License along 17 | * with this program; if not, write to the Free Software Foundation, Inc., 18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 | * 20 | * Change Logs: 21 | * Date Author Notes 22 | * 2012-04-25 weety first version 23 | */ 24 | 25 | #ifndef __I2C_BIT_OPS_H__ 26 | #define __I2C_BIT_OPS_H__ 27 | 28 | #ifdef __cplusplus 29 | extern "C" { 30 | #endif 31 | 32 | struct rt_i2c_bit_ops 33 | { 34 | void *data; /* private data for lowlevel routines */ 35 | void (*set_sda)(void *data, rt_int32_t state); 36 | void (*set_scl)(void *data, rt_int32_t state); 37 | rt_int32_t (*get_sda)(void *data); 38 | rt_int32_t (*get_scl)(void *data); 39 | 40 | void (*udelay)(rt_uint32_t us); 41 | 42 | rt_uint32_t delay_us; /* scl and sda line delay */ 43 | rt_uint32_t timeout; /* in tick */ 44 | }; 45 | 46 | rt_err_t rt_i2c_bit_add_bus(struct rt_i2c_bus_device *bus, 47 | const char *bus_name); 48 | 49 | #ifdef __cplusplus 50 | } 51 | #endif 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /demos/os/rtthread/stm32f4xx/RT-Thread-1.2.2/components/drivers/include/drivers/i2c_dev.h: -------------------------------------------------------------------------------- 1 | /* 2 | * File : i2c_dev.h 3 | * This file is part of RT-Thread RTOS 4 | * COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License along 17 | * with this program; if not, write to the Free Software Foundation, Inc., 18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 | * 20 | * Change Logs: 21 | * Date Author Notes 22 | * 2012-04-25 weety first version 23 | */ 24 | 25 | #ifndef __I2C_DEV_H__ 26 | #define __I2C_DEV_H__ 27 | 28 | #include 29 | 30 | #ifdef __cplusplus 31 | extern "C" { 32 | #endif 33 | 34 | #define RT_I2C_DEV_CTRL_10BIT 0x20 35 | #define RT_I2C_DEV_CTRL_ADDR 0x21 36 | #define RT_I2C_DEV_CTRL_TIMEOUT 0x22 37 | #define RT_I2C_DEV_CTRL_RW 0x23 38 | 39 | struct rt_i2c_priv_data 40 | { 41 | struct rt_i2c_msg *msgs; 42 | rt_size_t number; 43 | }; 44 | 45 | rt_err_t rt_i2c_bus_device_device_init(struct rt_i2c_bus_device *bus, 46 | const char *name); 47 | 48 | #ifdef __cplusplus 49 | } 50 | #endif 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /demos/os/rtthread/stm32f4xx/RT-Thread-1.2.2/components/drivers/include/drivers/mtd_nor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * File : mtd_nor.h 3 | * This file is part of RT-Thread RTOS 4 | * COPYRIGHT (C) 2012, Shanghai Real-Thread Technology Co., Ltd 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License along 17 | * with this program; if not, write to the Free Software Foundation, Inc., 18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 | * 20 | * Change Logs: 21 | * Date Author Notes 22 | * 2012-5-30 Bernard the first version 23 | */ 24 | 25 | #ifndef __MTD_NOR_H__ 26 | #define __MTD_NOR_H__ 27 | 28 | #include 29 | 30 | struct rt_mtd_nor_driver_ops; 31 | #define RT_MTD_NOR_DEVICE(device) ((struct rt_mtd_nor_device*)(device)) 32 | 33 | struct rt_mtd_nor_device 34 | { 35 | struct rt_device parent; 36 | 37 | rt_uint32_t block_size; /* The Block size in the flash */ 38 | rt_uint32_t block_start; /* The start of available block*/ 39 | rt_uint32_t block_end; /* The end of available block */ 40 | 41 | /* operations interface */ 42 | const struct rt_mtd_nor_driver_ops* ops; 43 | }; 44 | 45 | struct rt_mtd_nor_driver_ops 46 | { 47 | rt_err_t (*read_id) (struct rt_mtd_nor_device* device); 48 | 49 | rt_size_t (*read) (struct rt_mtd_nor_device* device, rt_off_t offset, rt_uint8_t* data, rt_uint32_t length); 50 | rt_size_t (*write) (struct rt_mtd_nor_device* device, rt_off_t offset, const rt_uint8_t* data, rt_uint32_t length); 51 | 52 | rt_err_t (*erase_block)(struct rt_mtd_nor_device* device, rt_off_t offset, rt_uint32_t length); 53 | }; 54 | 55 | rt_err_t rt_mtd_nor_register_device(const char* name, struct rt_mtd_nor_device* device); 56 | 57 | rt_inline rt_uint32_t rt_mtd_nor_read_id(struct rt_mtd_nor_device* device) 58 | { 59 | return device->ops->read_id(device); 60 | } 61 | 62 | rt_inline rt_size_t rt_mtd_nor_read( 63 | struct rt_mtd_nor_device* device, 64 | rt_off_t offset, rt_uint8_t* data, rt_uint32_t length) 65 | { 66 | return device->ops->read(device, offset, data, length); 67 | } 68 | 69 | rt_inline rt_size_t rt_mtd_nor_write( 70 | struct rt_mtd_nor_device* device, 71 | rt_off_t offset, const rt_uint8_t* data, rt_uint32_t length) 72 | { 73 | return device->ops->write(device, offset, data, length); 74 | } 75 | 76 | rt_inline rt_err_t rt_mtd_nor_erase_block(struct rt_mtd_nor_device* device, rt_off_t offset, rt_size_t length) 77 | { 78 | return device->ops->erase_block(device, offset, length); 79 | } 80 | 81 | #endif 82 | -------------------------------------------------------------------------------- /demos/os/rtthread/stm32f4xx/RT-Thread-1.2.2/components/drivers/include/drivers/rtc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * File : rtc.h 3 | * This file is part of RT-Thread RTOS 4 | * COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License along 17 | * with this program; if not, write to the Free Software Foundation, Inc., 18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 | * 20 | * Change Logs: 21 | * Date Author Notes 22 | * 2012-10-10 aozima first version. 23 | */ 24 | 25 | #ifndef RTC_H_INCLUDED 26 | #define RTC_H_INCLUDED 27 | 28 | extern rt_err_t set_date(rt_uint32_t year, 29 | rt_uint32_t month, 30 | rt_uint32_t day); 31 | 32 | extern rt_err_t set_time(rt_uint32_t hour, 33 | rt_uint32_t minute, 34 | rt_uint32_t second); 35 | 36 | #endif // RTC_H_INCLUDED 37 | -------------------------------------------------------------------------------- /demos/os/rtthread/stm32f4xx/RT-Thread-1.2.2/components/drivers/include/drivers/sd.h: -------------------------------------------------------------------------------- 1 | /* 2 | * File : sd.h 3 | * This file is part of RT-Thread RTOS 4 | * COPYRIGHT (C) 2006, RT-Thread Development Team 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License along 17 | * with this program; if not, write to the Free Software Foundation, Inc., 18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 | * 20 | * Change Logs: 21 | * Date Author Notes 22 | * 2011-07-25 weety first version 23 | */ 24 | 25 | #ifndef __SD_H__ 26 | #define __SD_H__ 27 | 28 | #include 29 | #include 30 | 31 | #ifdef __cplusplus 32 | extern "C" { 33 | #endif 34 | 35 | rt_err_t mmcsd_send_if_cond(struct rt_mmcsd_host *host, rt_uint32_t ocr); 36 | rt_err_t mmcsd_send_app_op_cond(struct rt_mmcsd_host *host, rt_uint32_t ocr, rt_uint32_t *rocr); 37 | rt_int32_t init_sd(struct rt_mmcsd_host *host, rt_uint32_t ocr); 38 | 39 | #ifdef __cplusplus 40 | } 41 | #endif 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /demos/os/rtthread/stm32f4xx/RT-Thread-1.2.2/components/drivers/include/drivers/sdio_func_ids.h: -------------------------------------------------------------------------------- 1 | /* 2 | * File : sdio_func_ids.h 3 | * This file is part of RT-Thread RTOS 4 | * COPYRIGHT (C) 2006, RT-Thread Development Team 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License along 17 | * with this program; if not, write to the Free Software Foundation, Inc., 18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 | * 20 | * Change Logs: 21 | * Date Author Notes 22 | * 2012-02-26 weety first version 23 | */ 24 | 25 | #ifndef __SDIO_FUNC_IDS_H__ 26 | #define __SDIO_FUNC_IDS_H__ 27 | 28 | #ifdef __cplusplus 29 | extern "C" { 30 | #endif 31 | 32 | /* Standard SDIO Function Interfaces */ 33 | 34 | #define SDIO_FUNC_CODE_NONE 0x00 /* Not a SDIO standard interface */ 35 | #define SDIO_FUNC_CODE_UART 0x01 /* SDIO Standard UART */ 36 | #define SDIO_FUNC_CODE_BT_A 0x02 /* SDIO Type-A for Bluetooth standard interface */ 37 | #define SDIO_FUNC_CODE_BT_B 0x03 /* SDIO Type-B for Bluetooth standard interface */ 38 | #define SDIO_FUNC_CODE_GPS 0x04 /* SDIO GPS standard interface */ 39 | #define SDIO_FUNC_CODE_CAMERA 0x05 /* SDIO Camera standard interface */ 40 | #define SDIO_FUNC_CODE_PHS 0x06 /* SDIO PHS standard interface */ 41 | #define SDIO_FUNC_CODE_WLAN 0x07 /* SDIO WLAN interface */ 42 | #define SDIO_FUNC_CODE_ATA 0x08 /* Embedded SDIO-ATA standard interface */ 43 | 44 | /* manufacturer id, product io */ 45 | 46 | #define SDIO_MANUFACTURER_ID_MARVELL 0x02df 47 | #define SDIO_PRODUCT_ID_MARVELL_88W8686 0x9103 48 | 49 | #ifdef __cplusplus 50 | } 51 | #endif 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /demos/os/rtthread/stm32f4xx/RT-Thread-1.2.2/components/drivers/include/drivers/spi.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/CmBacktrace/4bec5c8a6c4ac65310174bf13ceb57830dd2d3f3/demos/os/rtthread/stm32f4xx/RT-Thread-1.2.2/components/drivers/include/drivers/spi.h -------------------------------------------------------------------------------- /demos/os/rtthread/stm32f4xx/RT-Thread-1.2.2/components/drivers/serial/SConscript: -------------------------------------------------------------------------------- 1 | from building import * 2 | 3 | cwd = GetCurrentDir() 4 | src = Glob('*.c') 5 | CPPPATH = [cwd + '/../include'] 6 | group = DefineGroup('DeviceDrivers', src, depend = ['RT_USING_SERIAL'], CPPPATH = CPPPATH) 7 | 8 | Return('group') 9 | -------------------------------------------------------------------------------- /demos/os/rtthread/stm32f4xx/RT-Thread-1.2.2/components/drivers/src/SConscript: -------------------------------------------------------------------------------- 1 | from building import * 2 | 3 | cwd = GetCurrentDir() 4 | src = Glob('*.c') 5 | CPPPATH = [cwd + '/../include'] 6 | group = DefineGroup('DeviceDrivers', src, depend = ['RT_USING_DEVICE_IPC'], CPPPATH = CPPPATH) 7 | 8 | Return('group') 9 | -------------------------------------------------------------------------------- /demos/os/rtthread/stm32f4xx/RT-Thread-1.2.2/components/drivers/src/wrokqueue.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #ifdef RT_USING_HEAP 5 | static void _workqueue_thread_entry(void* parameter) 6 | { 7 | struct rt_work* work; 8 | struct rt_workqueue* queue; 9 | 10 | queue = (struct rt_workqueue*) parameter; 11 | RT_ASSERT(queue != RT_NULL); 12 | 13 | while (1) 14 | { 15 | if (rt_list_isempty(&(queue->work_list))) 16 | { 17 | /* no software timer exist, suspend self. */ 18 | rt_thread_suspend(rt_thread_self()); 19 | rt_schedule(); 20 | } 21 | 22 | /* we have work to do with. */ 23 | rt_enter_critical(); 24 | work = rt_list_entry(queue->work_list.next, struct rt_work, list); 25 | rt_list_remove(&(work->list)); 26 | rt_exit_critical(); 27 | 28 | /* do work */ 29 | work->work_func(work, work->work_data); 30 | } 31 | } 32 | 33 | struct rt_workqueue *rt_workqueue_create(const char* name, rt_uint16_t stack_size, rt_uint8_t priority) 34 | { 35 | struct rt_workqueue *queue = RT_NULL; 36 | 37 | queue = (struct rt_workqueue*)RT_KERNEL_MALLOC(sizeof(struct rt_workqueue)); 38 | if (queue != RT_NULL) 39 | { 40 | /* initialize work list */ 41 | rt_list_init(&(queue->work_list)); 42 | 43 | /* create the work thread */ 44 | queue->work_thread = rt_thread_create(name, _workqueue_thread_entry, queue, stack_size, priority, 10); 45 | if (queue->work_thread == RT_NULL) 46 | { 47 | RT_KERNEL_FREE(queue); 48 | return RT_NULL; 49 | } 50 | 51 | rt_thread_startup(queue->work_thread); 52 | } 53 | 54 | return queue; 55 | } 56 | 57 | rt_err_t rt_workqueue_destroy(struct rt_workqueue* queue) 58 | { 59 | RT_ASSERT(queue != RT_NULL); 60 | 61 | rt_thread_delete(queue->work_thread); 62 | RT_KERNEL_FREE(queue); 63 | 64 | return RT_EOK; 65 | } 66 | 67 | rt_err_t rt_workqueue_dowork(struct rt_workqueue* queue, struct rt_work* work) 68 | { 69 | RT_ASSERT(queue != RT_NULL); 70 | RT_ASSERT(work != RT_NULL); 71 | 72 | rt_enter_critical(); 73 | /* NOTE: the work MUST be initialized firstly */ 74 | rt_list_remove(&(work->list)); 75 | 76 | rt_list_insert_after(queue->work_list.prev, &(work->list)); 77 | if (queue->work_thread->stat != RT_THREAD_READY) 78 | { 79 | rt_exit_critical(); 80 | /* resume work thread */ 81 | rt_thread_resume(queue->work_thread); 82 | rt_schedule(); 83 | } 84 | else rt_exit_critical(); 85 | 86 | return RT_EOK; 87 | } 88 | 89 | rt_err_t rt_workqueue_cancel_work(struct rt_workqueue* queue, struct rt_work* work) 90 | { 91 | RT_ASSERT(queue != RT_NULL); 92 | RT_ASSERT(work != RT_NULL); 93 | 94 | rt_enter_critical(); 95 | rt_list_remove(&(work->list)); 96 | rt_exit_critical(); 97 | 98 | return RT_EOK; 99 | } 100 | 101 | #endif 102 | -------------------------------------------------------------------------------- /demos/os/rtthread/stm32f4xx/RT-Thread-1.2.2/components/finsh/SConscript: -------------------------------------------------------------------------------- 1 | Import('rtconfig') 2 | from building import * 3 | 4 | cwd = GetCurrentDir() 5 | src = Split(''' 6 | shell.c 7 | symbol.c 8 | cmd.c 9 | ''') 10 | 11 | fsh_src = Split(''' 12 | finsh_compiler.c 13 | finsh_error.c 14 | finsh_heap.c 15 | finsh_init.c 16 | finsh_node.c 17 | finsh_ops.c 18 | finsh_parser.c 19 | finsh_var.c 20 | finsh_vm.c 21 | finsh_token.c 22 | ''') 23 | 24 | msh_src = Split(''' 25 | msh_cmd.c 26 | msh.c 27 | ''') 28 | 29 | CPPPATH = [cwd] 30 | if rtconfig.CROSS_TOOL == 'keil': 31 | LINKFLAGS = ' --keep __fsym_*' 32 | 33 | if not GetDepend('FINSH_USING_MSH_ONLY'): 34 | LINKFLAGS = LINKFLAGS + ' --keep __vsym_* ' 35 | else: 36 | LINKFLAGS = '' 37 | 38 | if GetDepend('FINSH_USING_MSH'): 39 | src = src + msh_src 40 | if not GetDepend('FINSH_USING_MSH_ONLY'): 41 | src = src + fsh_src 42 | 43 | group = DefineGroup('finsh', src, depend = ['RT_USING_FINSH'], CPPPATH = CPPPATH, LINKFLAGS = LINKFLAGS) 44 | 45 | Return('group') 46 | -------------------------------------------------------------------------------- /demos/os/rtthread/stm32f4xx/RT-Thread-1.2.2/components/finsh/finsh_error.c: -------------------------------------------------------------------------------- 1 | /* 2 | * error number for finsh shell. 3 | * 4 | * COPYRIGHT (C) 2013, Shanghai Real-Thread Technology Co., Ltd 5 | * 6 | * This file is part of RT-Thread (http://www.rt-thread.org) 7 | * Maintainer: bernard.xiong 8 | * 9 | * All rights reserved. 10 | * 11 | * This program is free software; you can redistribute it and/or modify 12 | * it under the terms of the GNU General Public License as published by 13 | * the Free Software Foundation; either version 2 of the License, or 14 | * (at your option) any later version. 15 | * 16 | * This program is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License along 22 | * with this program; if not, write to the Free Software Foundation, Inc., 23 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 24 | * 25 | * Change Logs: 26 | * Date Author Notes 27 | * 2010-03-22 Bernard first version 28 | */ 29 | #include "finsh_error.h" 30 | 31 | u_char global_errno; 32 | 33 | static const char * finsh_error_string_table[] = 34 | { 35 | "No error", 36 | "Invalid token", 37 | "Expect a type", 38 | "Unknown type", 39 | "Variable exist", 40 | "Expect a operater", 41 | "Memory full", 42 | "Unknown operator", 43 | "Unknown node", 44 | "Expect a character", 45 | "Unexpect end", 46 | "Unknown token", 47 | "Float not supported", 48 | "Unknown symbol", 49 | "Null node" 50 | }; 51 | 52 | int finsh_error_init() 53 | { 54 | global_errno = FINSH_ERROR_OK; 55 | 56 | return 0; 57 | } 58 | 59 | int finsh_error_set(u_char type) 60 | { 61 | global_errno = type; 62 | 63 | return 0; 64 | } 65 | 66 | u_char finsh_errno() 67 | { 68 | return global_errno; 69 | } 70 | 71 | const char* finsh_error_string(u_char type) 72 | { 73 | return finsh_error_string_table[type]; 74 | } 75 | -------------------------------------------------------------------------------- /demos/os/rtthread/stm32f4xx/RT-Thread-1.2.2/components/finsh/finsh_error.h: -------------------------------------------------------------------------------- 1 | /* 2 | * error number for finsh shell. 3 | * 4 | * COPYRIGHT (C) 2013, Shanghai Real-Thread Technology Co., Ltd 5 | * 6 | * This file is part of RT-Thread (http://www.rt-thread.org) 7 | * Maintainer: bernard.xiong 8 | * 9 | * All rights reserved. 10 | * 11 | * This program is free software; you can redistribute it and/or modify 12 | * it under the terms of the GNU General Public License as published by 13 | * the Free Software Foundation; either version 2 of the License, or 14 | * (at your option) any later version. 15 | * 16 | * This program is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License along 22 | * with this program; if not, write to the Free Software Foundation, Inc., 23 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 24 | * 25 | * Change Logs: 26 | * Date Author Notes 27 | * 2010-03-22 Bernard first version 28 | */ 29 | #ifndef __FINSH_ERROR_H__ 30 | #define __FINSH_ERROR_H__ 31 | 32 | #include 33 | 34 | int finsh_error_init(void); 35 | 36 | /* get error number */ 37 | u_char finsh_errno(void); 38 | 39 | int finsh_error_set(u_char type); 40 | const char* finsh_error_string(u_char type); 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /demos/os/rtthread/stm32f4xx/RT-Thread-1.2.2/components/finsh/finsh_heap.h: -------------------------------------------------------------------------------- 1 | /* 2 | * heap management in finsh shell. 3 | * 4 | * COPYRIGHT (C) 2006 - 2013, RT-Thread Development Team 5 | * 6 | * This file is part of RT-Thread (http://www.rt-thread.org) 7 | * Maintainer: bernard.xiong 8 | * 9 | * All rights reserved. 10 | * 11 | * This program is free software; you can redistribute it and/or modify 12 | * it under the terms of the GNU General Public License as published by 13 | * the Free Software Foundation; either version 2 of the License, or 14 | * (at your option) any later version. 15 | * 16 | * This program is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License along 22 | * with this program; if not, write to the Free Software Foundation, Inc., 23 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 24 | * 25 | * Change Logs: 26 | * Date Author Notes 27 | * 2010-03-22 Bernard first version 28 | */ 29 | #include 30 | 31 | #ifndef __FINSH_HEAP_H__ 32 | #define __FINSH_HEAP_H__ 33 | 34 | int finsh_heap_init(void); 35 | void* finsh_heap_allocate(size_t size); 36 | void finsh_heap_free(void*ptr); 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /demos/os/rtthread/stm32f4xx/RT-Thread-1.2.2/components/finsh/finsh_init.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Initialization procedure for finsh shell. 3 | * 4 | * COPYRIGHT (C) 2006 - 2013, RT-Thread Development Team 5 | * 6 | * This file is part of RT-Thread (http://www.rt-thread.org) 7 | * Maintainer: bernard.xiong 8 | * 9 | * All rights reserved. 10 | * 11 | * This program is free software; you can redistribute it and/or modify 12 | * it under the terms of the GNU General Public License as published by 13 | * the Free Software Foundation; either version 2 of the License, or 14 | * (at your option) any later version. 15 | * 16 | * This program is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License along 22 | * with this program; if not, write to the Free Software Foundation, Inc., 23 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 24 | * 25 | * Change Logs: 26 | * Date Author Notes 27 | * 2010-03-22 Bernard first version 28 | */ 29 | #include 30 | 31 | #include "finsh_node.h" 32 | #include "finsh_vm.h" 33 | #include "finsh_parser.h" 34 | #include "finsh_var.h" 35 | #include "finsh_error.h" 36 | #include "finsh_heap.h" 37 | 38 | int finsh_init(struct finsh_parser* parser) 39 | { 40 | finsh_parser_init(parser); 41 | 42 | /* finsh init */ 43 | finsh_node_init(); 44 | finsh_var_init(); 45 | finsh_error_init(); 46 | finsh_heap_init(); 47 | 48 | return 0; 49 | } 50 | 51 | long finsh_stack_bottom() 52 | { 53 | return finsh_vm_stack[0].long_value; 54 | } 55 | 56 | int finsh_flush(struct finsh_parser* parser) 57 | { 58 | finsh_parser_init(parser); 59 | 60 | /* finsh init */ 61 | finsh_node_init(); 62 | finsh_error_init(); 63 | 64 | return 0; 65 | } 66 | 67 | int finsh_reset(struct finsh_parser* parser) 68 | { 69 | /* finsh init */ 70 | finsh_node_init(); 71 | finsh_var_init(); 72 | finsh_error_init(); 73 | finsh_heap_init(); 74 | 75 | return 0; 76 | } 77 | -------------------------------------------------------------------------------- /demos/os/rtthread/stm32f4xx/RT-Thread-1.2.2/components/finsh/finsh_node.h: -------------------------------------------------------------------------------- 1 | /* 2 | * node routines for finsh shell. 3 | * 4 | * COPYRIGHT (C) 2006 - 2013, RT-Thread Development Team 5 | * 6 | * This file is part of RT-Thread (http://www.rt-thread.org) 7 | * Maintainer: bernard.xiong 8 | * 9 | * All rights reserved. 10 | * 11 | * This program is free software; you can redistribute it and/or modify 12 | * it under the terms of the GNU General Public License as published by 13 | * the Free Software Foundation; either version 2 of the License, or 14 | * (at your option) any later version. 15 | * 16 | * This program is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License along 22 | * with this program; if not, write to the Free Software Foundation, Inc., 23 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 24 | * 25 | * Change Logs: 26 | * Date Author Notes 27 | * 2010-03-22 Bernard first version 28 | */ 29 | #ifndef __FINSH_NODE_H__ 30 | #define __FINSH_NODE_H__ 31 | 32 | #include 33 | 34 | #define FINSH_NODE_UNKNOWN 0 35 | #define FINSH_NODE_ID 1 36 | 37 | #define FINSH_NODE_VALUE_CHAR 2 38 | #define FINSH_NODE_VALUE_INT 3 39 | #define FINSH_NODE_VALUE_LONG 4 40 | #define FINSH_NODE_VALUE_STRING 5 41 | #define FINSH_NODE_VALUE_NULL 6 42 | 43 | #define FINSH_NODE_SYS_ADD 7 44 | #define FINSH_NODE_SYS_SUB 8 45 | #define FINSH_NODE_SYS_MUL 9 46 | #define FINSH_NODE_SYS_DIV 10 47 | #define FINSH_NODE_SYS_MOD 11 48 | #define FINSH_NODE_SYS_AND 12 49 | #define FINSH_NODE_SYS_OR 13 50 | #define FINSH_NODE_SYS_XOR 14 51 | #define FINSH_NODE_SYS_BITWISE 15 52 | #define FINSH_NODE_SYS_SHL 16 53 | #define FINSH_NODE_SYS_SHR 17 54 | #define FINSH_NODE_SYS_FUNC 18 55 | #define FINSH_NODE_SYS_ASSIGN 19 56 | #define FINSH_NODE_SYS_CAST 20 57 | #define FINSH_NODE_SYS_PREINC 21 58 | #define FINSH_NODE_SYS_PREDEC 22 59 | #define FINSH_NODE_SYS_INC 23 60 | #define FINSH_NODE_SYS_DEC 24 61 | #define FINSH_NODE_SYS_GETVALUE 25 62 | #define FINSH_NODE_SYS_GETADDR 26 63 | #define FINSH_NODE_SYS_NULL 27 64 | 65 | #define FINSH_DATA_TYPE_VOID 0x00 66 | #define FINSH_DATA_TYPE_BYTE 0x01 67 | #define FINSH_DATA_TYPE_WORD 0x02 68 | #define FINSH_DATA_TYPE_DWORD 0x03 69 | #define FINSH_DATA_TYPE_PTR 0x10 70 | 71 | #define FINSH_NODE_VALUE 0 72 | #define FINSH_NODE_ADDRESS 1 73 | #define FINSH_NODE_FUNCTION 2 74 | 75 | int finsh_node_init(void); 76 | 77 | struct finsh_node* finsh_node_allocate(u_char type); 78 | struct finsh_node* finsh_node_new_id(char* id); 79 | struct finsh_node* finsh_node_new_char(char c); 80 | struct finsh_node* finsh_node_new_int(int i); 81 | struct finsh_node* finsh_node_new_long(long l); 82 | struct finsh_node* finsh_node_new_string(char* s); 83 | struct finsh_node* finsh_node_new_ptr(void* ptr); 84 | 85 | #define finsh_node_sibling(node) ((node)->sibling) 86 | #define finsh_node_child(node) ((node)->child) 87 | 88 | #endif 89 | -------------------------------------------------------------------------------- /demos/os/rtthread/stm32f4xx/RT-Thread-1.2.2/components/finsh/finsh_parser.h: -------------------------------------------------------------------------------- 1 | /* 2 | * script parser for finsh shell. 3 | * 4 | * COPYRIGHT (C) 2006 - 2013, RT-Thread Development Team 5 | * 6 | * This file is part of RT-Thread (http://www.rt-thread.org) 7 | * Maintainer: bernard.xiong 8 | * 9 | * All rights reserved. 10 | * 11 | * This program is free software; you can redistribute it and/or modify 12 | * it under the terms of the GNU General Public License as published by 13 | * the Free Software Foundation; either version 2 of the License, or 14 | * (at your option) any later version. 15 | * 16 | * This program is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License along 22 | * with this program; if not, write to the Free Software Foundation, Inc., 23 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 24 | * 25 | * Change Logs: 26 | * Date Author Notes 27 | * 2010-03-22 Bernard first version 28 | */ 29 | #ifndef __FINSH_PARSER_H__ 30 | #define __FINSH_PARSER_H__ 31 | 32 | #include 33 | 34 | int finsh_parser_init(struct finsh_parser* self); 35 | void finsh_parser_run(struct finsh_parser* self, const u_char* string); 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /demos/os/rtthread/stm32f4xx/RT-Thread-1.2.2/components/finsh/finsh_var.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Variable implementation in finsh shell. 3 | * 4 | * COPYRIGHT (C) 2006 - 2013, RT-Thread Development Team 5 | * 6 | * This file is part of RT-Thread (http://www.rt-thread.org) 7 | * Maintainer: bernard.xiong 8 | * 9 | * All rights reserved. 10 | * 11 | * This program is free software; you can redistribute it and/or modify 12 | * it under the terms of the GNU General Public License as published by 13 | * the Free Software Foundation; either version 2 of the License, or 14 | * (at your option) any later version. 15 | * 16 | * This program is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License along 22 | * with this program; if not, write to the Free Software Foundation, Inc., 23 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 24 | * 25 | * Change Logs: 26 | * Date Author Notes 27 | * 2010-03-22 Bernard first version 28 | */ 29 | #ifndef __FINSH_VAR_H__ 30 | #define __FINSH_VAR_H__ 31 | 32 | #include 33 | 34 | /* 35 | * The variable in finsh is put in data segment as a global variable. 36 | * The 'finsh_var' structure presents the structure of variable in data segment. 37 | */ 38 | struct finsh_var 39 | { 40 | char name[FINSH_NAME_MAX + 1]; /* the name of variable */ 41 | 42 | u_char type; /* the type of variable */ 43 | 44 | /* variable value */ 45 | union { 46 | char char_value; 47 | short short_value; 48 | int int_value; 49 | long long_value; 50 | void* ptr; 51 | }value; 52 | }; 53 | extern struct finsh_var global_variable[]; 54 | 55 | int finsh_var_init(void); 56 | int finsh_var_insert(const char* name, int type); 57 | int finsh_var_delete(const char* name); 58 | struct finsh_var* finsh_var_lookup(const char* name); 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /demos/os/rtthread/stm32f4xx/RT-Thread-1.2.2/components/finsh/finsh_vm.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Virtual machine finsh shell. 3 | * 4 | * COPYRIGHT (C) 2006 - 2013, RT-Thread Development Team 5 | * 6 | * This file is part of RT-Thread (http://www.rt-thread.org) 7 | * Maintainer: bernard.xiong 8 | * 9 | * All rights reserved. 10 | * 11 | * This program is free software; you can redistribute it and/or modify 12 | * it under the terms of the GNU General Public License as published by 13 | * the Free Software Foundation; either version 2 of the License, or 14 | * (at your option) any later version. 15 | * 16 | * This program is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License along 22 | * with this program; if not, write to the Free Software Foundation, Inc., 23 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 24 | * 25 | * Change Logs: 26 | * Date Author Notes 27 | * 2010-03-22 Bernard first version 28 | */ 29 | #ifndef __FINSH_VM_H__ 30 | #define __FINSH_VM_H__ 31 | 32 | #include 33 | 34 | #include "finsh_var.h" 35 | 36 | union finsh_value { 37 | char char_value; 38 | short short_value; 39 | long long_value; 40 | void* ptr; 41 | }; 42 | 43 | extern union finsh_value* finsh_sp; /* stack pointer */ 44 | extern u_char* finsh_pc; /* PC */ 45 | 46 | /* stack */ 47 | extern union finsh_value finsh_vm_stack[FINSH_STACK_MAX]; 48 | /* text segment */ 49 | extern u_char text_segment[FINSH_TEXT_MAX]; 50 | 51 | void finsh_vm_run(void); 52 | //void finsh_disassemble(void); 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /demos/os/rtthread/stm32f4xx/RT-Thread-1.2.2/components/finsh/msh.h: -------------------------------------------------------------------------------- 1 | /* 2 | * RT-Thread module shell implementation. 3 | * 4 | * COPYRIGHT (C) 2013, Shanghai Real-Thread Technology Co., Ltd 5 | * 6 | * This file is part of RT-Thread (http://www.rt-thread.org) 7 | * Maintainer: bernard.xiong 8 | * 9 | * All rights reserved. 10 | * 11 | * This program is free software; you can redistribute it and/or modify 12 | * it under the terms of the GNU General Public License as published by 13 | * the Free Software Foundation; either version 2 of the License, or 14 | * (at your option) any later version. 15 | * 16 | * This program is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License along 22 | * with this program; if not, write to the Free Software Foundation, Inc., 23 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 24 | * 25 | * Change Logs: 26 | * Date Author Notes 27 | * 2013-03-30 Bernard the first verion for FinSH 28 | */ 29 | 30 | #ifndef __M_SHELL__ 31 | #define __M_SHELL__ 32 | 33 | #include 34 | 35 | rt_bool_t msh_is_used(void); 36 | int msh_exec(char* cmd, rt_size_t length); 37 | void msh_auto_complete(char *prefix); 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /demos/os/rtthread/stm32f4xx/RT-Thread-1.2.2/components/finsh/shell.h: -------------------------------------------------------------------------------- 1 | /* 2 | * shell implementation for finsh shell. 3 | * 4 | * COPYRIGHT (C) 2006 - 2013, RT-Thread Development Team 5 | * 6 | * This file is part of RT-Thread (http://www.rt-thread.org) 7 | * Maintainer: bernard.xiong 8 | * 9 | * All rights reserved. 10 | * 11 | * This program is free software; you can redistribute it and/or modify 12 | * it under the terms of the GNU General Public License as published by 13 | * the Free Software Foundation; either version 2 of the License, or 14 | * (at your option) any later version. 15 | * 16 | * This program is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License along 22 | * with this program; if not, write to the Free Software Foundation, Inc., 23 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 24 | * 25 | * Change Logs: 26 | * Date Author Notes 27 | * 2011-06-02 Bernard Add finsh_get_prompt function declaration 28 | */ 29 | 30 | #ifndef __SHELL_H__ 31 | #define __SHELL_H__ 32 | 33 | #include 34 | #include "finsh.h" 35 | 36 | #define FINSH_USING_HISTORY 37 | #ifndef FINSH_THREAD_PRIORITY 38 | #define FINSH_THREAD_PRIORITY 20 39 | #endif 40 | #ifndef FINSH_THREAD_STACK_SIZE 41 | #define FINSH_THREAD_STACK_SIZE 2048 42 | #endif 43 | #define FINSH_CMD_SIZE 80 44 | 45 | #define FINSH_OPTION_ECHO 0x01 46 | #if defined(FINSH_USING_MSH) || (defined(RT_USING_DFS) && defined(DFS_USING_WORKDIR)) 47 | #define FINSH_PROMPT finsh_get_prompt() 48 | const char* finsh_get_prompt(void); 49 | #else 50 | #define FINSH_PROMPT "finsh>>" 51 | #endif 52 | 53 | #ifdef FINSH_USING_HISTORY 54 | #ifndef FINSH_HISTORY_LINES 55 | #define FINSH_HISTORY_LINES 5 56 | #endif 57 | #endif 58 | 59 | enum input_stat 60 | { 61 | WAIT_NORMAL, 62 | WAIT_SPEC_KEY, 63 | WAIT_FUNC_KEY, 64 | }; 65 | struct finsh_shell 66 | { 67 | struct rt_semaphore rx_sem; 68 | 69 | enum input_stat stat; 70 | 71 | rt_uint8_t echo_mode:1; 72 | 73 | #ifdef FINSH_USING_HISTORY 74 | rt_uint16_t current_history; 75 | rt_uint16_t history_count; 76 | 77 | char cmd_history[FINSH_HISTORY_LINES][FINSH_CMD_SIZE]; 78 | #endif 79 | 80 | #ifndef FINSH_USING_MSH_ONLY 81 | struct finsh_parser parser; 82 | #endif 83 | 84 | char line[FINSH_CMD_SIZE]; 85 | rt_uint8_t line_position; 86 | rt_uint8_t line_curpos; 87 | 88 | rt_device_t device; 89 | }; 90 | 91 | void finsh_set_echo(rt_uint32_t echo); 92 | rt_uint32_t finsh_get_echo(void); 93 | 94 | int finsh_system_init(void); 95 | void finsh_set_device(const char* device_name); 96 | const char* finsh_get_device(void); 97 | 98 | #endif 99 | -------------------------------------------------------------------------------- /demos/os/rtthread/stm32f4xx/RT-Thread-1.2.2/components/finsh/symbol.c: -------------------------------------------------------------------------------- 1 | /* 2 | * symbols in finsh shell. 3 | * 4 | * COPYRIGHT (C) 2006 - 2013, RT-Thread Development Team 5 | * 6 | * This file is part of RT-Thread (http://www.rt-thread.org) 7 | * Maintainer: bernard.xiong 8 | * 9 | * All rights reserved. 10 | * 11 | * This program is free software; you can redistribute it and/or modify 12 | * it under the terms of the GNU General Public License as published by 13 | * the Free Software Foundation; either version 2 of the License, or 14 | * (at your option) any later version. 15 | * 16 | * This program is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License along 22 | * with this program; if not, write to the Free Software Foundation, Inc., 23 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 24 | * 25 | * Change Logs: 26 | * Date Author Notes 27 | * 2010-03-22 Bernard first version 28 | */ 29 | #include "finsh.h" 30 | 31 | long hello(void); 32 | long version(void); 33 | long list(void); 34 | long list_thread(void); 35 | long list_sem(void); 36 | long list_mutex(void); 37 | long list_fevent(void); 38 | long list_event(void); 39 | long list_mailbox(void); 40 | long list_msgqueue(void); 41 | long list_mempool(void); 42 | long list_timer(void); 43 | 44 | #ifdef FINSH_USING_SYMTAB 45 | struct finsh_syscall *_syscall_table_begin = NULL; 46 | struct finsh_syscall *_syscall_table_end = NULL; 47 | struct finsh_sysvar *_sysvar_table_begin = NULL; 48 | struct finsh_sysvar *_sysvar_table_end = NULL; 49 | #else 50 | struct finsh_syscall _syscall_table[] = 51 | { 52 | {"hello", hello}, 53 | {"version", version}, 54 | {"list", list}, 55 | {"list_thread", list_thread}, 56 | #ifdef RT_USING_SEMAPHORE 57 | {"list_sem", list_sem}, 58 | #endif 59 | #ifdef RT_USING_MUTEX 60 | {"list_mutex", list_mutex}, 61 | #endif 62 | #ifdef RT_USING_FEVENT 63 | {"list_fevent", list_fevent}, 64 | #endif 65 | #ifdef RT_USING_EVENT 66 | {"list_event", list_event}, 67 | #endif 68 | #ifdef RT_USING_MAILBOX 69 | {"list_mb", list_mailbox}, 70 | #endif 71 | #ifdef RT_USING_MESSAGEQUEUE 72 | {"list_mq", list_msgqueue}, 73 | #endif 74 | #ifdef RT_USING_MEMPOOL 75 | {"list_memp", list_mempool}, 76 | #endif 77 | {"list_timer", list_timer}, 78 | }; 79 | struct finsh_syscall *_syscall_table_begin = &_syscall_table[0]; 80 | struct finsh_syscall *_syscall_table_end = &_syscall_table[sizeof(_syscall_table) / sizeof(struct finsh_syscall)]; 81 | 82 | struct finsh_sysvar *_sysvar_table_begin = NULL; 83 | struct finsh_sysvar *_sysvar_table_end = NULL; 84 | #endif 85 | -------------------------------------------------------------------------------- /demos/os/rtthread/stm32f4xx/RT-Thread-1.2.2/include/cpuusage.h: -------------------------------------------------------------------------------- 1 | #ifndef CPUUSAGE_H 2 | #define CPUUSAGE_H 3 | 4 | 5 | static void cpu_usage_idle_hook(void); 6 | void cpu_usage_get(rt_uint8_t *major, rt_uint8_t *minor); 7 | void cpu_usage_init(void); 8 | 9 | #endif 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /demos/os/rtthread/stm32f4xx/RT-Thread-1.2.2/include/rtm.h: -------------------------------------------------------------------------------- 1 | /* 2 | * File : rtm.h 3 | * This file is part of RT-Thread RTOS 4 | * COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License along 17 | * with this program; if not, write to the Free Software Foundation, Inc., 18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 | */ 20 | 21 | #ifndef __RTM_H__ 22 | #define __RTM_H__ 23 | 24 | #include 25 | #include 26 | 27 | #ifdef RT_USING_MODULE 28 | struct rt_module_symtab 29 | { 30 | void *addr; 31 | const char *name; 32 | }; 33 | 34 | #if defined(_MSC_VER) 35 | #pragma section("RTMSymTab$f",read) 36 | #define RTM_EXPORT(symbol) \ 37 | __declspec(allocate("RTMSymTab$f"))const char __rtmsym_##symbol##_name[] = "__vs_rtm_"#symbol; 38 | #pragma comment(linker, "/merge:RTMSymTab=mytext") 39 | 40 | #elif defined(__MINGW32__) 41 | #define RTM_EXPORT(symbol) 42 | 43 | #else 44 | #define RTM_EXPORT(symbol) \ 45 | const char __rtmsym_##symbol##_name[] = #symbol; \ 46 | const struct rt_module_symtab __rtmsym_##symbol SECTION("RTMSymTab")= \ 47 | { \ 48 | (void *)&symbol, \ 49 | __rtmsym_##symbol##_name \ 50 | }; 51 | #endif 52 | 53 | #else 54 | #define RTM_EXPORT(symbol) 55 | #endif 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /demos/os/rtthread/stm32f4xx/RT-Thread-1.2.2/libcpu/SConscript: -------------------------------------------------------------------------------- 1 | Import('RTT_ROOT') 2 | Import('rtconfig') 3 | from building import * 4 | 5 | comm = rtconfig.ARCH + '/common' 6 | path = rtconfig.ARCH + '/' + rtconfig.CPU 7 | 8 | # The set of source files associated with this SConscript file. 9 | if rtconfig.PLATFORM == 'armcc': 10 | src = Glob(path + '/*.c') + Glob(path + '/*_rvds.S') + Glob(comm + '/*.c') 11 | 12 | if rtconfig.PLATFORM == 'gcc': 13 | src = Glob(path + '/*.c') + Glob(path + '/*_gcc.S') + Glob(comm + '/*.c') + Glob(path + '/*_init.S') 14 | 15 | if rtconfig.PLATFORM == 'iar': 16 | src = Glob(path + '/*.c') + Glob(path + '/*_iar.S') + Glob(comm + '/*.c') 17 | 18 | if rtconfig.PLATFORM == 'cl': 19 | src = Glob(path + '/*.c') 20 | 21 | if rtconfig.PLATFORM == 'mingw': 22 | src = Glob(path + '/*.c') 23 | 24 | CPPPATH = [RTT_ROOT + '/libcpu/' + rtconfig.ARCH + '/' + rtconfig.CPU, RTT_ROOT + '/libcpu/' + rtconfig.ARCH + '/common'] 25 | group = DefineGroup(rtconfig.CPU.upper(), src, depend = [''], CPPPATH = CPPPATH) 26 | 27 | Return('group') 28 | -------------------------------------------------------------------------------- /demos/os/rtthread/stm32f4xx/RT-Thread-1.2.2/src/SConscript: -------------------------------------------------------------------------------- 1 | Import('RTT_ROOT') 2 | Import('rtconfig') 3 | from building import * 4 | 5 | src = Glob('*.c') 6 | 7 | CPPPATH = [RTT_ROOT + '/include'] 8 | if rtconfig.CROSS_TOOL == 'keil' and GetDepend('RT_USING_MODULE') == True: 9 | LINKFLAGS = ' --keep __rtmsym_* ' 10 | else: 11 | LINKFLAGS = '' 12 | 13 | if GetDepend('RT_USING_MODULE') == False: 14 | SrcRemove(src, ['module.c']) 15 | 16 | if GetDepend('RT_USING_HEAP') == False or GetDepend('RT_USING_SMALL_MEM') == False: 17 | SrcRemove(src, ['mem.c']) 18 | 19 | if GetDepend('RT_USING_HEAP') == False or GetDepend('RT_USING_SLAB') == False: 20 | SrcRemove(src, ['slab.c']) 21 | 22 | if GetDepend('RT_USING_MEMPOOL') == False: 23 | SrcRemove(src, ['mempool.c']) 24 | 25 | if GetDepend('RT_USING_MEMHEAP') == False: 26 | SrcRemove(src, ['memheap.c']) 27 | if GetDepend('RT_USING_MEMHEAP_AS_HEAP'): 28 | SrcRemove(src, ['mem.c']) 29 | 30 | if GetDepend('RT_USING_DEVICE') == False: 31 | SrcRemove(src, ['device.c']) 32 | 33 | group = DefineGroup('Kernel', src, depend = [''], CPPPATH = CPPPATH, LINKFLAGS = LINKFLAGS) 34 | 35 | Return('group') 36 | -------------------------------------------------------------------------------- /demos/os/rtthread/stm32f4xx/RT-Thread-1.2.2/src/cpuusage.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #define CPU_USAGE_CALC_TICK 10 5 | #define CPU_USAGE_LOOP 100 6 | 7 | static rt_uint8_t cpu_usage_major = 0, cpu_usage_minor= 0; 8 | static rt_uint32_t total_count = 0; 9 | 10 | static void cpu_usage_idle_hook() 11 | { 12 | rt_tick_t tick; 13 | rt_uint32_t count; 14 | volatile rt_uint32_t loop; 15 | 16 | if (total_count == 0) 17 | { 18 | /* get total count */ 19 | rt_enter_critical(); 20 | tick = rt_tick_get(); 21 | while(rt_tick_get() - tick < CPU_USAGE_CALC_TICK) 22 | { 23 | total_count ++; 24 | loop = 0; 25 | while (loop < CPU_USAGE_LOOP) loop ++; 26 | } 27 | rt_exit_critical(); 28 | } 29 | 30 | count = 0; 31 | /* get CPU usage */ 32 | tick = rt_tick_get(); 33 | while (rt_tick_get() - tick < CPU_USAGE_CALC_TICK) 34 | { 35 | count ++; 36 | loop = 0; 37 | while (loop < CPU_USAGE_LOOP) loop ++; 38 | } 39 | 40 | /* calculate major and minor */ 41 | if (count < total_count) 42 | { 43 | count = total_count - count; 44 | cpu_usage_major = (count * 100) / total_count; 45 | cpu_usage_minor = ((count * 100) % total_count) * 100 / total_count; 46 | } 47 | else 48 | { 49 | total_count = count; 50 | 51 | /* no CPU usage */ 52 | cpu_usage_major = 0; 53 | cpu_usage_minor = 0; 54 | } 55 | } 56 | 57 | void cpu_usage_get(rt_uint8_t *major, rt_uint8_t *minor) 58 | { 59 | RT_ASSERT(major != RT_NULL); 60 | RT_ASSERT(minor != RT_NULL); 61 | 62 | *major = cpu_usage_major; 63 | *minor = cpu_usage_minor; 64 | } 65 | 66 | void cpu_usage_init() 67 | { 68 | /* set idle thread hook */ 69 | rt_thread_idle_sethook(cpu_usage_idle_hook); 70 | } 71 | -------------------------------------------------------------------------------- /demos/os/rtthread/stm32f4xx/RT-Thread-1.2.2/src/irq.c: -------------------------------------------------------------------------------- 1 | /* 2 | * File : irq.c 3 | * This file is part of RT-Thread RTOS 4 | * COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License along 17 | * with this program; if not, write to the Free Software Foundation, Inc., 18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 | * 20 | * Change Logs: 21 | * Date Author Notes 22 | * 2006-02-24 Bernard first version 23 | * 2006-05-03 Bernard add IRQ_DEBUG 24 | */ 25 | 26 | #include 27 | #include 28 | 29 | /* #define IRQ_DEBUG */ 30 | 31 | /** 32 | * @addtogroup Kernel 33 | */ 34 | 35 | /*@{*/ 36 | 37 | volatile rt_uint8_t rt_interrupt_nest; 38 | 39 | /** 40 | * This function will be invoked by BSP, when enter interrupt service routine 41 | * 42 | * @note please don't invoke this routine in application 43 | * 44 | * @see rt_interrupt_leave 45 | */ 46 | void rt_interrupt_enter(void) 47 | { 48 | rt_base_t level; 49 | 50 | RT_DEBUG_LOG(RT_DEBUG_IRQ, ("irq coming..., irq nest:%d\n", 51 | rt_interrupt_nest)); 52 | 53 | level = rt_hw_interrupt_disable(); 54 | rt_interrupt_nest ++; 55 | rt_hw_interrupt_enable(level); 56 | } 57 | RTM_EXPORT(rt_interrupt_enter); 58 | 59 | /** 60 | * This function will be invoked by BSP, when leave interrupt service routine 61 | * 62 | * @note please don't invoke this routine in application 63 | * 64 | * @see rt_interrupt_enter 65 | */ 66 | void rt_interrupt_leave(void) 67 | { 68 | rt_base_t level; 69 | 70 | RT_DEBUG_LOG(RT_DEBUG_IRQ, ("irq leave, irq nest:%d\n", 71 | rt_interrupt_nest)); 72 | 73 | level = rt_hw_interrupt_disable(); 74 | rt_interrupt_nest --; 75 | rt_hw_interrupt_enable(level); 76 | } 77 | RTM_EXPORT(rt_interrupt_leave); 78 | 79 | /** 80 | * This function will return the nest of interrupt. 81 | * 82 | * User application can invoke this function to get whether current 83 | * context is interrupt context. 84 | * 85 | * @return the number of nested interrupts. 86 | */ 87 | rt_uint8_t rt_interrupt_get_nest(void) 88 | { 89 | return rt_interrupt_nest; 90 | } 91 | RTM_EXPORT(rt_interrupt_get_nest); 92 | 93 | RTM_EXPORT(rt_hw_interrupt_disable); 94 | RTM_EXPORT(rt_hw_interrupt_enable); 95 | 96 | /*@}*/ 97 | 98 | -------------------------------------------------------------------------------- /demos/os/rtthread/stm32f4xx/RVMDK/.gitignore: -------------------------------------------------------------------------------- 1 | /Output 2 | *.uvgui.* 3 | 4 | -------------------------------------------------------------------------------- /demos/os/rtthread/stm32f4xx/RVMDK/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/CmBacktrace/4bec5c8a6c4ac65310174bf13ceb57830dd2d3f3/demos/os/rtthread/stm32f4xx/RVMDK/README.md -------------------------------------------------------------------------------- /demos/os/rtthread/stm32f4xx/app/inc/app_task.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************* 2 | // NCLUDE FILES 3 | *********************************************************************************************************/ 4 | #ifndef APP_TASK_H 5 | #define APP_TASK_H 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | void rtthread_startup(void); 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /demos/os/rtthread/stm32f4xx/app/inc/delay_conf.h: -------------------------------------------------------------------------------- 1 | #ifndef __DELAY_CONF_H__ 2 | #define __DELAY_CONF_H__ 3 | 4 | #include"rtconfig.h" 5 | 6 | #if RT_TICK_PER_SECOND == 1 7 | #define DELAY_1S (RT_TICK_PER_SECOND) 8 | #define DELAY_S(X) (X*DELAY_1S) 9 | 10 | #elif RT_TICK_PER_SECOND == 10 11 | #define DELAY_100MS(X) (X) 12 | #define DELAY_S(X) (X*10) 13 | 14 | #elif RT_TICK_PER_SECOND == 100 15 | #define DELAY_10MS(X) (X) 16 | #define DELAY_100MS(X) (X*10) 17 | #define DELAY_S(X) (X*100) 18 | 19 | #elif (RT_TICK_PER_SECOND == 1000) 20 | 21 | #define DELAY_1MS (RT_TICK_PER_SECOND/1000) 22 | #define DELAY_MS(X) (X*DELAY_1MS) 23 | #define DELAY_S(X) (X*1000*DELAY_1MS) 24 | 25 | #elif (RT_TICK_PER_SECOND == 10000) 26 | #define DELAY_100US(X) (X*RT_TICK_PER_SECOND/10000) 27 | #define DELAY_1MS (RT_TICK_PER_SECOND/1000) 28 | #define DELAY_MS(X) (X*DELAY_1MS) 29 | #define DELAY_S(X) (X*1000*DELAY_1MS) 30 | 31 | #endif 32 | 33 | #define DELAY_SYS_INIT_LED_ON DELAY_MS(90) 34 | #define DELAY_SYS_INIT_LED_OFF DELAY_MS(10) 35 | #define DELAY_SYS_RUN_LED_ON DELAY_MS(960) 36 | #define DELAY_SYS_RUN_LED_OFF DELAY_MS(40) 37 | #define DELAY_SYS_FAULT_LED_ON DELAY_MS(40) 38 | #define DELAY_SYS_FAULT_LED_OFF DELAY_MS(960) 39 | 40 | #endif 41 | 42 | -------------------------------------------------------------------------------- /demos/os/rtthread/stm32f4xx/app/inc/rtconfig.h: -------------------------------------------------------------------------------- 1 | /* RT-Thread config file */ 2 | #ifndef __RTTHREAD_CFG_H__ 3 | #define __RTTHREAD_CFG_H__ 4 | 5 | /* RT_NAME_MAX*/ 6 | #define RT_NAME_MAX 24 7 | 8 | /* RT_ALIGN_SIZE*/ 9 | #define RT_ALIGN_SIZE 8 10 | 11 | /* PRIORITY_MAX */ 12 | #define RT_THREAD_PRIORITY_MAX 32 13 | 14 | /* Tick per Second */ 15 | #define RT_TICK_PER_SECOND 1000 //1ms 16 | 17 | /* SECTION: RT_DEBUG */ 18 | /* Thread Debug */ 19 | #define RT_DEBUG 20 | #define RT_THREAD_DEBUG 21 | 22 | #define RT_USING_OVERFLOW_CHECK 23 | 24 | /* Using Hook */ 25 | #define RT_USING_HOOK 26 | 27 | /* Using Software Timer */ 28 | #define RT_USING_TIMER_SOFT 29 | #define RT_TIMER_THREAD_PRIO 4 30 | #define RT_TIMER_THREAD_STACK_SIZE 512 31 | #define RT_TIMER_TICK_PER_SECOND 1000 32 | 33 | /* SECTION: IPC */ 34 | /* Using Semaphore*/ 35 | #define RT_USING_SEMAPHORE 36 | 37 | /* Using Mutex */ 38 | #define RT_USING_MUTEX 39 | 40 | /* Using Event */ 41 | #define RT_USING_EVENT 42 | 43 | /* Using MailBox */ 44 | //#define RT_USING_MAILBOX 45 | 46 | /* Using Message Queue */ 47 | //#define RT_USING_MESSAGEQUEUE 48 | 49 | /* SECTION: Memory Management */ 50 | /* Using Memory Pool Management*/ 51 | //#define RT_USING_MEMPOOL 52 | 53 | /* Using Dynamic Heap Management */ 54 | #define RT_USING_HEAP 55 | 56 | /* Using Small MM */ 57 | #define RT_USING_SMALL_MEM 58 | 59 | /* SECTION: Device System */ 60 | /* Using Device System */ 61 | #define RT_USING_CONSOLE 62 | // 63 | #define RT_CONSOLE_DEVICE_NAME "uart1" 64 | 65 | /* SECTION: Console options */ 66 | /* the buffer size of console*/ 67 | #define RT_CONSOLEBUF_SIZE 512 68 | 69 | /* SECTION: finsh, a C-Express shell */ 70 | #define RT_USING_FINSH 71 | /* Using symbol table */ 72 | #define FINSH_USING_SYMTAB 73 | #define FINSH_USING_DESCRIPTION 74 | /* Using msh and finsh */ 75 | #define FINSH_USING_MSH 76 | /* Using msh only */ 77 | #define FINSH_USING_MSH_ONLY 78 | 79 | /* SECTION: Device System */ 80 | /* Using Device System */ 81 | #define RT_USING_DEVICE 82 | // 83 | #define RT_USING_DEVICE_IPC 84 | // 85 | #define RT_USING_SERIAL 86 | 87 | #endif 88 | -------------------------------------------------------------------------------- /demos/os/rtthread/stm32f4xx/app/inc/stm32f4xx_it.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file Project/STM32F4xx_StdPeriph_Templates/stm32f4xx_it.h 4 | * @author MCD Application Team 5 | * @version V1.5.0 6 | * @date 06-March-2015 7 | * @brief This file contains the headers of the interrupt handlers. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2015 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive inclusion -------------------------------------*/ 29 | #ifndef __STM32F4xx_IT_H 30 | #define __STM32F4xx_IT_H 31 | 32 | #ifdef __cplusplus 33 | extern "C" { 34 | #endif 35 | 36 | /* Includes ------------------------------------------------------------------*/ 37 | #include "stm32f4xx.h" 38 | 39 | /* Exported types ------------------------------------------------------------*/ 40 | /* Exported constants --------------------------------------------------------*/ 41 | /* Exported macro ------------------------------------------------------------*/ 42 | /* Exported functions ------------------------------------------------------- */ 43 | 44 | void NMI_Handler(void); 45 | void MemManage_Handler(void); 46 | void BusFault_Handler(void); 47 | void UsageFault_Handler(void); 48 | void SVC_Handler(void); 49 | void DebugMon_Handler(void); 50 | void SysTick_Handler(void); 51 | 52 | #ifdef __cplusplus 53 | } 54 | #endif 55 | 56 | #endif /* __STM32F4xx_IT_H */ 57 | 58 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 59 | -------------------------------------------------------------------------------- /demos/os/rtthread/stm32f4xx/app/src/app.c: -------------------------------------------------------------------------------- 1 | #include "app_task.h" 2 | 3 | int main(void){ 4 | /* disable interrupt first */ 5 | rt_hw_interrupt_disable(); 6 | 7 | /* startup RT-Thread RTOS */ 8 | rtthread_startup(); 9 | 10 | return 0; 11 | } 12 | 13 | 14 | -------------------------------------------------------------------------------- /demos/os/rtthread/stm32f4xx/app/src/fault_test.c: -------------------------------------------------------------------------------- 1 | /* 2 | * fault_test.c 3 | * 4 | * Created on: 2016/12/25 5 | * Author: Armink 6 | */ 7 | 8 | #include 9 | 10 | void fault_test_by_unalign(void) { 11 | volatile int * SCB_CCR = (volatile int *) 0xE000ED14; // SCB->CCR 12 | volatile int * p; 13 | volatile int value; 14 | 15 | *SCB_CCR |= (1 << 3); /* bit3: UNALIGN_TRP. */ 16 | 17 | p = (int *) 0x00; 18 | value = *p; 19 | printf("addr:0x%02X value:0x%08X\r\n", (int) p, value); 20 | 21 | p = (int *) 0x04; 22 | value = *p; 23 | printf("addr:0x%02X value:0x%08X\r\n", (int) p, value); 24 | 25 | p = (int *) 0x03; 26 | value = *p; 27 | printf("addr:0x%02X value:0x%08X\r\n", (int) p, value); 28 | } 29 | 30 | void fault_test_by_div0(void) { 31 | volatile int * SCB_CCR = (volatile int *) 0xE000ED14; // SCB->CCR 32 | int x, y, z; 33 | 34 | *SCB_CCR |= (1 << 4); /* bit4: DIV_0_TRP. */ 35 | 36 | x = 10; 37 | y = 0; 38 | z = x / y; 39 | printf("z:%d\n", z); 40 | } 41 | -------------------------------------------------------------------------------- /demos/os/rtthread/stm32f4xx/app/src/user_finsh_cmd.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/CmBacktrace/4bec5c8a6c4ac65310174bf13ceb57830dd2d3f3/demos/os/rtthread/stm32f4xx/app/src/user_finsh_cmd.c -------------------------------------------------------------------------------- /demos/os/rtthread/stm32f4xx/components/cm_backtrace/cmb_cfg.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the CmBacktrace Library. 3 | * 4 | * Copyright (c) 2016, Armink, 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining 7 | * a copy of this software and associated documentation files (the 8 | * 'Software'), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, 10 | * distribute, sublicense, and/or sell copies of the Software, and to 11 | * permit persons to whom the Software is furnished to do so, subject to 12 | * the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 20 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 21 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 22 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 23 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | * 25 | * Function: It is the configure head file for this library. 26 | * Created on: 2016-12-15 27 | */ 28 | 29 | #ifndef _CMB_CFG_H_ 30 | #define _CMB_CFG_H_ 31 | 32 | #include 33 | /* print line, must config by user */ 34 | #define cmb_println(...) rt_kprintf(__VA_ARGS__);rt_kprintf("\r\n") 35 | /* enable OS platform */ 36 | #define CMB_USING_OS_PLATFORM 37 | /* OS platform type, must config when CMB_USING_OS_PLATFORM is enable */ 38 | #define CMB_OS_PLATFORM_TYPE CMB_OS_PLATFORM_RTT 39 | /* cpu platform type, must config by user */ 40 | #define CMB_CPU_PLATFORM_TYPE CMB_CPU_ARM_CORTEX_M4 41 | /* enable dump stack information */ 42 | #define CMB_USING_DUMP_STACK_INFO 43 | /* language of print information */ 44 | #define CMB_PRINT_LANGUAGE CMB_PRINT_LANGUAGE_ENGLISH 45 | #endif /* _CMB_CFG_H_ */ 46 | -------------------------------------------------------------------------------- /demos/os/rtthread/stm32f4xx/components/others/bsp.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/CmBacktrace/4bec5c8a6c4ac65310174bf13ceb57830dd2d3f3/demos/os/rtthread/stm32f4xx/components/others/bsp.c -------------------------------------------------------------------------------- /demos/os/rtthread/stm32f4xx/components/others/stm32f405xG.icf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/CmBacktrace/4bec5c8a6c4ac65310174bf13ceb57830dd2d3f3/demos/os/rtthread/stm32f4xx/components/others/stm32f405xG.icf -------------------------------------------------------------------------------- /demos/os/rtthread/stm32f4xx/components/others/types.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef TYPES_H_ 3 | #define TYPES_H_ 4 | 5 | #include 6 | #include 7 | typedef int bool_t; /**< boolean type */ 8 | 9 | #ifndef TRUE 10 | #define TRUE 1 11 | #endif 12 | 13 | #ifndef FALSE 14 | #define FALSE 0 15 | #endif 16 | 17 | #ifndef NULL 18 | #define NULL 0 19 | #endif 20 | 21 | #define success 0 22 | #define fail 1 23 | 24 | 25 | #ifndef disable 26 | #define disable 0 27 | #endif 28 | 29 | #ifndef enable 30 | #define enable 1 31 | #endif 32 | 33 | #endif /* TYPES_H_ */ 34 | -------------------------------------------------------------------------------- /demos/os/rtthread/stm32f4xx/components/others/utils.c: -------------------------------------------------------------------------------- 1 | #include "utils.h" 2 | 3 | /* current system status */ 4 | static SystemStatus cur_system_status = SYSTEM_STATUS_INIT; 5 | 6 | 7 | /** 8 | * System go to fault status. 9 | */ 10 | void system_go_to_fault_status(void){ 11 | cur_system_status = SYSTEM_STATUS_FAULT; 12 | } 13 | 14 | /** 15 | * Set current system status. 16 | * 17 | * @param status system status 18 | */ 19 | void set_system_status(SystemStatus status){ 20 | cur_system_status = status; 21 | } 22 | 23 | /** 24 | * Get current system status. 25 | * 26 | * @return current system status 27 | */ 28 | SystemStatus get_system_status(void){ 29 | return cur_system_status; 30 | } 31 | -------------------------------------------------------------------------------- /demos/os/rtthread/stm32f4xx/components/others/utils.h: -------------------------------------------------------------------------------- 1 | #ifndef UTILS_H_ 2 | #define UTILS_H_ 3 | 4 | #include 5 | #include 6 | 7 | /* system status */ 8 | typedef enum{ 9 | SYSTEM_STATUS_INIT, 10 | SYSTEM_STATUS_RUN, 11 | SYSTEM_STATUS_FAULT, 12 | SYSTEM_STATUS_SLEEP, 13 | }SystemStatus; 14 | 15 | void Delay(vu32 nCount); 16 | void system_go_to_fault_status(void); 17 | void set_system_status(SystemStatus status); 18 | SystemStatus get_system_status(void); 19 | 20 | #endif /* UTILS_H_ */ 21 | -------------------------------------------------------------------------------- /demos/os/rtthread/stm32f4xx/components/rtt_uart/usart.h: -------------------------------------------------------------------------------- 1 | /* 2 | * File : usart.h 3 | * This file is part of RT-Thread RTOS 4 | * COPYRIGHT (C) 2009, RT-Thread Development Team 5 | * 6 | * The license and distribution terms for this file may be 7 | * found in the file LICENSE in this distribution or at 8 | * http://www.rt-thread.org/license/LICENSE 9 | * 10 | * Change Logs: 11 | * Date Author Notes 12 | * 2009-01-05 Bernard the first version 13 | */ 14 | 15 | #ifndef __USART_H__ 16 | #define __USART_H__ 17 | 18 | #include 19 | #include 20 | 21 | #define UART_ENABLE_IRQ(n) NVIC_EnableIRQ((n)) 22 | #define UART_DISABLE_IRQ(n) NVIC_DisableIRQ((n)) 23 | 24 | int stm32_hw_usart_init(void); 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /demos/os/ucosii/stm32f10x/EWARM/.gitignore: -------------------------------------------------------------------------------- 1 | /stm32f103xB 2 | /stm32f103xE 3 | /Debug 4 | /Release 5 | /settings/*.dbgdt 6 | /settings/*.dni 7 | /settings/*.bat 8 | /settings/*.xcl 9 | /settings/*.wsdt 10 | /settings/*.jlink 11 | *.dep 12 | *.ewd 13 | -------------------------------------------------------------------------------- /demos/os/ucosii/stm32f10x/EWARM/CmBacktrace.eww: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | $WS_DIR$\CmBacktrace.ewp 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /demos/os/ucosii/stm32f10x/EWARM/settings/CmBacktrace.crun: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1 5 | 6 | 7 | * 8 | * 9 | * 10 | 0 11 | 1 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /demos/os/ucosii/stm32f10x/EWARM/settings/CmBacktrace.wspos: -------------------------------------------------------------------------------- 1 | [MainWindow] 2 | WindowPlacement=_ 210 137 1470 874 3 3 | -------------------------------------------------------------------------------- /demos/os/ucosii/stm32f10x/Libraries/CMSIS_EWARM/CM3/DeviceSupport/ST/STM32F10x/stm32f10x.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/CmBacktrace/4bec5c8a6c4ac65310174bf13ceb57830dd2d3f3/demos/os/ucosii/stm32f10x/Libraries/CMSIS_EWARM/CM3/DeviceSupport/ST/STM32F10x/stm32f10x.h -------------------------------------------------------------------------------- /demos/os/ucosii/stm32f10x/Libraries/CMSIS_EWARM/CM3/DeviceSupport/ST/STM32F10x/system_stm32f10x.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file system_stm32f10x.h 4 | * @author MCD Application Team 5 | * @version V3.5.0 6 | * @date 11-March-2011 7 | * @brief CMSIS Cortex-M3 Device Peripheral Access Layer System Header File. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 17 | * 18 | *

© COPYRIGHT 2011 STMicroelectronics

19 | ****************************************************************************** 20 | */ 21 | 22 | /** @addtogroup CMSIS 23 | * @{ 24 | */ 25 | 26 | /** @addtogroup stm32f10x_system 27 | * @{ 28 | */ 29 | 30 | /** 31 | * @brief Define to prevent recursive inclusion 32 | */ 33 | #ifndef __SYSTEM_STM32F10X_H 34 | #define __SYSTEM_STM32F10X_H 35 | 36 | #ifdef __cplusplus 37 | extern "C" { 38 | #endif 39 | 40 | /** @addtogroup STM32F10x_System_Includes 41 | * @{ 42 | */ 43 | 44 | /** 45 | * @} 46 | */ 47 | 48 | 49 | /** @addtogroup STM32F10x_System_Exported_types 50 | * @{ 51 | */ 52 | 53 | extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */ 54 | 55 | /** 56 | * @} 57 | */ 58 | 59 | /** @addtogroup STM32F10x_System_Exported_Constants 60 | * @{ 61 | */ 62 | 63 | /** 64 | * @} 65 | */ 66 | 67 | /** @addtogroup STM32F10x_System_Exported_Macros 68 | * @{ 69 | */ 70 | 71 | /** 72 | * @} 73 | */ 74 | 75 | /** @addtogroup STM32F10x_System_Exported_Functions 76 | * @{ 77 | */ 78 | 79 | extern void SystemInit(void); 80 | extern void SystemCoreClockUpdate(void); 81 | /** 82 | * @} 83 | */ 84 | 85 | #ifdef __cplusplus 86 | } 87 | #endif 88 | 89 | #endif /*__SYSTEM_STM32F10X_H */ 90 | 91 | /** 92 | * @} 93 | */ 94 | 95 | /** 96 | * @} 97 | */ 98 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 99 | -------------------------------------------------------------------------------- /demos/os/ucosii/stm32f10x/Libraries/CMSIS_EWARM/CMSIS END USER LICENCE AGREEMENT.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/CmBacktrace/4bec5c8a6c4ac65310174bf13ceb57830dd2d3f3/demos/os/ucosii/stm32f10x/Libraries/CMSIS_EWARM/CMSIS END USER LICENCE AGREEMENT.pdf -------------------------------------------------------------------------------- /demos/os/ucosii/stm32f10x/Libraries/CMSIS_EWARM/CMSIS debug support.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/CmBacktrace/4bec5c8a6c4ac65310174bf13ceb57830dd2d3f3/demos/os/ucosii/stm32f10x/Libraries/CMSIS_EWARM/CMSIS debug support.htm -------------------------------------------------------------------------------- /demos/os/ucosii/stm32f10x/Libraries/CMSIS_EWARM/Documentation/CMSIS_Core.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/CmBacktrace/4bec5c8a6c4ac65310174bf13ceb57830dd2d3f3/demos/os/ucosii/stm32f10x/Libraries/CMSIS_EWARM/Documentation/CMSIS_Core.htm -------------------------------------------------------------------------------- /demos/os/ucosii/stm32f10x/Libraries/CMSIS_EWARM/Include/arm_common_tables.h: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Copyright (C) 2010 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 11. November 2010 5 | * $Revision: V1.0.2 6 | * 7 | * Project: CMSIS DSP Library 8 | * Title: arm_common_tables.h 9 | * 10 | * Description: This file has extern declaration for common tables like Bitreverse, reciprocal etc which are used across different functions 11 | * 12 | * Target Processor: Cortex-M4/Cortex-M3 13 | * 14 | * Version 1.0.2 2010/11/11 15 | * Documentation updated. 16 | * 17 | * Version 1.0.1 2010/10/05 18 | * Production release and review comments incorporated. 19 | * 20 | * Version 1.0.0 2010/09/20 21 | * Production release and review comments incorporated. 22 | * -------------------------------------------------------------------- */ 23 | 24 | #ifndef _ARM_COMMON_TABLES_H 25 | #define _ARM_COMMON_TABLES_H 26 | 27 | #include "arm_math.h" 28 | 29 | extern const uint16_t armBitRevTable[1024]; 30 | extern const q15_t armRecipTableQ15[64]; 31 | extern const q31_t armRecipTableQ31[64]; 32 | extern const q31_t realCoefAQ31[1024]; 33 | extern const q31_t realCoefBQ31[1024]; 34 | extern const float32_t twiddleCoef[6144]; 35 | extern const q31_t twiddleCoefQ31[6144]; 36 | extern const q15_t twiddleCoefQ15[6144]; 37 | 38 | #endif /* ARM_COMMON_TABLES_H */ 39 | -------------------------------------------------------------------------------- /demos/os/ucosii/stm32f10x/Libraries/CMSIS_EWARM/License.doc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/CmBacktrace/4bec5c8a6c4ac65310174bf13ceb57830dd2d3f3/demos/os/ucosii/stm32f10x/Libraries/CMSIS_EWARM/License.doc -------------------------------------------------------------------------------- /demos/os/ucosii/stm32f10x/Libraries/CMSIS_EWARM/README.txt: -------------------------------------------------------------------------------- 1 | * ------------------------------------------------------------------- 2 | * Copyright (C) 2011-2012 ARM Limited. All rights reserved. 3 | * 4 | * Date: 07 March 2012 5 | * Revision: V3.01 6 | * 7 | * Project: Cortex Microcontroller Software Interface Standard (CMSIS) 8 | * Title: Release Note for CMSIS 9 | * 10 | * ------------------------------------------------------------------- 11 | 12 | 13 | NOTE - Open the index.html file to access CMSIS documentation 14 | 15 | 16 | The Cortex Microcontroller Software Interface Standard (CMSIS) provides a single standard across all 17 | Cortex-Mx processor series vendors. It enables code re-use and code sharing across software projects 18 | and reduces time-to-market for new embedded applications. 19 | 20 | CMSIS is released under the terms of the end user license agreement ("CMSIS END USER LICENCE AGREEMENT.pdf"). 21 | Any user of the software package is bound to the terms and conditions of the end user license agreement. 22 | 23 | 24 | You will find the following sub-directories: 25 | 26 | Documentation - Contains CMSIS documentation. 27 | 28 | DSP_Lib - MDK project files, Examples and source files etc.. to build the 29 | CMSIS DSP Software Library for Cortex-M0, Cortex-M3, Cortex-M4 processors. 30 | 31 | Include - CMSIS Core Support and CMSIS DSP Include Files. 32 | 33 | Lib - CMSIS DSP Libraries. 34 | 35 | RTOS - CMSIS RTOS API template header file. 36 | 37 | SVD - CMSIS SVD Schema files and Conversion Utility. 38 | -------------------------------------------------------------------------------- /demos/os/ucosii/stm32f10x/Libraries/CMSIS_EWARM/index.htm: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Redirect to the CMSIS main page after 0 seconds 5 | 6 | 7 | 8 | 9 | 10 | 11 | If the automatic redirection is failing, click open CMSIS Documentation. 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /demos/os/ucosii/stm32f10x/Libraries/CMSIS_EWARM/readme_patch.txt: -------------------------------------------------------------------------------- 1 | No CMSIS patch is included in this version. 2 | -------------------------------------------------------------------------------- /demos/os/ucosii/stm32f10x/Libraries/CMSIS_RVMDK/CM3/DeviceSupport/ST/STM32F10x/stm32f10x.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/CmBacktrace/4bec5c8a6c4ac65310174bf13ceb57830dd2d3f3/demos/os/ucosii/stm32f10x/Libraries/CMSIS_RVMDK/CM3/DeviceSupport/ST/STM32F10x/stm32f10x.h -------------------------------------------------------------------------------- /demos/os/ucosii/stm32f10x/Libraries/CMSIS_RVMDK/CM3/DeviceSupport/ST/STM32F10x/system_stm32f10x.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file system_stm32f10x.h 4 | * @author MCD Application Team 5 | * @version V3.5.0 6 | * @date 11-March-2011 7 | * @brief CMSIS Cortex-M3 Device Peripheral Access Layer System Header File. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 17 | * 18 | *

© COPYRIGHT 2011 STMicroelectronics

19 | ****************************************************************************** 20 | */ 21 | 22 | /** @addtogroup CMSIS 23 | * @{ 24 | */ 25 | 26 | /** @addtogroup stm32f10x_system 27 | * @{ 28 | */ 29 | 30 | /** 31 | * @brief Define to prevent recursive inclusion 32 | */ 33 | #ifndef __SYSTEM_STM32F10X_H 34 | #define __SYSTEM_STM32F10X_H 35 | 36 | #ifdef __cplusplus 37 | extern "C" { 38 | #endif 39 | 40 | /** @addtogroup STM32F10x_System_Includes 41 | * @{ 42 | */ 43 | 44 | /** 45 | * @} 46 | */ 47 | 48 | 49 | /** @addtogroup STM32F10x_System_Exported_types 50 | * @{ 51 | */ 52 | 53 | extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */ 54 | 55 | /** 56 | * @} 57 | */ 58 | 59 | /** @addtogroup STM32F10x_System_Exported_Constants 60 | * @{ 61 | */ 62 | 63 | /** 64 | * @} 65 | */ 66 | 67 | /** @addtogroup STM32F10x_System_Exported_Macros 68 | * @{ 69 | */ 70 | 71 | /** 72 | * @} 73 | */ 74 | 75 | /** @addtogroup STM32F10x_System_Exported_Functions 76 | * @{ 77 | */ 78 | 79 | extern void SystemInit(void); 80 | extern void SystemCoreClockUpdate(void); 81 | /** 82 | * @} 83 | */ 84 | 85 | #ifdef __cplusplus 86 | } 87 | #endif 88 | 89 | #endif /*__SYSTEM_STM32F10X_H */ 90 | 91 | /** 92 | * @} 93 | */ 94 | 95 | /** 96 | * @} 97 | */ 98 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 99 | -------------------------------------------------------------------------------- /demos/os/ucosii/stm32f10x/Libraries/CMSIS_RVMDK/CMSIS debug support.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/CmBacktrace/4bec5c8a6c4ac65310174bf13ceb57830dd2d3f3/demos/os/ucosii/stm32f10x/Libraries/CMSIS_RVMDK/CMSIS debug support.htm -------------------------------------------------------------------------------- /demos/os/ucosii/stm32f10x/Libraries/CMSIS_RVMDK/Documentation/CMSIS_Core.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/CmBacktrace/4bec5c8a6c4ac65310174bf13ceb57830dd2d3f3/demos/os/ucosii/stm32f10x/Libraries/CMSIS_RVMDK/Documentation/CMSIS_Core.htm -------------------------------------------------------------------------------- /demos/os/ucosii/stm32f10x/Libraries/CMSIS_RVMDK/License.doc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/CmBacktrace/4bec5c8a6c4ac65310174bf13ceb57830dd2d3f3/demos/os/ucosii/stm32f10x/Libraries/CMSIS_RVMDK/License.doc -------------------------------------------------------------------------------- /demos/os/ucosii/stm32f10x/Libraries/SConscript: -------------------------------------------------------------------------------- 1 | import rtconfig 2 | Import('RTT_ROOT') 3 | from building import * 4 | 5 | # get current directory 6 | cwd = GetCurrentDir() 7 | 8 | # The set of source files associated with this SConscript file. 9 | src = Split(""" 10 | CMSIS/CM3/CoreSupport/core_cm3.c 11 | CMSIS/CM3/DeviceSupport/ST/STM32F10x/system_stm32f10x.c 12 | STM32F10x_StdPeriph_Driver/src/stm32f10x_crc.c 13 | STM32F10x_StdPeriph_Driver/src/stm32f10x_rcc.c 14 | STM32F10x_StdPeriph_Driver/src/stm32f10x_wwdg.c 15 | STM32F10x_StdPeriph_Driver/src/stm32f10x_pwr.c 16 | STM32F10x_StdPeriph_Driver/src/stm32f10x_exti.c 17 | STM32F10x_StdPeriph_Driver/src/stm32f10x_bkp.c 18 | STM32F10x_StdPeriph_Driver/src/stm32f10x_i2c.c 19 | STM32F10x_StdPeriph_Driver/src/stm32f10x_adc.c 20 | STM32F10x_StdPeriph_Driver/src/stm32f10x_dac.c 21 | STM32F10x_StdPeriph_Driver/src/stm32f10x_rtc.c 22 | STM32F10x_StdPeriph_Driver/src/stm32f10x_fsmc.c 23 | STM32F10x_StdPeriph_Driver/src/stm32f10x_tim.c 24 | STM32F10x_StdPeriph_Driver/src/stm32f10x_iwdg.c 25 | STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c 26 | STM32F10x_StdPeriph_Driver/src/stm32f10x_flash.c 27 | STM32F10x_StdPeriph_Driver/src/stm32f10x_sdio.c 28 | STM32F10x_StdPeriph_Driver/src/stm32f10x_gpio.c 29 | STM32F10x_StdPeriph_Driver/src/stm32f10x_usart.c 30 | STM32F10x_StdPeriph_Driver/src/stm32f10x_dbgmcu.c 31 | STM32F10x_StdPeriph_Driver/src/stm32f10x_dma.c 32 | STM32F10x_StdPeriph_Driver/src/stm32f10x_can.c 33 | STM32F10x_StdPeriph_Driver/src/stm32f10x_cec.c 34 | STM32F10x_StdPeriph_Driver/src/misc.c 35 | """) 36 | 37 | # starupt scripts for each STM32 kind 38 | startup_scripts = {} 39 | startup_scripts['STM32F10X_CL'] = 'startup_stm32f10x_cl.s' 40 | startup_scripts['STM32F10X_HD'] = 'startup_stm32f10x_hd.s' 41 | startup_scripts['STM32F10X_HD_VL'] = 'startup_stm32f10x_hd_vl.s' 42 | startup_scripts['STM32F10X_LD'] = 'startup_stm32f10x_ld.s' 43 | startup_scripts['STM32F10X_LD_VL'] = 'startup_stm32f10x_ld_vl.s' 44 | startup_scripts['STM32F10X_MD'] = 'startup_stm32f10x_md.s' 45 | startup_scripts['STM32F10X_MD_VL'] = 'startup_stm32f10x_md_vl.s' 46 | startup_scripts['STM32F10X_XL'] = 'startup_stm32f10x_xl.s' 47 | 48 | # add for startup script 49 | if rtconfig.CROSS_TOOL == 'gcc': 50 | src = src + ['CMSIS/CM3/DeviceSupport/ST/STM32F10x/startup/gcc_ride7/' + startup_scripts[rtconfig.STM32_TYPE]] 51 | elif rtconfig.CROSS_TOOL == 'keil': 52 | src = src + ['CMSIS/CM3/DeviceSupport/ST/STM32F10x/startup/arm/' + startup_scripts[rtconfig.STM32_TYPE]] 53 | elif rtconfig.CROSS_TOOL == 'iar': 54 | src = src + ['CMSIS/CM3/DeviceSupport/ST/STM32F10x/startup/iar/' + startup_scripts[rtconfig.STM32_TYPE]] 55 | 56 | path = [cwd + '/STM32F10x_StdPeriph_Driver/inc', 57 | cwd + '/CMSIS/CM3/CoreSupport', 58 | cwd + '/CMSIS/CM3/DeviceSupport/ST/STM32F10x'] 59 | 60 | CPPDEFINES = ['USE_STDPERIPH_DRIVER', rtconfig.STM32_TYPE] 61 | group = DefineGroup('STM32_StdPeriph', src, depend = [''], CPPPATH = path, CPPDEFINES = CPPDEFINES) 62 | 63 | Return('group') 64 | -------------------------------------------------------------------------------- /demos/os/ucosii/stm32f10x/Libraries/STM32F10x_StdPeriph_Driver/inc/stm32f10x_crc.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_crc.h 4 | * @author MCD Application Team 5 | * @version V3.5.0 6 | * @date 11-March-2011 7 | * @brief This file contains all the functions prototypes for the CRC firmware 8 | * library. 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 13 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 14 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 15 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 16 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 17 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 18 | * 19 | *

© COPYRIGHT 2011 STMicroelectronics

20 | ****************************************************************************** 21 | */ 22 | 23 | /* Define to prevent recursive inclusion -------------------------------------*/ 24 | #ifndef __STM32F10x_CRC_H 25 | #define __STM32F10x_CRC_H 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | /* Includes ------------------------------------------------------------------*/ 32 | #include "stm32f10x.h" 33 | 34 | /** @addtogroup STM32F10x_StdPeriph_Driver 35 | * @{ 36 | */ 37 | 38 | /** @addtogroup CRC 39 | * @{ 40 | */ 41 | 42 | /** @defgroup CRC_Exported_Types 43 | * @{ 44 | */ 45 | 46 | /** 47 | * @} 48 | */ 49 | 50 | /** @defgroup CRC_Exported_Constants 51 | * @{ 52 | */ 53 | 54 | /** 55 | * @} 56 | */ 57 | 58 | /** @defgroup CRC_Exported_Macros 59 | * @{ 60 | */ 61 | 62 | /** 63 | * @} 64 | */ 65 | 66 | /** @defgroup CRC_Exported_Functions 67 | * @{ 68 | */ 69 | 70 | void CRC_ResetDR(void); 71 | uint32_t CRC_CalcCRC(uint32_t Data); 72 | uint32_t CRC_CalcBlockCRC(uint32_t pBuffer[], uint32_t BufferLength); 73 | uint32_t CRC_GetCRC(void); 74 | void CRC_SetIDRegister(uint8_t IDValue); 75 | uint8_t CRC_GetIDRegister(void); 76 | 77 | #ifdef __cplusplus 78 | } 79 | #endif 80 | 81 | #endif /* __STM32F10x_CRC_H */ 82 | /** 83 | * @} 84 | */ 85 | 86 | /** 87 | * @} 88 | */ 89 | 90 | /** 91 | * @} 92 | */ 93 | 94 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 95 | -------------------------------------------------------------------------------- /demos/os/ucosii/stm32f10x/Libraries/STM32F10x_StdPeriph_Driver/src/stm32f10x_flash.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/CmBacktrace/4bec5c8a6c4ac65310174bf13ceb57830dd2d3f3/demos/os/ucosii/stm32f10x/Libraries/STM32F10x_StdPeriph_Driver/src/stm32f10x_flash.c -------------------------------------------------------------------------------- /demos/os/ucosii/stm32f10x/Libraries/STM32F10x_StdPeriph_Driver/src/stm32f10x_i2c.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/CmBacktrace/4bec5c8a6c4ac65310174bf13ceb57830dd2d3f3/demos/os/ucosii/stm32f10x/Libraries/STM32F10x_StdPeriph_Driver/src/stm32f10x_i2c.c -------------------------------------------------------------------------------- /demos/os/ucosii/stm32f10x/Libraries/STM32F10x_StdPeriph_Driver/src/stm32f10x_usart.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/CmBacktrace/4bec5c8a6c4ac65310174bf13ceb57830dd2d3f3/demos/os/ucosii/stm32f10x/Libraries/STM32F10x_StdPeriph_Driver/src/stm32f10x_usart.c -------------------------------------------------------------------------------- /demos/os/ucosii/stm32f10x/README.md: -------------------------------------------------------------------------------- 1 | # stm32f10x UCOSII Demo 2 | 3 | ## STEP 1 4 | 5 | 文件夹 `RVMDK` 下为 Keil 工程,`EMARM` 下为 IAR 工程。打开工程后,在 `app/src/app.c` 中有 `fault_test_by_unalign()` 及 `fault_test_by_div0()` 两个 HardFault 测试函数,可以选择性的执行测试函数。 6 | 7 | ## STEP 2 8 | 9 | 将程序下载至开发板,并将其串口1 与电脑串口连接。 10 | 11 | ## STEP 3 12 | 13 | 电脑上打开该串口,串口配置 115200 8 1 N ,给开发板上电,即可看到类似如下的输出信息,故障原因也已被准确的诊断出来: 14 | 15 | ``` 16 | Firmware name: CmBacktrace, hardware version: V1.0.0, software version: V0.1.0 17 | Fault on thread app_start 18 | ===== Thread stack information ===== 19 | addr: 200024d8 data: 03030303 20 | addr: 200024dc data: 00000000 21 | addr: 200024e0 data: 05050505 22 | addr: 200024e4 data: 06060606 23 | addr: 200024e8 data: 07070707 24 | addr: 200024ec data: 08000195 25 | addr: 200024f0 data: 04040404 26 | addr: 200024f4 data: 08001c99 27 | ==================================== 28 | =================== Registers information ==================== 29 | R0 : 00000000 R1 : 01010101 R2 : 02020202 R3 : 03030303 30 | R12: 12121212 LR : 08000195 PC : 08001d24 PSR: 41000000 31 | ============================================================== 32 | Usage fault is caused by Indicates a divide by zero has taken place (can be set only if DIV_0_TRP is set) 33 | Show more call stack info by run: addr2line -e CmBacktrace.out -a -f 08001d24 08000191 08001c95 34 | ``` 35 | 36 | ## STEP 4 37 | 38 | 打开电脑上的命令行工具,进入项目工程的可执行文件所在路径(Keil 一般在 `Output` 下,可执行文件后缀 `.axf`;IAR 一般在 ` Exe` 下,可执行文件后缀 `.out`),将 STEP 3 最后输出的 `addr2line -e CmBacktrace.out -a -f 08001d24 08000191 08001c95` 拷贝至控制台,并执行([点击查看 addr2line 工具的使用教程](https://github.com/armink/CmBacktrace/blob/master/docs/zh/how_to_use_addr2line_for_call_stack.md)),可看到类似如下,包含函数名称及代码行号的函数调用栈信息: 39 | 40 | ``` 41 | D:\Program\STM32\CmBacktrace\demos\os\ucosii\stm32f10x\EWARM\stm32f103xE\Exe>addr2line -e CmBacktrace.out -a -f 08001d24 08000191 08001c95 42 | 0x08001d24 43 | fault_test_by_div0 44 | D:\Program\STM32\CmBacktrace\demos\os\ucosii\stm32f10x\app\src/fault_test.c:38 45 | 0x08000191 46 | AppTaskStart 47 | D:\Program\STM32\CmBacktrace\demos\os\ucosii\stm32f10x\app\src/app.c:49 48 | 0x08001c95 49 | OSTaskSuspend 50 | D:\Program\STM32\CmBacktrace\demos\os\ucosii\stm32f10x\ucosii\Source/os_task.c:1006 51 | 52 | D:\Program\STM32\CmBacktrace\demos\os\ucosii\stm32f10x\EWARM\stm32f103xE\Exe> 53 | ``` 54 | -------------------------------------------------------------------------------- /demos/os/ucosii/stm32f10x/RVMDK/.gitignore: -------------------------------------------------------------------------------- 1 | /Output 2 | *.uvgui.* 3 | 4 | -------------------------------------------------------------------------------- /demos/os/ucosii/stm32f10x/RVMDK/JLink Regs CM3.txt: -------------------------------------------------------------------------------- 1 | 0: R0: 0x00 2 | 1: R1: 0x01 3 | 2: R2: 0x02 4 | 3: R3: 0x03 5 | 4: R4: 0x04 6 | 5: R5: 0x05 7 | 6: R6: 0x06 8 | 7: R7: 0x07 9 | 8: R8: 0x08 10 | 9: R9: 0x09 11 | 10: R10: 0x0a 12 | 11: R11: 0x0b 13 | 12: R12: 0x0c 14 | 13: R13: 0x0d 15 | 14: R14: 0x0e 16 | 15: R15: 0x0f 17 | 16: XPSR: 0x10 18 | 17: MSP: 0x11 19 | 18: PSP: 0x12 20 | 19: RAZ: 0x13 21 | 20: CFBP: 0x14 22 | 21: APSR: 0x15 23 | 22: EPSR: 0x16 24 | 23: IPSR: 0x17 25 | 24: PRIMASK: 0x18 26 | 25: BASEPRI: 0x19 27 | 26: FAULTMASK: 0x1a 28 | 27: CONTROL: 0x1b 29 | 28: BASEPRI_MAX: 0x1c 30 | 29: IAPSR: 0x1d 31 | 30: EAPSR: 0x1e 32 | 31: IEPSR: 0x1f 33 | -------------------------------------------------------------------------------- /demos/os/ucosii/stm32f10x/RVMDK/JLinkSettings.ini: -------------------------------------------------------------------------------- 1 | [FLASH] 2 | SkipProgOnCRCMatch = 1 3 | VerifyDownload = 1 4 | AllowCaching = 1 5 | EnableFlashDL = 2 6 | Override = 0 7 | Device="ADUC7020X62" 8 | [BREAKPOINTS] 9 | ShowInfoWin = 1 10 | EnableFlashBP = 2 11 | BPDuringExecution = 0 12 | [CPU] 13 | OverrideMemMap = 0 14 | AllowSimulation = 1 15 | ScriptFile="" 16 | [SWO] 17 | SWOLogFile="" 18 | -------------------------------------------------------------------------------- /demos/os/ucosii/stm32f10x/app/inc/os_cfg.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/CmBacktrace/4bec5c8a6c4ac65310174bf13ceb57830dd2d3f3/demos/os/ucosii/stm32f10x/app/inc/os_cfg.h -------------------------------------------------------------------------------- /demos/os/ucosii/stm32f10x/app/inc/stm32f10x_it.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file Project/Template/stm32f10x_it.h 4 | * @author MCD Application Team 5 | * @version V3.1.0 6 | * @date 06/19/2009 7 | * @brief This file contains the headers of the interrupt handlers. 8 | ****************************************************************************** 9 | * @copy 10 | * 11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 17 | * 18 | *

© COPYRIGHT 2009 STMicroelectronics

19 | */ 20 | 21 | /* Define to prevent recursive inclusion -------------------------------------*/ 22 | #ifndef __STM32F10x_IT_H 23 | #define __STM32F10x_IT_H 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | /* Includes ------------------------------------------------------------------*/ 30 | 31 | #include "bsp.h" 32 | 33 | /* Exported types ------------------------------------------------------------*/ 34 | /* Exported constants --------------------------------------------------------*/ 35 | /* Exported macro ------------------------------------------------------------*/ 36 | /* Exported functions ------------------------------------------------------- */ 37 | 38 | void NMI_Handler(void); 39 | void HardFault_Handler(void); 40 | void MemManage_Handler(void); 41 | void BusFault_Handler(void); 42 | void UsageFault_Handler(void); 43 | void SVC_Handler(void); 44 | void DebugMon_Handler(void); 45 | void PendSV_Handler(void); 46 | void SysTick_Handler(void); 47 | 48 | #ifdef __cplusplus 49 | } 50 | #endif 51 | 52 | #endif /* __STM32F10x_IT_H */ 53 | 54 | /******************* (C) COPYRIGHT 2009 STMicroelectronics *****END OF FILE****/ 55 | -------------------------------------------------------------------------------- /demos/os/ucosii/stm32f10x/app/src/app.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | #define HARDWARE_VERSION "V1.0.0" 8 | #define SOFTWARE_VERSION "V0.1.0" 9 | 10 | static OS_STK AppTaskStartStk[APP_TASK_START_STK_SIZE]; 11 | 12 | static void AppTaskStart(void *p_arg); 13 | extern void fault_test_by_unalign(void); 14 | extern void fault_test_by_div0(void); 15 | 16 | int main(void) 17 | { 18 | INT8U err; 19 | BSP_IntDisAll(); 20 | BSP_Init(); 21 | CPU_Init(); 22 | OSInit(); 23 | 24 | /* CmBacktrace initialize */ 25 | cm_backtrace_init("CmBacktrace", HARDWARE_VERSION, SOFTWARE_VERSION); 26 | 27 | OSTaskCreateExt((void (*)(void *)) AppTaskStart, 28 | (void *) 0, 29 | (OS_STK *)&AppTaskStartStk[APP_TASK_START_STK_SIZE - 1], 30 | (INT8U ) APP_TASK_START_PRIO, 31 | (INT16U ) APP_TASK_START_PRIO, 32 | (OS_STK *)&AppTaskStartStk[0], 33 | (INT32U ) APP_TASK_START_STK_SIZE, 34 | (void *) 0, 35 | (INT16U )(OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR)); 36 | 37 | OSTaskNameSet(APP_TASK_START_PRIO, "app_start", &err); 38 | 39 | printf("System initialize finish. Starting..\r\n"); 40 | 41 | OSStart(); 42 | 43 | return (1); 44 | } 45 | 46 | static void AppTaskStart (void *p_arg) 47 | { 48 | // fault_test_by_unalign(); 49 | fault_test_by_div0(); 50 | 51 | while (DEF_TRUE) { 52 | LED_RUN_ON; 53 | OSTimeDlyHMSM(0, 0, 0, 500); 54 | LED_RUN_OFF; 55 | OSTimeDlyHMSM(0, 0, 0, 500); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /demos/os/ucosii/stm32f10x/app/src/fault_test.c: -------------------------------------------------------------------------------- 1 | /* 2 | * fault_test.c 3 | * 4 | * Created on: 2016/12/25 5 | * Author: Armink 6 | */ 7 | 8 | #include 9 | 10 | void fault_test_by_unalign(void) { 11 | volatile int * SCB_CCR = (volatile int *) 0xE000ED14; // SCB->CCR 12 | volatile int * p; 13 | volatile int value; 14 | 15 | *SCB_CCR |= (1 << 3); /* bit3: UNALIGN_TRP. */ 16 | 17 | p = (int *) 0x00; 18 | value = *p; 19 | printf("addr:0x%02X value:0x%08X\r\n", (int) p, value); 20 | 21 | p = (int *) 0x04; 22 | value = *p; 23 | printf("addr:0x%02X value:0x%08X\r\n", (int) p, value); 24 | 25 | p = (int *) 0x03; 26 | value = *p; 27 | printf("addr:0x%02X value:0x%08X\r\n", (int) p, value); 28 | } 29 | 30 | void fault_test_by_div0(void) { 31 | volatile int * SCB_CCR = (volatile int *) 0xE000ED14; // SCB->CCR 32 | int x, y, z; 33 | 34 | *SCB_CCR |= (1 << 4); /* bit4: DIV_0_TRP. */ 35 | 36 | x = 10; 37 | y = 0; 38 | z = x / y; 39 | printf("z:%d\n", z); 40 | } 41 | -------------------------------------------------------------------------------- /demos/os/ucosii/stm32f10x/components/cm_backtrace/cmb_cfg.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the CmBacktrace Library. 3 | * 4 | * Copyright (c) 2016, Armink, 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining 7 | * a copy of this software and associated documentation files (the 8 | * 'Software'), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, 10 | * distribute, sublicense, and/or sell copies of the Software, and to 11 | * permit persons to whom the Software is furnished to do so, subject to 12 | * the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 20 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 21 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 22 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 23 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | * 25 | * Function: It is the configure head file for this library. 26 | * Created on: 2016-12-15 27 | */ 28 | 29 | #ifndef _CMB_CFG_H_ 30 | #define _CMB_CFG_H_ 31 | 32 | /* print line, must config by user */ 33 | #define cmb_println(...) printf(__VA_ARGS__);printf("\r\n") 34 | /* enable OS platform */ 35 | #define CMB_USING_OS_PLATFORM 36 | /* OS platform type, must config when CMB_USING_OS_PLATFORM is enable */ 37 | #define CMB_OS_PLATFORM_TYPE CMB_OS_PLATFORM_UCOSII 38 | /* cpu platform type, must config by user */ 39 | #define CMB_CPU_PLATFORM_TYPE CMB_CPU_ARM_CORTEX_M3 40 | /* enable dump stack information */ 41 | #define CMB_USING_DUMP_STACK_INFO 42 | /* language of print information */ 43 | #define CMB_PRINT_LANGUAGE CMB_PRINT_LANGUAGE_ENGLISH 44 | #endif /* _CMB_CFG_H_ */ 45 | -------------------------------------------------------------------------------- /demos/os/ucosii/stm32f10x/components/others/bsp.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/CmBacktrace/4bec5c8a6c4ac65310174bf13ceb57830dd2d3f3/demos/os/ucosii/stm32f10x/components/others/bsp.c -------------------------------------------------------------------------------- /demos/os/ucosii/stm32f10x/components/others/stm32f103xB.icf: -------------------------------------------------------------------------------- 1 | /*###ICF### Section handled by ICF editor, don't touch! ****/ 2 | /*-Editor annotation file-*/ 3 | /* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */ 4 | /*-Specials-*/ 5 | define symbol __ICFEDIT_intvec_start__ = 0x08000000; 6 | /* software version and hardware version store start address */ 7 | define symbol __ICFEDIT_version_start__ = __ICFEDIT_intvec_start__ + 512; 8 | /*-Memory Regions-*/ 9 | define symbol __ICFEDIT_region_ROM_start__ = __ICFEDIT_intvec_start__; 10 | define symbol __ICFEDIT_region_ROM_end__ = 0x0801FFFF; 11 | define symbol __ICFEDIT_region_RAM_start__ = 0x20000000; 12 | define symbol __ICFEDIT_region_RAM_end__ = 0x20004FFF; 13 | /*-Sizes-*/ 14 | define symbol __ICFEDIT_size_cstack__ = 0x800; 15 | define symbol __ICFEDIT_size_heap__ = 0x800; 16 | 17 | /**** End of ICF editor section. ###ICF###*/ 18 | 19 | define memory mem with size = 4G; 20 | define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__]; 21 | define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__]; 22 | 23 | define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { }; 24 | define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { }; 25 | 26 | initialize by copy { readwrite }; 27 | do not initialize { section .noinit }; 28 | 29 | place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec }; 30 | 31 | place in ROM_region { readonly }; 32 | place in RAM_region { readwrite, 33 | block CSTACK, block HEAP }; 34 | 35 | /* armink add for version storage */ 36 | keep { section .version }; 37 | place at address mem:__ICFEDIT_version_start__ { readonly section .version }; 38 | 39 | /* armink add for rtt finsh */ 40 | keep { section FSymTab }; 41 | keep { section VSymTab }; -------------------------------------------------------------------------------- /demos/os/ucosii/stm32f10x/components/others/stm32f103xE.icf: -------------------------------------------------------------------------------- 1 | /*###ICF### Section handled by ICF editor, don't touch! ****/ 2 | /*-Editor annotation file-*/ 3 | /* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */ 4 | /*-Specials-*/ 5 | define symbol __ICFEDIT_intvec_start__ = 0x08000000; 6 | /* software version and hardware version store start address */ 7 | define symbol __ICFEDIT_version_start__ = __ICFEDIT_intvec_start__ + 512; 8 | /*-Memory Regions-*/ 9 | define symbol __ICFEDIT_region_ROM_start__ = __ICFEDIT_intvec_start__; 10 | define symbol __ICFEDIT_region_ROM_end__ = 0x0807FFFF; 11 | define symbol __ICFEDIT_region_RAM_start__ = 0x20000000; 12 | define symbol __ICFEDIT_region_RAM_end__ = 0x2000FFFF; 13 | /*-Sizes-*/ 14 | define symbol __ICFEDIT_size_cstack__ = 0x1000; 15 | define symbol __ICFEDIT_size_heap__ = 0x1000; 16 | 17 | /**** End of ICF editor section. ###ICF###*/ 18 | 19 | define memory mem with size = 4G; 20 | define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__]; 21 | define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__]; 22 | 23 | define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { }; 24 | define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { }; 25 | 26 | initialize by copy { readwrite }; 27 | do not initialize { section .noinit }; 28 | 29 | place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec }; 30 | 31 | place in ROM_region { readonly }; 32 | place in RAM_region { readwrite, 33 | block CSTACK, block HEAP }; 34 | 35 | /* armink add for version storage */ 36 | keep { section .version }; 37 | place at address mem:__ICFEDIT_version_start__ { readonly section .version }; 38 | 39 | /* armink add for rtt finsh */ 40 | keep { section FSymTab }; 41 | keep { section VSymTab }; -------------------------------------------------------------------------------- /demos/os/ucosii/stm32f10x/components/others/types.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef TYPES_H_ 3 | #define TYPES_H_ 4 | 5 | #include 6 | #include 7 | typedef int bool_t; /**< boolean type */ 8 | 9 | #ifndef TRUE 10 | #define TRUE 1 11 | #endif 12 | 13 | #ifndef FALSE 14 | #define FALSE 0 15 | #endif 16 | 17 | #ifndef NULL 18 | #define NULL 0 19 | #endif 20 | 21 | #define success 0 22 | #define fail 1 23 | 24 | 25 | #ifndef disable 26 | #define disable 0 27 | #endif 28 | 29 | #ifndef enable 30 | #define enable 1 31 | #endif 32 | 33 | #endif /* TYPES_H_ */ 34 | -------------------------------------------------------------------------------- /demos/os/ucosii/stm32f10x/ucosii/Source/ucos_ii.c: -------------------------------------------------------------------------------- 1 | /* 2 | ********************************************************************************************************* 3 | * uC/OS-II 4 | * The Real-Time Kernel 5 | * 6 | * (c) Copyright 1992-2012, Micrium, Weston, FL 7 | * All Rights Reserved 8 | * 9 | * File : uCOS_II.C 10 | * By : Jean J. Labrosse 11 | * Version : V2.92.07 12 | * 13 | * LICENSING TERMS: 14 | * --------------- 15 | * uC/OS-II is provided in source form for FREE evaluation, for educational use or for peaceful research. 16 | * If you plan on using uC/OS-II in a commercial product you need to contact Micrium to properly license 17 | * its use in your product. We provide ALL the source code for your convenience and to help you experience 18 | * uC/OS-II. The fact that the source is provided does NOT mean that you can use it without paying a 19 | * licensing fee. 20 | ********************************************************************************************************* 21 | */ 22 | 23 | #define OS_GLOBALS /* Declare GLOBAL variables */ 24 | #include 25 | 26 | 27 | #define OS_MASTER_FILE /* Prevent the following files from including includes.h */ 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | -------------------------------------------------------------------------------- /demos/os/ucosii/stm32f10x/ucosii/uC-LIB/lib_mem.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/CmBacktrace/4bec5c8a6c4ac65310174bf13ceb57830dd2d3f3/demos/os/ucosii/stm32f10x/ucosii/uC-LIB/lib_mem.c -------------------------------------------------------------------------------- /docs/README.md: -------------------------------------------------------------------------------- 1 | |File or folder name |Description| 2 | |:----- |:----| 3 | |en |English documents| 4 | |zh |中文文档(简体)| -------------------------------------------------------------------------------- /docs/zh/enable_c99_for_keil_iar_gcc.md: -------------------------------------------------------------------------------- 1 | # 一步开启 Keil/IAR/GCC 的 C99 支持 2 | 3 | ## 背景 4 | 5 | C99 标准于 1999 年发布,至今(2016-12-28)将近 20 年的时间,相比早期的 C89 ,C99 有如下新特性(摘自 [维基百科](https://zh.wikipedia.org/wiki/C%E8%AF%AD%E8%A8%80#C99)): 6 | 7 | - 增加了对编译器的限制,比如源程序每行要求至少支持到 4095 字节,变量名函数名的要求支持到 63 字节(extern 要求支持到 31)。 8 | - 增强了预处理功能。例如: 9 | - 宏支持取可变参数 #define Macro(...) `__VA_ARGS__` 10 | - 使用宏的时候,允许省略参数,被省略的参数会被扩展成空串。 11 | - 支持 // 开头的单行注释(这个特性实际上在C89的很多编译器上已经被支持了) 12 | - 增加了新关键字 restrict, inline, _Complex, _Imaginary, _Bool 13 | - 支持 long long, long double _Complex, float _Complex 等类型 14 | - 支持不定长的数组,即数组长度可以在运行时决定,比如利用变量作为数组长度。声明时使用 int a[var] 的形式。不过考虑到效率和实现,不定长数组不能用在全局,或 struct 与 union 里。 15 | - 变量声明不必放在语句块的开头,for 语句提倡写成 for(int i=0;i<100;++i) 的形式,即i 只在 for 语句块内部有效。 16 | - 允许采用(type_name){xx,xx,xx} 类似于 C++ 的构造函数的形式构造匿名的结构体。 17 | - 初始化结构的时候允许对特定的元素赋值,形式为: 18 | - `struct test{int a[3],b;} foo[] = { [0].a = {1}, [1].a = 2 };` 19 | - `struct test{int a, b, c, d;} foo = { .a = 1, .c = 3, 4, .b = 5 }; // 3,4 是对 .c,.d 赋值的` 20 | - 格式化字符串中,利用 \u 支持 unicode 的字符。 21 | - 支持 16 进制的浮点数的描述。 22 | - printf scanf 的格式化串增加了对 long long int 类型的支持。 23 | - 浮点数的内部数据描述支持了新标准,可以使用 #pragma 编译器指令指定。 24 | - 除了已有的 `__line__` `__file__` 以外,增加了 `__func__` 得到当前的函数名。 25 | - 允许编译器化简非常数的表达式。 26 | - 修改了 / % 处理负数时的定义,这样可以给出明确的结果,例如在C89中-22 / 7 = -3, -22 % 7 = -1,也可以-22 / 7= -4, -22 % 7 = 6。 而C99中明确为 -22 / 7 = -3, -22 % 7 = -1,只有一种结果。 27 | - 取消了函数返回类型默认为 int 的规定。 28 | - 允许在 struct 的最后定义的数组不指定其长度,写做 [](flexible array member)。 29 | - const const int i 将被当作 const int i 处理。 30 | - 增加和修改了一些标准头文件,比如定义 bool 的 ,定义一些标准长度的 int 的 ,定义复数的 ,定义宽字符的 ,类似于泛型的数学函数 , 浮点数相关的 。 在 增加了 va_copy 用于复制 ... 的参数。 里增加了 struct tmx ,对 struct tm 做了扩展。 31 | - 输入输出对宽字符以及长整数等做了相应的支持。 32 | 33 | > C99 提供了众多的便利,也提高了程序开发的效率,但是一些嵌入式工具链并不是默认开启 C99,接下来将会针对不同的工具链,介绍如何开启 C99 模式。 34 | 35 | ## Keil 4 36 | 37 | ![keil4_enable_c99](https://raw.githubusercontent.com/armink/CmBacktrace/master/docs/zh/images/keil4_enable_c99.jpg) 38 | 39 | ## Keil 5 40 | 41 | ![keil5_enable_c99](https://raw.githubusercontent.com/armink/CmBacktrace/master/docs/zh/images/keil5_enable_c99.jpg) 42 | 43 | ## IAR 44 | 45 | IAR 新建完的工程,默认开启 C99 ,如果工程没有开启,请使用下面的方法 46 | 47 | ![iar_enable_c99](https://raw.githubusercontent.com/armink/CmBacktrace/master/docs/zh/images/iar_enable_c99.png) 48 | 49 | ## GCC 50 | 51 | 在编译配置中增加 `-std=c99` 即可 -------------------------------------------------------------------------------- /docs/zh/how_to_use_addr2line_for_call_stack.md: -------------------------------------------------------------------------------- 1 | # 如何使用 addr2line 工具获取函数调用栈详细信息 2 | 3 | ## addr2line 是什么 4 | 5 | addr2line (它是标准的 [GNU Binutils](https://www.gnu.org/software/binutils/) 中的一部分)是一个可以将指令的地址和可执行映像转换成文件名、函数名和源代码行数的工具。 6 | 7 | ## 如何获得 addr2line 8 | 9 | Linux 系统一般会集成这个工具,本文重点介绍 Windows 系统下如何获取该工具。方法很多,我这里仅介绍两种方式 10 | 11 | - 第一种:安装 MinGW(网上教程很多,自行搜索),安装后在其安装目录的 `bin` 文件夹里会包含 `addr2line.exe` ,此时只用保证环境变量 `path` 中包含该路径即可; 12 | - 第二种(XP 平台除外):在本项目的 `tools` 文件夹中已存放 `addr2line.exe` ,可以将其直接拷贝至 `C:\Windows` 下,或者将 CmBacktrace 仓库的 `tools` 文件夹路径添加至到环境变量 `path` 中,这样都能保证命令行工具能正常使用 `addr2line` 命令。 13 | 14 | ## addr2line 如何使用 15 | 16 | 使用 `addr2line --help` 可以看到如下介绍: 17 | 18 | ``` 19 | $addr2line --help 20 | Usage: addr2line [option(s)] [addr(s)] 21 | Convert addresses into line number/file name pairs. 22 | If no addresses are specified on the command line, they will be read from stdin 23 | The options are: 24 | @ Read options from 25 | -a --addresses Show addresses 26 | -b --target= Set the binary file format 27 | -e --exe= Set the input file name (default is a.out) 28 | -i --inlines Unwind inlined functions 29 | -j --section= Read section-relative offsets instead of addresses 30 | -p --pretty-print Make the output easier to read for humans 31 | -s --basenames Strip directory names 32 | -f --functions Show function names 33 | -C --demangle[=style] Demangle function names 34 | -h --help Display this information 35 | -v --version Display the program's version 36 | 37 | addr2line: supported targets: pe-x86-64 pei-x86-64 pe-bigobj-x86-64 elf64-x86-64 elf64-l1om elf64-k1om pe-i386 pei-i386 elf32-i386 elf64-little elf64-big elf32-little elf32-big plugin srec symbolsrec verilog tekhex binary ihex 38 | Report bugs to 39 | ``` 40 | 41 | 这里常用的是以下参数 42 | 43 | - `-e` :指定可执行映像名称 44 | - `-a` :显示函数地址 45 | - `-f` :显示函数名称 46 | 47 | 例如命令 `addr2line -e CmBacktrace.out -f 08000a60 08000141 0800313f` 将会显示名称为 `CmBacktrace.out` 的可执行映像,在地址为 `08000a60` `08000141` `0800313f` 对应的函数名称及源代码信息。执行结果如下: 48 | 49 | ``` 50 | $addr2line -e CmBacktrace.out -a -f 08000a60 08000141 0800313f 51 | fault_test_by_div0 52 | D:\Program\STM32\CmBacktrace\demo\non_os\stm32f10x\app\src/fault_test.c:38 53 | main 54 | D:\Program\STM32\CmBacktrace\demo\non_os\stm32f10x\app\src/app.c:20 55 | _call_main 56 | ??:? 57 | ``` 58 | 59 | > 更多使用指南,请 [参考官方说明文档](https://sourceware.org/binutils/docs-2.27/binutils/addr2line.html#addr2line) 。 60 | -------------------------------------------------------------------------------- /docs/zh/images/cm_backtrace_demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/CmBacktrace/4bec5c8a6c4ac65310174bf13ceb57830dd2d3f3/docs/zh/images/cm_backtrace_demo.gif -------------------------------------------------------------------------------- /docs/zh/images/demo/CmBacktrace.uga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/CmBacktrace/4bec5c8a6c4ac65310174bf13ceb57830dd2d3f3/docs/zh/images/demo/CmBacktrace.uga -------------------------------------------------------------------------------- /docs/zh/images/demo/call_stack_basic_info.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/CmBacktrace/4bec5c8a6c4ac65310174bf13ceb57830dd2d3f3/docs/zh/images/demo/call_stack_basic_info.png -------------------------------------------------------------------------------- /docs/zh/images/demo/call_stack_details.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/CmBacktrace/4bec5c8a6c4ac65310174bf13ceb57830dd2d3f3/docs/zh/images/demo/call_stack_details.png -------------------------------------------------------------------------------- /docs/zh/images/demo/cd_exe_dir.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/CmBacktrace/4bec5c8a6c4ac65310174bf13ceb57830dd2d3f3/docs/zh/images/demo/cd_exe_dir.png -------------------------------------------------------------------------------- /docs/zh/images/demo/demo_code.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/CmBacktrace/4bec5c8a6c4ac65310174bf13ceb57830dd2d3f3/docs/zh/images/demo/demo_code.png -------------------------------------------------------------------------------- /docs/zh/images/demo/fault_diagnosis.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/CmBacktrace/4bec5c8a6c4ac65310174bf13ceb57830dd2d3f3/docs/zh/images/demo/fault_diagnosis.png -------------------------------------------------------------------------------- /docs/zh/images/demo/paste_cmd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/CmBacktrace/4bec5c8a6c4ac65310174bf13ceb57830dd2d3f3/docs/zh/images/demo/paste_cmd.png -------------------------------------------------------------------------------- /docs/zh/images/iar_enable_c99.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/CmBacktrace/4bec5c8a6c4ac65310174bf13ceb57830dd2d3f3/docs/zh/images/iar_enable_c99.png -------------------------------------------------------------------------------- /docs/zh/images/keil4_enable_c99.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/CmBacktrace/4bec5c8a6c4ac65310174bf13ceb57830dd2d3f3/docs/zh/images/keil4_enable_c99.jpg -------------------------------------------------------------------------------- /docs/zh/images/keil5_enable_c99.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/CmBacktrace/4bec5c8a6c4ac65310174bf13ceb57830dd2d3f3/docs/zh/images/keil5_enable_c99.jpg -------------------------------------------------------------------------------- /tools/addr2line/win32/addr2line.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/CmBacktrace/4bec5c8a6c4ac65310174bf13ceb57830dd2d3f3/tools/addr2line/win32/addr2line.exe -------------------------------------------------------------------------------- /tools/addr2line/win64/addr2line.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/CmBacktrace/4bec5c8a6c4ac65310174bf13ceb57830dd2d3f3/tools/addr2line/win64/addr2line.exe --------------------------------------------------------------------------------