我的NIOS的建立和NIOS/IDE中的存储器的设置与Atlera的文档介绍的一样,在Build all的时候也能通过,但是就是不能在ISS中仿真调试,说是不能装载,怎么回事?程序如下
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include "system.h"
#include "altera_avalon_timer.h"
#include "altera_avalon_timer_regs.h"
#include "alt_types.h"
#include "sys/alt_irq.h"
alt_u8 led=0;
alt_u16 cnter=0;
alt_u8 timer1_ok=0;
static void timer1_init()
{
IOWR(SYS_CLK_TIMER_BASE,0,0);
IOWR(SYS_CLK_TIMER_BASE,ALTERA_AVALON_TIMER_CONTROL_REG,0x0B);//continual count
IOWR(SYS_CLK_TIMER_BASE, ALTERA_AVALON_TIMER_PERIODL_REG, 0x93E0);
IOWR(SYS_CLK_TIMER_BASE, 3, 0x04);
IOWR(SYS_CLK_TIMER_BASE, 1, ALTERA_AVALON_TIMER_CONTROL_CONT_MSK);
}
void timer1_isr(int context)
{
IOWR(SYS_CLK_TIMER_BASE, 0, ALTERA_AVALON_TIMER_STATUS_TO_OFST);
IOWR(SYS_CLK_TIMER_BASE, ALTERA_AVALON_TIMER_PERIODL_REG, 0x93E0);
IOWR(SYS_CLK_TIMER_BASE, 3, 0x04);
timer1_ok=1;
}
void main()
{
int context=0;
alt_irq_register(SYS_CLK_TIMER_IRQ,SYS_CLK_TIMER_BASE,timer1_isr);
timer1_init();
while(1)
{
if(timer1_ok)
{
timer1_ok=0;
cnter++;
if(cnter==20)
{
cnter=0;
led^=0xFF;
IOWR(LED_PIO_BASE, 0, led);
}
}
}
}
Build的结果如下:../resource.c:55: warning: passing arg 2 of `alt_irq_register' makes pointer from integer without a cast
../resource.c:55: warning: passing arg 3 of `alt_irq_register' from incompatible pointer type
../resource.c:54: warning: unused variable `context'
../resource.c:77:51: warning: no newline at end of file
Info: (test.elf) 33 KBytes program size (code + initialized data).
Info: 16350 KBytes free for stack + heap.
Post-processing to create ext_flash.flash
Hardware simulation is not enabled for the target SOPC Builder system. Skipping creation of hardware simulation model contents and simulation symbol files. (Note: This does not affect the instruction set simulator.)
Build completed
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |