代码最优化时堆栈指针不一致造成。在菜单->edit->standardsetting->compiler for HC12->option中选中MainOptimize Target,再选中optimize for execution time即可。