2013-01-21 02:30 AM
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-discovery2013-01-21 02:50 AM
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.
2013-01-21 02:59 AM
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.
2013-01-21 05:56 AM
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!2013-01-21 06:46 AM
This whole thing is not very properly documented, that is true.
Usually, you start by includingstm32fxxx.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. Thestm32fxxx.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.