I am an engineer working with a device from a company that makes flame sensing equipment. I won't bore you with the why and the what but basically the device comes with a bare bones μVision 5 project to construct the API and get you started. I'm more an engineer who can code than a programmer and I'm struggling. The API files are a few years old, the company said they won't update them anytime soon and I'm having trouble porting it to version 6 of the compiler. It was made for version 5. I think I've fixed most of the errors but there is one that I just can't seem to get.
Its a 'Too many arguments to function call - single argument function has six arguments '
I'm assuming that these files work just fine on the correct compiler version. I've fixed all the other errors by finding out the changes in syntax between version 5 and 6 but I can't find anything like that on this error. Can someone tell me if there is something obvious I'm missing. The actual code is on another computer and I don't have it handy at the moment, but I can provide it later if the issue isn't obvious from my description.
Thanks
Hi,
I tried to install the version 5 compiler but something went wrong. It seemed to install fine but the option in the ARM Compiler drop down still says, 'Missing: Compiler Version 5'. Here is a snippet of the code I'm working with.
This is the definition of the function that's throwing the error
/** * @brief Fills each GPIO_InitStruct member with its default value. * @param GPIO_InitStruct: pointer to a GPIO_InitTypeDef structure which will * be initialized. * @retval None */ void GPIO_StructInit(GPIO_InitTypeDef* GPIO_InitStruct) { /* Reset GPIO init structure parameters values */ GPIO_InitStruct->GPIO_Pin = GPIO_Pin_All; GPIO_InitStruct->GPIO_Mode = GPIO_Mode_IN; GPIO_InitStruct->GPIO_Speed = GPIO_Speed_2MHz; GPIO_InitStruct->GPIO_OType = GPIO_OType_PP; GPIO_InitStruct->GPIO_PuPd = GPIO_PuPd_NOPULL; }
Then here is where the function is called
void Additional_Micro_controller_GPIO_init(void) { //**!!! Ensure Pins Being Configured Are Not Already Assigned in Micro_Controller_Template.c !!!**// // ezPyro flame demo board GPIO pin used to confirm algorithm time and control LED // set pin 3 of port A as normal OUTPUT GPIO_StructInit(GPIO_Pin_3, GPIO_Mode_OUT, GPIO_OType_PP, GPIO_Speed_2MHz, GPIO_PuPd_NOPULL, GPIOA ); //**!!! Ensure Pins Being Configured Are Not Already Assigned in Micro_Controller_Template.c !!!**// }
The red underline is under the 'GPIO_Mode_OUT,' line
And just in case the exact error is, "error: too many arguments to function call, expected single argument 'GPIO_StructInit', have 6 arguments."
I've gotten the project down to 1 error and 13 warnings. I also still have the original unedited files for if I can get version 5 of the compiler to work. Either method would suit me but I'd like to make it work on version 6 if I can just for the experience of porting a project. I can't imagine that's a bad thing to have figured out. I briefly studied embedded programming in university but its been like 5 years since that class. Thank you for your help.
For installing armcc, did you register the compiler with your project?https://developer.arm.com/documentation/101407/0538/Creating-Applications/Tips-and-Tricks/Manage-Arm-Compiler-Versions
Regarding the code snippet above, that is not valid C - I'm unsure how any compiler would accept it. You should pass a (pointer to a) structure, not the elements of the structure, to GPIO_StructInit()
There are many examples online, such as below:https://www.tutorjoes.in/c_programming_tutorial/struct_as_arg_in_c
Regards, Ronan
Thank you, I figured out how to do what they were trying to do.