新手学nios ii出错,手录如下
版本 quartus ii 11.0 和nios ii 11.0:
1.除了内部片内ram和rom需要连接data_master,instruction_master,其他只需连接到data_master;
.
2.注意若片上资源不够,需优化代码,以下程序验证通过
#include "system.h"
#include "altera_avalon_pio_regs.h"
#include "alt_types.h"
int main (void) __attribute__ ((weak, alias ("alt_main")));
int alt_main (void)
{
volatile int i;
/*
* Infinitely shift a variable with one bit set back and forth, and write
* it to the LED PIO. Software loop provides delay element.
*/
while (1)
{
int j=0;
while (1)
{
for(j=0;j<8;j++)
{
IOWR_ALTERA_AVALON_PIO_DATA(PIO_BASE, 1<<j); //点亮流水灯,PIO_BASE
for(i = 0;i<1000000;i++);
}
}
}
return 0;
}