[转载]NIOS II EDS 常用简化代码步骤_Detective_ALong_新浪博客

本文详细介绍了如何通过调整NIOs II EDS工程和BSP文件的属性设置来减小代码量,并在保持支持标准C函数库的同时进行高效调试。通过设置`debuglevel`为`off`和`optimizelevel`为`size`,可以实现代码优化。此外,文章还提供了SHW程序中使用标准C函数库的方法,如`alt_putstr`等替代直接驱动函数,减少内存占用和提高运行效率。

 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
 

    

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值