Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

如何定义一个 SHELL_CommandTypeDef #17

Open
panguoxian opened this issue Oct 12, 2019 · 2 comments
Open

如何定义一个 SHELL_CommandTypeDef #17

panguoxian opened this issue Oct 12, 2019 · 2 comments

Comments

@panguoxian
Copy link

我的定义如下:
void func(int i, char ch, char *str)
{
printf("input int: %d, char: %c, string: %s\r\n", i, ch, str);
}

SHELL_CommandTypeDef test = {
"test",
func,
"test com",
"test help"
};
SHELL_EXPORT_CMD(func, func, test);
但是报错:Error section attribute cannot be specified for local variables

@NevermindZZT
Copy link
Owner

尝试一下
SHELL_CommandTypeDef test = {
"test",
(int (*)())func,
"test com",
"test help"
};

@panguoxian
Copy link
Author

尝试一下
SHELL_CommandTypeDef test = {
"test",
(int (*)())func,
"test com",
"test help"
};

已解决,非常感谢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants