我买的STM32的神舟三号开发板 用的里面的例子 做流水灯实验 但是自己按照它的那个做为什么不好使呢?
自己做的总是运行不了 最后删除了几个启动文件只留下 startup_stm32f10x_cl.s 最终可以运行了 但是想不明白为什么例程的全部都有就能运行?
这个是自己做的
看一下库文件里面的此份文件《stm32f10x_stdperiph_lib_um.chm》。
对于启动文件需要根据实际的芯片来选择,如果是大容量的则选择“startup_stm32f10x_hd.s”,例程能够正常是因为有相应的文件中有预处理程序。
How to use the Standard Peripherals Library
Create a project and setup all your toolchain's start-up files (or use the template project provided within the Library, under
Project\STM32F10x_StdPeriph_Template)
Select the corresponding startup file depending of the used device:
- startup_stm32f10x_ld_vl.s: for STM32 Low density Value line devices
- startup_stm32f10x_ld.s: for STM32 Low density devices
- startup_stm32f10x_md_vl.s: for STM32 Medium density Value line devices
- startup_stm32f10x_md.s: for STM32 Medium density devices
- startup_stm32f10x_hd.s: for STM32 High density devices
- startup_stm32f10x_xl.s: for STM32 XL density devices
- startup_stm32f10x_cl.s: for STM32 Connectivity line devices
The Library entry point is stm32f10x.h (under Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x), user has to include it in the application main and configure it:
Select the target product family to be used, comment/uncomment the right define:
#if !defined (STM32F10X_LD) && !defined (STM32F10X_LD_VL) && !defined (STM32F10X_MD) && !defined (STM32F10X_MD_VL) && !defined (STM32F10X_HD) && !defined (STM32F10X_XL) && !defined (STM32F10X_CL)
/* #define STM32F10X_LD */ /*!< STM32F10X_LD: STM32 Low density devices */
/* #define STM32F10X_LD_VL */ /*!< STM32F10X_LD_VL: STM32 Low density Value Line devices */
/* #define STM32F10X_MD */ /*!< STM32F10X_MD: STM32 Medium density devices */
/* #define STM32F10X_MD_VL */ /*!< STM32F10X_MD_VL: STM32 Medium density Value Line devices */
/* #define STM32F10X_HD */ /*!< STM32F10X_HD: STM32 High density devices */
#define STM32F10X_XL /*!< STM32F10X_CL: STM32 XL-density devices */
/* #define STM32F10X_CL */ /*!< STM32F10X_CL: STM32 Connectivity line devices */
#endif
Then user has the choice to use or not the Peripheral’s Drivers
- Case1: application code based on Standard Peripheral’s drivers API (files under Libraries\STM32F10x_StdPeriph_Driver)
- Uncomment #define USE_PERIPH_LIBRARY (default)
- In stm32f10x_conf.h file, select the peripherals to include their header file
- Use Peripheral’s drivers API to build the application; refer to next section for more information.
- In addition to the Peripheral’s drivers you can reuse/adapt the rich set of examples available within the Library to speed
your development, this allow you to started within few hours. Refer to the complete list of available examples
- Case2: application code based on Peripheral’s registers direct access
- Comment #define USE_PERIPH_LIBRARY
- Use Peripheral’s registers structure and bits definition available within stm32f10x.h to build the application
Add the system_stm32f10x.c (under Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x) file in your application, this file provide functions to setup the STM32 system: configure the PLL, system clock and initialize the Embedded Flash Interface. This file provides multiple choice for the system clock frequency, you can selected the frequency needed for your application from the list below (common frequencies that covers the major of the applications):
#if defined (STM32F10X_LD_VL) || (defined STM32F10X_MD_VL)
/* #define SYSCLK_FREQ_HSE HSE_Value */
#define SYSCLK_FREQ_24MHz 24000000
#else
/* #define SYSCLK_FREQ_HSE HSE_Value */
/* #define SYSCLK_FREQ_24MHz 24000000 */
/* #define SYSCLK_FREQ_36MHz 36000000 */
/* #define SYSCLK_FREQ_48MHz 48000000 */
/* #define SYSCLK_FREQ_56MHz 56000000 */
#define SYSCLK_FREQ_72MHz 72000000
#endif
Note: The System clock configuration functions provided within this file assume that:
- For Low-density Value line, Low-density, Medium-density Value line, Medium-density and High-density devices an external 8MHz crystal is used to drive the System clock.
- For Connectivity line devices an external 25MHz crystal is used to drive the System clock.
If you are using different crystal you have to change the value of the define HSE_VALUE in stm32f10x.h file and adapt those functions
accordingly.
温馨提示:内容为网友见解,仅供参考
第1个回答 2011-12-26
这个块板子的例程程序基本都是使用库函数的,你要看下使用到什么库函数了,将相关文件包含进去就可以了。本回答被提问者采纳
第2个回答 2011-12-21
这板子很垃圾,技术支持根本不会回答你任何问题,忘同志们引以为戒
Warning: Invalid argument supplied for foreach() in /www/wwwroot/aolonic.com/skin/templets/default/contents.html on line 45
相似回答