1,右键工程文件--》properities->nios ii application prog->debug level设置为off
->optimize level设置为size
2,右键bsp文件-->properities->c/c++ general->nios ii bsp properties->debug level 设置为off
->ooptimize level设置为size
->reduced device driver选中
->support c++取消
note:support c++如果想用标注c函数库不要用,使用方法在SHW程序中可窥见一斑
总结:如此设置代码量可减小 同时可实用标准c函数库 如printf 尤其是在调试的时候很有效
另外 如果建立一个空工程 默认是支持标准c函数库的
如设置成SMALL C LIBRARY 则要实用HAL函数,下面是SHW程序使用
#include "sys/alt_stdio.h"
int main()
{
alt_putstr("Hello from Nios II!n");
while (1);
return 0;
}
Use ALT versions of stdio routines:
*
* Function Description
* =============== =====================================
* alt_printf Only supports %s, %x, and %c ( < 1 Kbyte)
* alt_putstr Smaller overhead than puts with direct drivers
* Note this function doesn't add a newline.
* alt_putchar Smaller overhead than putchar with direct drivers
* alt_getchar Smaller overhead than getchar with direct drivers
本文详细介绍了如何通过调整NIOs II EDS工程和BSP文件的属性设置来减小代码量,并在保持支持标准C函数库的同时进行高效调试。通过设置`debuglevel`为`off`和`optimizelevel`为`size`,可以实现代码优化。此外,文章还提供了SHW程序中使用标准C函数库的方法,如`alt_putstr`等替代直接驱动函数,减少内存占用和提高运行效率。
2277

被折叠的 条评论
为什么被折叠?



