cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F0 discovery example on Coocox

davidouatt08
Associate II
Posted on January 21, 2013 at 11:30

Hello, I newly started working with the stm32f0 discovery board on Coocox. I have downloaded the examples from ST but it doesnt compile. It seems that the linker doesnt find the definition of some types, even if I have included them on my project. 

For exple, I have the following errors:

Test\src\stm32f0_discovery.c:74

:34: error: 'GPIO_Pin_9' undeclared here (not in a function)

Test\src\stm32f0_discovery.c:81

:39: error: 'RCC_AHBPeriph_GPIOA' undeclared here (not in a function)

The problem is that this variables are defined!

Does somebody already had this poblem? Do you have a solution?

Thanks

#stm32f0-discovery
4 REPLIES 4
davidouatt08
Associate II
Posted on January 21, 2013 at 11:50

OK I understand now that Coocox is not like Atollic. I just had to add the drivers headers in the needed files where I had errors.

frankmeyer9
Associate II
Posted on January 21, 2013 at 11:59

It seems that the linker doesnt find the definition of some types, even if I have included them on my project. 

 

For exple, I have the following errors:

 

Test\src\stm32f0_discovery.c:74

:34: error: 'GPIO_Pin_9' undeclared here (not in a function)

 

Test\src\stm32f0_discovery.c:81

:39: error: 'RCC_AHBPeriph_GPIOA' undeclared here (not in a function)

 

It's not the linker, by the way.

But including it in the project is not enough.

Assuming the project is setup correctly otherwise, you probably have forgot to add the preprocessor macro ''USE_STDPERIPH_DRIVER'' to your project settings. That pulls in stm32fxxx_conf.h, which then includes all peripheral driver headers.

davidouatt08
Associate II
Posted on January 21, 2013 at 14:56

Thanks, you are right.

I had included the conf file but everything was commented in the file I downloaded...

Better to do it that way than adding everytime!
frankmeyer9
Associate II
Posted on January 21, 2013 at 15:46

This whole thing is not very properly documented, that is true.

Usually, you start by including

stm32fxxx.h

, which the plain CMSIS header for the specific MCU or MCU family. This is still CMSIS, not ST's peripheral driver code. To get the driver header files included, define the macro as mentioned. The

stm32fxxx.h

file a a section like this near the end:

#ifdef USE_STDPERIPH_DRIVER
#include ''stm32fxxx_conf.h''
#endif

This

*_conf.h

file usually includes all peripheral lib headers. Copy it to your project folder, and adapt it to your needs. Don't know how to do this with Coocox, but since it's Eclipse-based, you could probably stick to Atollic instructions by default.