导航:首页 > 编程语言 > niosiic程序例

niosiic程序例

发布时间:2023-01-23 22:23:48

『壹』 NIOS建立工程问题,nios2-elf/bin/ld.exe: Hello_World.elf section `.text' will not fit in region

你使用的是FPGA内部RAM来作为niosII的程序存储器,可是你的程序尺寸太大了,内部RAM定义的大小不够。

建议你:

  1. 把内部RAM改大点;

  2. 勾选niosII工程中的精简C代码选项减小elf文件尺寸(右键单击project名称->Nios II->BSP editor,把enable_small_c_library和enable_reced_device_drivers勾上)。

  3. 干脆用个外部存储器。

『贰』 用FPGA做陀螺的信号采集,SOPC中用的是SPI总线,在Nios II中程序怎么写

void init_spi(void)
{
IOWR_32DIRECT(SPI_BASE,12,0xc0);//bit6 bit7 置1使能发送接收等待标志
IOWR_32DIRECT(SPI_BASE,8,0x60);//bit5 传输移位寄存器空标志 bit6 发送等待
}

alt_u8 spi_process(alt_u8 txdata)
{
alt_u8 rxdata;
alt_u32 spi_status_reg;
//发送数据
do{
spi_status_reg = IORD_32DIRECT(SPI_BASE,8);
}while((spi_status_reg & 0x40) != 0x40);

IOWR_32DIRECT(SPI_BASE,4,txdata);
//接收数据
do{
spi_status_reg = IORD_32DIRECT(SPI_BASE,8);
}while((spi_status_reg & 0x80) != 0x80);

rxdata = IORD_32DIRECT(SPI_BASE,0);
return rxdata;}

有这两个基本函数就可以通讯了,剩下的就要看你的陀螺仪的手册进行配置...

『叁』 在NIOS II IDE中能进行C程序的功能仿真吗能出波行吗

一般NIOS的软件都是基于Quartus的硬件架构来实现的,如果没有开发板是不行的哦,用Quartus搭建好硬件平台,不惜下到板子中,然后用NIO进行仿真

『肆』 Quartus II 与NIOS_II之间用的C语言程序的具体作用是什么

这是一个定时器中断程序,在中断处理函数中控制LED灯,亮起和熄灭。
建议看一下这本书《SOPC软件编程基础试验》,很容易就明白了。

『伍』 nios ii C语言编程

看一些教程吧,刚上手就看NIOS手册不容易懂.
这里推荐<NIOS那些事儿>.虽然内容比较浅,但都很实用.
其它你可以直接在网络上搜 SOPC教程,书内容都差不多的,全是直接翻译NIOS手册的.

『陆』 求个 NIOS II 简单的C语言中断程序

这个是我自己做的 99s的计数器。用数码管显示的,这里使用了中断,其目的是为了通过中断来精确计算真实的时间。如果还有需要,给我邮箱,我这里还有不少资料,我学了2个多月,基本也算有点小成了吧。呵
//自行设计 99s,用数码管显示!
#include<reg52.h>
#define uchar unsigned char
#define uint unsigned int
sbit wei=P1^2;
sbit an=P1^1;
uchar num;
uchar i,j;
uchar code table[]=; //数码管模块
void delayms(unsigned int i) // 毫秒延时
{
unsigned int j;
for(;i>0;i--)
for(j=100;j>0;j--);
}

void fu(uchar x,uchar y)
{
an=1;
P0=table[x]; //8的共阴码
an=0;
wei=1;
P0=0xfe; //送位显示码
wei=0;
delayms(5);

an=1;
P0=table[y]; //8的共阴码
an=0;
wei=1;
P0=0xfd; //送位显示码
wei=0;
delayms(5);
}

void main()
{
TMOD=0x01; //定时器0 工作方式1
TH0=(65536-45872)/256; //装载初值为11.0592M晶振定时50ms 数为 45872
TL0=(65536-45872)%256;
EA=1; //打开总中断
ET0=1; //开定时器0中断
TR0=1;

while(1)
{
fu(i,j);
}
//程序在此等待中断的到来
}
void T0_time() interrupt 1
{
TH0=(65536-45872)/256; //重装初值
TL0=(65536-45872)%256;
num++; //num每加1次判断一次是否到20次
if(num==20) //如果到了20次,说明1秒时间到
{
num=0;
i++; //num重新置数为0

}
if(i==10)
{i=0; // i超过9 就置为0
j++;
}
if(j==10)j=0 ; //j超过9 就置为0

}

『柒』 求大神帮我读程序,C语言程序,关于Quartus建立nios II软核后,需要用C语言编程,已有程序,需大神解读

quartus里面可以用vhdl语言编写管教 或者利用电路图做管教 VHDL可以用到SOPC来建立你要使用的板子上的版东权西 其实就相当于一个驱动
Nios是写内核的 写的程序控制你整个系统
这俩软件加上板子 构成了你整个的FPGA系统 也就是嵌入式系统
QUARTUS里也是可以写程序的 VERLOG 和VHDL 你可以查下这俩词你就懂了
还有什么问题你可以补充

『捌』 怎么在nios 2软件环境下编写SPI内核的C语言程序

不明白你什么意思

『玖』 请教高手在nios II IDE的c语言程序中如何读取开发板的硬件输入信号

首先搞清楚开发板的驱动是如何映射到系统里的,然后需要用到中断,去扫描开发板的键盘码.
但一般的开发板自带的说明书里都有现成的硬件接口操作方法介绍,用不着自己再开发的啊.

『拾』 求LCD显示模块 实现NiosII驱动240X128LCD显示 VHDL语言编程 急求,求好心人帮助

/drivers/video/niosii/nois11.c

自己去看吧。还要看/drivers/video/fbmem.c 这里面的函数有些会被调用.

给你举个例子:


staticvoidipu_clear_usage(intipu,intdi)
{
ipu_usage[ipu][di]=false;
}

/*!
*.Itiscalledringthe
*driverbindingprocess.
*thisroutine:Framebufferinitialization,Memoryallocationand
*mapping,Framebufferregistration,IPUinitialization.
*
*@
*/
staticintmxcfb_probe(structplatform_device*pdev)
{
structipuv3_fb_platform_data*plat_data=pdev->dev.platform_data;
structfb_info*fbi;
structmxcfb_info*mxcfbi;
structresource*res;
structdevice*disp_dev;
charbuf[32];
intret=0;

/*InitializeFBstructures*/
fbi=mxcfb_init_fbinfo(&pdev->dev,&mxcfb_ops);

if(!fbi){
ret=-ENOMEM;
gotoinit_fbinfo_failed;
}

ret=mxcfb_option_setup(pdev,fbi);
if(ret)
gotoget_fb_option_failed;
/**********byzxyadd:modpara*************************************************
printk(" byzxy1:fbi->var.xres=0x%x,fbi->var.yres=0x%x ",fbi->var.xres,fbi->var.yres);
printk(" byzxy1:fbi->var.xres_virtual=0x%x,fbi->var.yres_virtual=0x%x ",fbi->var.xres_virtual,fbi->var.yres_virtual);
fbi->var.xres=800;
fbi->var.yres=480;
fbi->var.xres_virtual=1920;
fbi->var.yres_virtual=1440;
printk(" byzxy2:fbi->var.xres=0x%x,fbi->var.yres=0x%x ",fbi->var.xres,fbi->var.yres);
printk(" byzxy2:fbi->var.xres_virtual=0x%x,fbi->var.yres_virtual=0x%x ",fbi->var.xres_virtual,fbi->var.yres_virtual);
/***********************************************************/

mxcfbi=(structmxcfb_info*)fbi->par;
spin_lock_init(&mxcfbi->lock);
mxcfbi->fbi=fbi;
mxcfbi->ipu_int_clk=plat_data->int_clk;
mxcfbi->late_init=plat_data->late_init;
mxcfbi->first_set_par=true;
mxcfbi->panel_width_mm=plat_data->panel_width_mm;
mxcfbi->panel_height_mm=plat_data->panel_height_mm;

ret=mxcfb_dispdrv_init(pdev,fbi);
//byzxyadd
//printk(" byzxy1:mxcfbi->default_bpp==%d ",mxcfbi->default_bpp);
//mxcfbi->default_bpp=16;
//printk(" byzxy1:mxcfbi->default_bpp==%d ",mxcfbi->default_bpp);

if(ret<0)
gotoinit_dispdrv_failed;

ret=ipu_test_set_usage(mxcfbi->ipu_id,mxcfbi->ipu_di);
if(ret<0){
dev_err(&pdev->dev,"ipu%d-di%dalreadyinuse ",
mxcfbi->ipu_id,mxcfbi->ipu_di);
gotoipu_in_busy;
}

res=platform_get_resource(pdev,IORESOURCE_MEM,0);
if(res&&res->start&&res->end){
fbi->fix.smem_len=res->end-res->start+1;
fbi->fix.smem_start=res->start;
// printk(" byzxy2:fbi->fix.smem_start=0x%x ",fbi->fix.smem_start);
fbi->screen_base=ioremap(fbi->fix.smem_start,fbi->fix.smem_len);
// printk(" byzxy3:fbi->screen_base=0x%x ",fbi->screen_base);
// printk(" byzxy4:fbi->fix.smem_len=0x%x ",fbi->fix.smem_len);

//byzxysee2
/*.*/
if(!mxcfbi->late_init)
memset(fbi->screen_base,0,fbi->fix.smem_len);
}

mxcfbi->ipu=ipu_get_soc(mxcfbi->ipu_id);
if(IS_ERR(mxcfbi->ipu)){
ret=-ENODEV;
gotoget_ipu_failed;
}

/**/
if(!g_dp_in_use[mxcfbi->ipu_id]){
mxcfbi->ipu_ch_irq=IPU_IRQ_BG_SYNC_EOF;
mxcfbi->ipu_ch_nf_irq=IPU_IRQ_BG_SYNC_NFACK;
mxcfbi->ipu_alp_ch_irq=IPU_IRQ_BG_ALPHA_SYNC_EOF;
mxcfbi->ipu_vsync_pre_irq=mxcfbi->ipu_di?
IPU_IRQ_VSYNC_PRE_1:
IPU_IRQ_VSYNC_PRE_0;
mxcfbi->ipu_ch=MEM_BG_SYNC;
/**/
if(pdev->id==0)
mxcfbi->cur_blank=mxcfbi->next_blank=FB_BLANK_UNBLANK;
else
mxcfbi->cur_blank=mxcfbi->next_blank=FB_BLANK_POWERDOWN;

ret=mxcfb_register(fbi);
if(ret<0)
gotomxcfb_register_failed;

ipu_disp_set_global_alpha(mxcfbi->ipu,mxcfbi->ipu_ch,
true,0x80);
ipu_disp_set_color_key(mxcfbi->ipu,mxcfbi->ipu_ch,false,0);

res=platform_get_resource(pdev,IORESOURCE_MEM,1);
ret=mxcfb_setup_overlay(pdev,fbi,res);

if(ret<0){
mxcfb_unregister(fbi);
gotomxcfb_setupoverlay_failed;
}

g_dp_in_use[mxcfbi->ipu_id]=true;

ret=device_create_file(mxcfbi->ovfbi->dev,
&dev_attr_fsl_disp_property);
if(ret)
dev_err(mxcfbi->ovfbi->dev,"Error%doncreating"
"filefordispproperty ",
ret);

ret=device_create_file(mxcfbi->ovfbi->dev,
&dev_attr_fsl_disp_dev_property);
if(ret)
dev_err(mxcfbi->ovfbi->dev,"Error%doncreating"
"filefordispdevice"
"propety ",ret);
}else{
mxcfbi->ipu_ch_irq=IPU_IRQ_DC_SYNC_EOF;
mxcfbi->ipu_ch_nf_irq=IPU_IRQ_DC_SYNC_NFACK;
mxcfbi->ipu_alp_ch_irq=-1;
mxcfbi->ipu_vsync_pre_irq=mxcfbi->ipu_di?
IPU_IRQ_VSYNC_PRE_1:
IPU_IRQ_VSYNC_PRE_0;
mxcfbi->ipu_ch=MEM_DC_SYNC;
mxcfbi->cur_blank=mxcfbi->next_blank=FB_BLANK_POWERDOWN;

ret=mxcfb_register(fbi);
if(ret<0)
gotomxcfb_register_failed;
}

platform_set_drvdata(pdev,fbi);

ret=device_create_file(fbi->dev,&dev_attr_fsl_disp_property);
if(ret)
dev_err(&pdev->dev,"Error%doncreatingfilefordisp"
"property ",ret);

ret=device_create_file(fbi->dev,&dev_attr_fsl_disp_dev_property);
if(ret)
dev_err(&pdev->dev,"Error%doncreatingfilefordisp"
"devicepropety ",ret);

disp_dev=mxc_dispdrv_getdev(mxcfbi->dispdrv);
if(disp_dev){
ret=sysfs_create_link(&fbi->dev->kobj,
&disp_dev->kobj,"disp_dev");
if(ret)
dev_err(&pdev->dev,
"Error%doncreatingfile ",ret);
}

INIT_WORK(&mxcfbi->vsync_pre_work,mxcfb_vsync_pre_work);

snprintf(buf,sizeof(buf),"mxcfb%d-vsync-pre",fbi->node);
mxcfbi->vsync_pre_queue=create_singlethread_workqueue(buf);
if(mxcfbi->vsync_pre_queue==NULL){
dev_err(fbi->device,
"Failedtoallocvsync-preworkqueue ");
ret=-ENOMEM;
gotoworkqueue_alloc_failed;
}

#ifdefCONFIG_HAS_EARLYSUSPEND
mxcfbi->fbdrv_earlysuspend.level=EARLY_SUSPEND_LEVEL_DISABLE_FB;
mxcfbi->fbdrv_earlysuspend.suspend=mxcfb_early_suspend;
mxcfbi->fbdrv_earlysuspend.resume=mxcfb_later_resume;
mxcfbi->fbdrv_earlysuspend.data=pdev;
register_early_suspend(&mxcfbi->fbdrv_earlysuspend);
#endif

//byzxydel,toloadlogo.bmp
printk(" byzxy3:fbi->var.xres=%d,fbi->var.yres=%d ",fbi->var.xres,fbi->var.yres);
printk(" byzxy3:fbi->var.xres_virtual=%d,fbi->var.yres_virtual=%d ",fbi->var.xres_virtual,fbi->var.yres_virtual);
printk(" byzxy3:fbi->var.bits_per_pixel=%d,fbi->var.pixclock=%d ",fbi->var.bits_per_pixel,fbi->var.pixclock);
// printk(" byzxy3:fbi->var.xres_virtual=0x%x,fbi->var.yres_virtual=0x%x ",fbi->var.xres_virtual,fbi->var.yres_virtual);


#ifdefCONFIG_LOGO
fb_prepare_logo(fbi,0);
fb_show_logo(fbi,0);
#endif

return0;

workqueue_alloc_failed:
mxcfb_setupoverlay_failed:
mxcfb_register_failed:
get_ipu_failed:
ipu_clear_usage(mxcfbi->ipu_id,mxcfbi->ipu_di);
ipu_in_busy:
init_dispdrv_failed:
fb_dealloc_cmap(&fbi->cmap);
framebuffer_release(fbi);
get_fb_option_failed:
init_fbinfo_failed:
returnret;
}

staticintmxcfb_remove(structplatform_device*pdev)
{
structfb_info*fbi=platform_get_drvdata(pdev);
structmxcfb_info*mxc_fbi=fbi->par;

if(!fbi)
return0;

#ifdefCONFIG_HAS_EARLYSUSPEND
unregister_early_suspend(&mxc_fbi->fbdrv_earlysuspend);
#endif

device_remove_file(fbi->dev,&dev_attr_fsl_disp_dev_property);
device_remove_file(fbi->dev,&dev_attr_fsl_disp_property);
mxcfb_blank(FB_BLANK_POWERDOWN,fbi);
mxcfb_unregister(fbi);
mxcfb_unmap_video_memory(fbi);

if(mxc_fbi->ovfbi){
device_remove_file(mxc_fbi->ovfbi->dev,
&dev_attr_fsl_disp_dev_property);
device_remove_file(mxc_fbi->ovfbi->dev,
&dev_attr_fsl_disp_property);
mxcfb_blank(FB_BLANK_POWERDOWN,mxc_fbi->ovfbi);
mxcfb_unsetup_overlay(fbi);
mxcfb_unmap_video_memory(mxc_fbi->ovfbi);
}

ipu_clear_usage(mxc_fbi->ipu_id,mxc_fbi->ipu_di);
if(&fbi->cmap)
fb_dealloc_cmap(&fbi->cmap);
framebuffer_release(fbi);
return0;
}

/*!
*.
*/
staticstructplatform_drivermxcfb_driver={
.driver={
.name=MXCFB_NAME,
},
.probe=mxcfb_probe,
.remove=mxcfb_remove,
.suspend=mxcfb_suspend,
.resume=mxcfb_resume,
};

#ifdefCONFIG_HAS_EARLYSUSPEND
staticvoidmxcfb_early_suspend(structearly_suspend*h)
{
structplatform_device*pdev=(structplatform_device*)h->data;
structfb_info*fbi=platform_get_drvdata(pdev);
structmxcfb_info*mxcfbi=(structmxcfb_info*)fbi->par;
pm_message_tstate={.event=PM_EVENT_SUSPEND};
structfb_eventevent;
intblank=FB_BLANK_POWERDOWN;

if(mxcfbi->ipu_ch==MEM_FG_SYNC)
return;

if(strstr(mxcfbi->dispdrv->drv->name,"hdmi")){
/**/
memset(fbi->screen_base,0,fbi->fix.smem_len);
return;
}

mxcfb_core_suspend(pdev,state);
event.info=fbi;
event.data=&blank;
fb_notifier_call_chain(FB_EVENT_BLANK,&event);
}

staticvoidmxcfb_later_resume(structearly_suspend*h)
{
structplatform_device*pdev=(structplatform_device*)h->data;
structfb_info*fbi=platform_get_drvdata(pdev);
structmxcfb_info*mxcfbi=(structmxcfb_info*)fbi->par;
structfb_eventevent;

if(mxcfbi->ipu_ch==MEM_FG_SYNC)
return;

/**/
if(strstr(mxcfbi->dispdrv->drv->name,"hdmi"))
return;

mxcfb_core_resume(pdev);
event.info=fbi;
event.data=&mxcfbi->next_blank;
fb_notifier_call_chain(FB_EVENT_BLANK,&event);
}
#endif

/*!
*.Thefunctionregistersthepower
*
*fbmem.c
*
*@
*/
int__initmxcfb_init(void)
{
returnplatform_driver_register(&mxcfb_driver);
}

voidmxcfb_exit(void)
{
platform_driver_unregister(&mxcfb_driver);
}

mole_init(mxcfb_init);
mole_exit(mxcfb_exit);

阅读全文

与niosiic程序例相关的资料

热点内容
无法找到文件中可删除的图片 浏览:739
dnf90版本副职业 浏览:848
c只读打开文件 浏览:575
如何在电脑文件上添加图片 浏览:297
xslist网站怎么登录 浏览:735
ftp不能直接打开文件 浏览:145
ps调整后的xps文件 浏览:572
小米如何取消wifi和数据同时使用 浏览:347
微信数据6个g怎么清理 浏览:533
找厂房去哪个app 浏览:881
linuxmini 浏览:997
如何找编程类的工作 浏览:286
jsp从mysql读取时间 浏览:680
有什么app可以存app 浏览:603
游戏编程从哪里学的 浏览:738
win8文件布局 浏览:308
数据存储参数配置文件 浏览:122
面膜去哪个网站买好 浏览:627
天下游旧版本 浏览:622
iphone6按键震动 浏览:528

友情链接