C function prototype of a simulink function is not correctly configured as desired in generated code

1 visualización (últimos 30 días)
Hello everyone,
I'm using a simulink function block to generate a function that is going to be integrated into an external project.
The desired function prototype has been configured as below. Here, the function has a return value.
However, in the generated source file, the function is defined in the following way:
// Function Definition
void s16_eeprom_read_block(uint16_T ou16_BlockNumber, int16_T *rty_s16_ErrorFlag)
{
// Algorithm Implementation
}
// Function Declaration
extern int16_T s16_eeprom_read_block(uint16_T ou16_BlockNumber);
As we can see, the function doesn't have any return value according to its definition. Instead, this value has been replaced with a reference. As for function declaration, it is just what I desired.
Since this function has to be called and its return value has to be evaluated in the project, this mistake will lead to a compilation error.
I have deleted all of the generated files and tried to generate code again, but it didn't help.
In addition, my MATLAB version is R2018a. I think it may be a bug of simulink function since years ago, because this problem also occured while using earlier versions.
Is there anyone who can help me to solve this problem? Thank you!
  4 comentarios
Xiaojie Qiu
Xiaojie Qiu el 3 de Sept. de 2018
Hello Nick,
Thanks for your reply! Sorry, but I cannot reproduce this problem anymore, because I've completely deleted this simulink function block, established a new one with an another name instead.
Because I have been working with simulink function to generate code for months, I would like to list some problems I've met while using it:
1) Although the identifier name of an arguement has already been set to the token $N, it would be sometimes changed to other format, such as rt$I$N$M.
2) After changing the function name, sometimes, it could leads to an error reporting that other two simulink functions also defined this function.
Best regards. Thank you!
Nick Sarnie
Nick Sarnie el 3 de Sept. de 2018
Hi Xiaojie,
Thanks for letting me know. If you are able to reproduce either of those issues, please reach out to Technical Support. They can work with my team to investigate further.
Thanks, Nick

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Simulink Coder en Help Center y File Exchange.

Productos


Versión

R2018a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by