查看: 1390|回复: 0

MAX10上跑的第一个Nios II系统

[复制链接]
  • TA的每日心情

    2021-12-24 16:56
  • 签到天数: 739 天

    连续签到: 1 天

    [LV.9]以坛为家II

    发表于 2015-1-12 10:19:31 | 显示全部楼层 |阅读模式
    分享到:
    首先来看看一个nios的经典输出:

    哈哈,看来是成功了,板子上的LED也是在一闪一闪的了。
    下面来看看一些细节。
    nios我建立的比较简单,只有一个时钟输入和一组输出io

    在这个nios里面的结构也很简单,毕竟只是用于测试嘛。只选取了基本的时钟,nios核心,sram,system id等基本组件。
    不过在选择nios的时候,只能选择nios gen2 processer。而这个处理器还是preview 版本。不知道Q14.1有木有升级为正式版。

    其他的建立过程跟常规的nios建立过程是一样的,这里就不赘述了。如有需要,可以参考如下链接内容
    https://blog.163.com/lan_ne/blog/static/19267017020...
    不知道是新版本还是怎么回事,nios建立后,不会在quartus工程里面添加相关的文件,需要手动添加,这点上,又让我欢乐的浪费了一个下午+一个晚上。其实很简单的。如下图所示:

    在Quartus的工程组织结构中,选择文件组织方式,然后点击右键,选择弹出菜单,然后弹出添加文件对话框:

    在里面找到生成nios文件时候的那个qip文件,添加到工程里面即可。
    编译结果如下:

    貌似不是很占资源的说。
    然后下面一步就是通过bsp建立nios软件开发环境了。这个过程 也跟以前的过程一致,所以也不赘述。
    这里提出一点跟以前的quartus9不一样的,就是你在编译工程的时候,需要先generate bsp,方法是在BSP工程上点右键,然后选择nios ii子菜单,然后选择generate bsp即可,如下图所示:

    过会儿后会在输出信息栏提示成功,如下图所示:

    这样就可以全编译工程,然后下载运行了。
    nios软件代码如下:
    /* * "Hello World" example. * * This example prints 'Hello from Nios II' to the STDOUT stream. It runs on * the Nios II 'standard', 'full_featured', 'fast', and 'low_cost' example * designs. It runs with or without the MicroC/OS-II RTOS and requires a STDOUT * device in your system's hardware. * The memory footprint of this hosted application is ~69 kbytes by default * using the standard reference design. * * For a reduced footprint version of this template, and an explanation of how * to reduce the memory footprint for a given application, see the * "small_hello_world" template. * */typedef struct{    volatile unsigned long int DATA;    volatile unsigned long int DIRECTION;    volatile unsigned long int INTERRUPT_MASK;    volatile unsigned long int EDGE_CAPTURE;}PIO_STR;#include <stdio.h>#include "system.h"#include <unistd.h>#define PORTA                ((PIO_STR*)PIO_0_BASE)int main(){  printf("Hello from Nios II!\n");  while(1)  {          PORTA->DATA=0xff;          usleep(1000000);          PORTA->DATA=0x00;          usleep(1000000);  }  return 0;}祝各位成功!
    Quartus和Nios工程附件
    max10_test2.rar
    回复

    使用道具 举报

    您需要登录后才可以回帖 注册/登录

    本版积分规则

    关闭

    站长推荐上一条 /2 下一条

    手机版|小黑屋|与非网

    GMT+8, 2024-4-28 15:16 , Processed in 0.113842 second(s), 18 queries , MemCache On.

    ICP经营许可证 苏B2-20140176  苏ICP备14012660号-2   苏州灵动帧格网络科技有限公司 版权所有.

    苏公网安备 32059002001037号

    Powered by Discuz! X3.4

    Copyright © 2001-2024, Tencent Cloud.