Hello,
when compiling the stm32f4xx_discovery demo I run into the following error:
..\..\ChibiOS_2.6.1\demos\ARMCM4-STM32F407-DISCOVERY\main.c:86:3: error: 'GPIO_TypeDef' undeclared here (not in a function)
The corresponding code is:
static const SPIConfig spi2cfg = {
spicb,
/* HW dependent part.*/
GPIOB,
12,
SPI_CR1_DFF
};
Include path to the stm32f4xx.h is set up.
The error is linked to the "GPIOB" part.
When looking up SPIConfig the stuct definition of 2.6 does not tell enything beyond the "spicb" part whereas the 2.5.x definition includes the pin parts after the spicb.
What is the problem here?
Configuration: Win8.1, Eclipse Kepler, Cross GCC toolchain, building via CDT (not make). Sources and includes are set up, options setup according to Makefile.
rgds
Error "'GPIO_TypeDef' undeclared here" in main.c
Moderator: RoccoMarco
-
friedrich.janus
- Posts: 8
- Joined: Sat Dec 28, 2013 2:47 pm
- Giovanni
- Site Admin
- Posts: 14892
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: Error "'GPIO_TypeDef' undeclared here" in main.c
The demo compiles correctly here, probably you are pointing to an unpatched stm32f4xx.h OR some required files are not in the inclusion paths.
If in doubt try compiling the demo simply giving a command "make".
Giovanni
If in doubt try compiling the demo simply giving a command "make".
Giovanni
-
friedrich.janus
- Posts: 8
- Joined: Sat Dec 28, 2013 2:47 pm
Re: Error "'GPIO_TypeDef' undeclared here" in main.c
Hello Giovanni,
What do you mean by "unpatched stm32f4xx.h"?
The stm32f4xx.h is in originally delivered state as comes from the demo, nothing changed in the demo, the path "ChibiOS_2.6.1\os\hal\platforms\STM32F4xx" is in the include path definitions, a further "include stm32f4xx.h" in main.c does not help.
What do you mean by "unpatched stm32f4xx.h"?
The stm32f4xx.h is in originally delivered state as comes from the demo, nothing changed in the demo, the path "ChibiOS_2.6.1\os\hal\platforms\STM32F4xx" is in the include path definitions, a further "include stm32f4xx.h" in main.c does not help.
- Giovanni
- Site Admin
- Posts: 14892
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: Error "'GPIO_TypeDef' undeclared here" in main.c
If the file is the delivered one then the problem is in the project setup. Please verify the project using the provided makefiles. There are also the Eclipse project files, you may just import the project as-is. You need to create a global workspace variable CHIBIOS pointing to your ChibiOS root.
Giovanni
Giovanni
-
friedrich.janus
- Posts: 8
- Joined: Sat Dec 28, 2013 2:47 pm
Re: Error "'GPIO_TypeDef' undeclared here" in main.c
Hi Giovanni,
thus far many thanks for your help.
Yes - I set up a completely new Eclipse project NOT using the Makefile.
From the previous error of SPIConfig I learned that there are different definitions of SPIConfig. One in os/hal/templates/spi_lld.h and others in os/hal/platforms/STM32/SPIv1 and /SPIv2. To a newbie it is not apparent which one to use and there are no hints in the documentation. But I looked into the include pathes of the makefile and found out that the template pathes nowhere were included so I started from scratch with the source include plathes using only pathes that were also used in the makefile.
So far I was successful to compile all sources with the exception to the following errors:
undefined reference to `__heap_end__'.
I understand that these are resolved thorugh the linker script (preferrably the os\ports\GCC\ARMCMx\STM32F4xx\ld\STM32F407xG.ld). But how to tell the compiler how to react to the undefined references?
rgds
thus far many thanks for your help.
Yes - I set up a completely new Eclipse project NOT using the Makefile.
From the previous error of SPIConfig I learned that there are different definitions of SPIConfig. One in os/hal/templates/spi_lld.h and others in os/hal/platforms/STM32/SPIv1 and /SPIv2. To a newbie it is not apparent which one to use and there are no hints in the documentation. But I looked into the include pathes of the makefile and found out that the template pathes nowhere were included so I started from scratch with the source include plathes using only pathes that were also used in the makefile.
So far I was successful to compile all sources with the exception to the following errors:
undefined reference to `__heap_end__'.
I understand that these are resolved thorugh the linker script (preferrably the os\ports\GCC\ARMCMx\STM32F4xx\ld\STM32F407xG.ld). But how to tell the compiler how to react to the undefined references?
rgds
-
friedrich.janus
- Posts: 8
- Joined: Sat Dec 28, 2013 2:47 pm
Re: Error "'GPIO_TypeDef' undeclared here" in main.c
Hello giovanni,
ha - sorry. Inspecting the console output a bit more in deep I saw that it is already the last gcc call - the linker call that failed.
Will include the linker scpript there
rgds
ha - sorry. Inspecting the console output a bit more in deep I saw that it is already the last gcc call - the linker call that failed.
Will include the linker scpript there
rgds
- Giovanni
- Site Admin
- Posts: 14892
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: Error "'GPIO_TypeDef' undeclared here" in main.c
Hi,
The meaning of those symbols is here: http://chibios.sourceforge.net/docs/por ... t_u_p.html
There are a lot of interactions between the .ld files, the Makefiles and the kernel. The files under templates are just templates so you must not use them in a project. The right paths can be seen in all the various .mk files.
Unless you are already used to the system my advice is to use the default build system and the provided startup and linker files.
Giovanni
The meaning of those symbols is here: http://chibios.sourceforge.net/docs/por ... t_u_p.html
There are a lot of interactions between the .ld files, the Makefiles and the kernel. The files under templates are just templates so you must not use them in a project. The right paths can be seen in all the various .mk files.
Unless you are already used to the system my advice is to use the default build system and the provided startup and linker files.
Giovanni
-
friedrich.janus
- Posts: 8
- Joined: Sat Dec 28, 2013 2:47 pm
Re: Error "'GPIO_TypeDef' undeclared here" in main.c
Hello Giovanni,
everything working here now.
Chibios is compiled, linked and can be loaded and debugged via ST-Link using eclipse Kepler and CDT buider - not Makefile.
Will refrain from using Chibi-Studio (see there).
rgds
everything working here now.
Chibios is compiled, linked and can be loaded and debugged via ST-Link using eclipse Kepler and CDT buider - not Makefile.
Will refrain from using Chibi-Studio (see there).
rgds