cancel
Showing results for 
Search instead for 
Did you mean: 

About st peripherial library

mehmetcanbalci
Associate III
Posted on December 18, 2011 at 20:24

Hello,

Im trying to use st standart peripherial libraries. In my project im adding stm32f10x.h file ,and also i uncommented #include ''stm32f10x_rcc.h'' line. There is a question at this point.

When i activate #include ''stm32f10x_rcc.h'' this line ,which file does call #include ''stm32f10x_rcc.c'', I couldnt understand which file is include .c files (stm32f10x_rcc.c).

If i write #include ''stm32f10x_rcc.c in main.c ,without problem i can compile project.

Also there is a template that name is `STM32F10x_StdPeriph_Template` in this template all st driver files added as a group.I couldnt find how they add these .c files to main.c.Because if i add like this way i get this error from each st driver.c files.

..\M3_DENEME\stm32f10x.h(96): error:  #35: #error directive: ''Please select first the target STM32F10x device used in your application (in stm32f10x.h file)''
5 REPLIES 5
Posted on December 18, 2011 at 23:31

You don't mention your IDE toolchain, which would help for specific advice.

Generally projects contain metadata including directories, options, and defines to be passing the compiler and linker. Look at the top-level, and file-level options associated with source files. Use the template as a reference, and until you are more familiar with the toolchain consider cloning the project, and then adding/removing files you need or create.

You normally add source files to the project groups, not as #include's

You normally define the CPU and oscillator speeds as part of the initial project definition/wizard.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
mehmetcanbalci
Associate III
Posted on December 19, 2011 at 05:29

im using keil uvision4.

When i add drivers.c files to project as another group, keil is trying to compile them. And giving error message that i wrote in my first message .

Also i couldnt find any include command for st_driver.c files.

 i just add stm32f10x.h file  and it ask about another .h files

.i put stm32f4xx_conf.h file in my project folder and uncomment some unnecessary driver files include lines. For remaining (uncommented drivers) ones compiler adding dirver.h files but .c files are not coming automatically.

Because i couldnt find any include associated with .c files.Which part of project is calling driver .c files to main program in template for keil?i have same problem also with stm32f4xx_conf.c file . stm32f4xx_conf.h file is not callling stm32f4xx_conf.c file because there is not any include which is including stm32f4xx_conf.c file.

rosarium
Associate II
Posted on December 19, 2011 at 07:38

Did you set all the preprocessor path in the project option setting???

mehmetcanbalci
Associate III
Posted on December 20, 2011 at 19:26

Do you mean include paths?

Posted on December 20, 2011 at 21:27

Do you mean include paths?

Yes, I think he does.

You'll have to make sure you specify any/all paths for include files outside of the main project directory.

You also have to have a group within your project into which you add all of the library source files you plan on using, at least with V3.x.x, as they aren't magically pulled in by using ''#include foo.h'' which just provides the prototyping.

If you have an Example/Template project and that is building properly, then analyze it very carefully, both the group/tree structure, what files/paths it is using, and options associated with them.

If you don't want to read the tool chain documentation thoroughly, or are not sufficiently familiar with all the nuances of building a successful project file from scratch, then start by cloning one that does work.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..