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
Hello, the below should answer your query:https://developer.arm.com/documentation/ka005073
(Also, I've moved your thread to the Keil specific forum).
Hello again,
Apologies, I misunderstood the context of your query... if you wish to use Arm Compiler 5, then my original answer shows you how to do it.
For the cause of the error, I'm not sure if your original project was built for a particular C standard, but I generates the equivalent (expected) error with both armcc and armclang.
extern int bar(int a); int foo(){ return bar(1, 2, 3, 4, 5, 6); }
armcc -c foo.c "foo.c", line 4: Error: #140: too many arguments in function call armclang -c foo.c --target=arm-arm-none-eabi -mcpu=cortex-m3 -std=c90 foo.c:4:16: error: too many arguments to function call, expected single argument 'a', have 6 arguments
Note the default standard for armcc is c90, but for armclang it is c11, however using armclang -std=c90 (and others) also fails.https://developer.arm.com/documentation/100068/0620/Migrating-from-Arm-Compiler-5-to-Arm-Compiler-for-Embedded-6/Default-differences
Could you share your code example, and armcc build options?
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.