導航:首頁 > 編程語言 > 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程序例相關的資料

熱點內容
ps淘寶女包修圖教程 瀏覽:568
55公里app 瀏覽:556
欠費多少充多少為啥還用不了數據 瀏覽:607
蘋果7如何使用萬能鑰匙 瀏覽:254
微信文件傳送電腦 瀏覽:600
什麼app可以解壓百度雲rar 瀏覽:627
蘋果6sp換殼 瀏覽:956
海盜船k70rgb燈光配置文件 瀏覽:336
linuxfsstat 瀏覽:926
電腦文件有個鎖 瀏覽:441
ps多張pdf文件夾 瀏覽:2
怎樣壓縮文件能傳到qq郵箱 瀏覽:923
南昌房管局網站怎麼查備案 瀏覽:884
如何設置ipad下載密碼 瀏覽:458
ae信號干擾教程 瀏覽:548
電腦之前刪掉的文件怎麼找 瀏覽:805
索尼z1刷什麼系統升級 瀏覽:466
自創字體怎麼編程序 瀏覽:381
成都的蘋果售後服務電話號碼 瀏覽:698
文件放筆記本哪個盤 瀏覽:745

友情鏈接