2011-03-07 02:42 AM
starting STM32
2011-05-17 05:26 AM
Hi!
For me it seems you have mixed the actual V3.3 / V3.4 of the ''STM32F10x Standard Peripherals Library'' with the older one (V2.x). Unfortunately, KEIL suggests to include ''stm32f10x_lib.h'' that supposes the legacy library, but you need to include ''stm32f10x.h'' for the actual version instead and modify ''stm32f10x_conf.h'' that can be found in examples and should be copied into your project directory and properly customized. Read the help file to V3.3/V3.4 and ''Description of Peripheral's driver and CMSIS files'' there to see the structure of the header files to be included.2011-05-17 05:26 AM
Thank you for replay
my problem is how to use the new library version with keil could you explan step by step , please ?2011-05-17 05:26 AM
> could you explan step by step , please ?
http://www.st.com/internet/com/SOFTWARE_RESOURCES/SW_COMPONENT/FIRMWARE/stm32f10x_stdperiph_lib.zip
and unzip it into some directory like ''\KEIL\ARM\INC\ST\STM32F10x_StdPeriph_Lib_V3.4.0'' for example.2011-05-17 05:26 AM
2011-05-17 05:26 AM
2011-05-17 05:26 AM
The definition is to add as a preprocessor symbol in KEIL under ''project options -> C/C++.'' Exactly, the line should contain at least two symbol defines:
USE_STDPERIPH_DRIVER, STM32F10X_CL2011-05-17 05:26 AM
I have found in one of my projects notes, I wrote for myself:
// // 1. The template project from the STM32F peripheral library has relative // paths in the project options, so the enviroment of the project must // be rearranged after the template has been copied into the user // directory structure. Besides, the *.c CMSIS and ST Peripheral // library files in the project file groups must be relinked. // // Another way to add ST Peripheral library is to use // ''\KEIL\ARM\RV31\LIB\ST\STM32F10xR.LIB'' in the project. // // STM32F10xR.LIB - compiled from V3.4 sources! // STM32F10xD.LIB - with debug informations // // 2. Any project for STM32F to include ''stm32f10x.h'': this is the file, // that contains all the CMSIS compatible definitions and includes, // on its turn, the CMSIS ''core_m3.h'' and ''system_device.h'' headers. // The file is refered by every library file! By the way, uVision4 // suggests to include the header named ''stm32f10x_lib.h'' but the // file seems to be obsolete (V2.x against V3.x.x of ''stm32f10x.h'') // although a lot of internet examples include the old file making // it neccessary to edit examples to conform V3.x.x. // #include <stm32f10x.h> // // 3. The ST peripheral library to be used, USE_STDPERIPH_DRIVER should // be defined in the project options for C/C++. In this case the // file ''stm32f10x.h'' refers to some ''stm32f10x_conf.h'', that, on its // turn, is PROJECT SPECIFIC and must be provided by user and - // very important! - must be placed into some directory listed in the // ''include paths'' to be accessible for compiler while processing the // library files. // // Various ''stm32f10x_conf.h'' can be found in the examples: the main // purpose of the header file is to define an assert function. // // As soon as this header file MUST exist, it can include other library // and project specific headers like // suggested in ''stm32f10x_conf.h'', but this approach is optional. // // In general the following paths to set: // // .\;\KEIL\ARM\INC\ST\STM32F10x , where: // // .\ to reach project's ''stm32f10x_conf.h'', // \KEIL\ARM\INC\ST\STM32F10x to reach device and library files *). // // *) The device and library files have been copied together to // this folder from the actual library folder // ''KEIL\ARM\INC\ST\STM32F10x_StdPeriph_Lib_V3.4.0\Libraries'' // for convenience (to keep the paths shorter). // // The path \KEIL\ARM\INC is a default project option and thus // does not need to be set explicitly. // // 4. In the project options for C/C++ the target microcontroller derivate // must be defined, like STM32F10X_MD. Otherwise STM32F10X_XL is a //default. // See ''stm32f10x.h'' for possible definitions. // // NOTE: Be carefull with optimization Level -O3! // The program compiled with it striked to work; but -O2 was OK // // 5. As usual, the proper startup file ''startup_stm32f10x_YY.s'', where YY is // a ST device derivate, must be a component of the project and can be copied // into the user project directory if intended to be modified. The startup // files can be found in the /startup folder deep in the library directory // structure or combined in ''\KEIL\ARM\Startup\ST''. // // 6. Also ''core_cm3.c'' and ''system_stm32f10x.c'' files (see CMSIS rules and // P.2. above) must be a part of the project. The ''system_stm32f10x.c'' file // used to be copied into the user project directory because it will be // mostly modified in the project (like clock settings, etc...). //2011-05-17 05:26 AM