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

移植时出现KeilMDK 编译报错:error: declaration may not appear after executable statement in block #207

Open
chuxuanqk opened this issue Jul 30, 2020 · 2 comments

Comments

@chuxuanqk
Copy link

在 tos_cpu.c 文件中
KNL k_stack_t *cpu_task_stk_init(void *entry,
void *arg,
void *exit,
k_stack_t *stk_base,
size_t stk_size)
{
cpu_data_t *sp;

sp = (cpu_data_t *)&stk_base[stk_size];
sp = (cpu_data_t *)((cpu_addr_t)sp & 0xFFFFFFF8);

#if TOS_CFG_TASK_STACK_DRAUGHT_DEPTH_DETACT_EN > 0u
uint8_t *slot = (uint8_t *)&stk_base[0];
for (; slot < (uint8_t *)sp; ++slot) {
*slot = 0xCC;
}

在keil的编译器中,变量声明不能放在在执行语句之后,在移植的时候会报错。

@chuxuanqk
Copy link
Author

chuxuanqk commented Aug 5, 2020

新版keil
image
旧版keil

image

采用以上方式可以使得keil支持C99

@Supowang1989
Copy link
Collaborator

OK 感谢指出,我们看看怎么提示下开发者移植的时候注意

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