2020-02-18 08:57 AM
Hello
I'm new to STM32.
The name of the board I am using is NUCLEO-F091RC.
I am using TureStdio and want to use simple I2C communication.
But I get the error in places like MX_GPIO_Init (void).
The function is an automatically generated function so I don't know how to fix it.
Here is a list of errors:
expected declaration or statement at end of input
invalid storage class for function "MX_GPIO_Init"
invalid storage class for function "MX_I2C1_Init"
invalid storage class for function "MX_TIM14_Init"
invalid storage class for function "MX_USART1_UART_Init"
invalid storage class for function "MX_USART2_UART_Init"
I have attached my project.
Please help me.
2020-02-18 11:47 AM
The "expected declaration or statement at end of input" error means that there is an imbalance of curly braces { } somewhere in your code. The "invalid storage class ..." errors are only inherited from that.
In STM32CubeIDE use right-click > Source > Format to auto-indent your code. This might help spotting the error.
2020-02-18 05:23 PM
Thank you. I will do it immediately.
2020-10-10 06:18 AM
And what's the relation between missing a curly brace, and an error related to being a static object ?!
2020-10-10 08:52 AM
The (broken) source code looks like
int main(void)
{
void static void MX_GPIO_Init(void)
{
}
gcc supports nested functions and makes a guess that the author's intention was
int main(void)
{
static void MX_GPIO_Init(void)
{
}
}
which explains somehow both error mesages. gcc is wrong here and I really don't like gnuisms in the source code because they hinder portability.
2023-12-17 12:03 AM
Big Thanks to you, solved it immediately!
2024-08-01 10:50 PM
good