uCOS 在 NIOS II 上的移植
工具:Quartus II
器件:EP4CE15F17C8
1.File->New Project Wizard:
2.点击两个Next,进入Family&Device Settings,选择器件
3.Finish,建立工程完毕,点击Tools->SOPC Builder,输入名字后,OK
4.修改clk_0为100MHz
5.component library中搜索nios,双击Nios II Processer
6.Finish
7.搜索epcs,双击epcs Serial。。。Finish
8.搜索sdram,双击sdram controller,配置如下,sdram芯片为H57V2562GTR
9.搜索sysid,双击system id,finish
10.搜索jtag,双击JTAG UART,finish。搜索timer,双击Interval timer,finish。
11.修改epcs和sdram基址:0x0000000,0x04000000
12.双击cpu_0,配置reset vector和exception vector。
13.修改各个模块的base地址,如图:
14.点击Generate
15.Generate成功。
16.File-New
17.save as nios.bdf,空白处双击,添加mynios kernel,OK
18.双击空白处:MegaWizard Plug-In Manager
19.设置时钟:
20.Finish,此时nios.bdf
21.分别右键模块,选择Generate Pins。。。在分别对引脚名字进行重新命名。
22.Assignments->Import Assignments,导入mynios.csv,这是之前编好的引脚配置信息:
下载地址:http://download.csdn.net/detail/wu20093346/8205265
编译时发现问题,NIOS II模块和工程名字一样引起冲突,打开Tools->SOPC Builder,打开之前的SOPC文件,Save as kernel.sopc,Generate。将mynios用kernel替换掉,如图:(另外将nios.bdf重新命名为mynios.bdf,与工程名保持一致)
23.Assignments->Device,选择Device and Pins Options,Dual-purpose中全部设置为regular IO:
24.编译整个工程,生成mynios.sof文件。Tools->NIOS II Software Build Tools for Eclipse,new->NIOS II Application and BSP from Template。选择SOPC information file,并给工程名字起名,template选择Hello uCOS II开始uCOS的工程建立:
25.finish。编译整个工程,Run as-> NIOS II Hardware。其中hello_ucosii.c:
/************************************************************************* * Copyright (c) 2004 Altera Corporation, San Jose, California, USA. * * All rights reserved. All use of this software and documentation is * * subject to the License Agreement located at the end of this file below.* ************************************************************************** * Description: * * The following is a simple hello world program running MicroC/OS-II.The * * purpose of the design is to be a very simple application that just * * demonstrates MicroC/OS-II running on NIOS II.The design doesn't account* * for issues such as checking system call return codes. etc. * * * * Requirements: * * -Supported Example Hardware Platforms * * Standard * * Full Featured * * Low Cost * * -Supported Development Boards * * Nios II Development Board, Stratix II Edition * * Nios Development Board, Stratix Professional Edition * * Nios Development Board, Stratix Edition * * Nios Development Board, Cyclone Edition * * -System Library Settings * * RTOS Type - MicroC/OS-II * * Periodic System Timer * * -Know Issues * * If this design is run on the ISS, terminal output will take several* * minutes per iteration. * **************************************************************************/ #include <stdio.h> #include "includes.h" /* Definition of Task Stacks */ #define TASK_STACKSIZE 2048 OS_STK task1_stk[TASK_STACKSIZE]; OS_STK task2_stk[TASK_STACKSIZE]; /* Definition of Task Priorities */ #define TASK1_PRIORITY 1 #define TASK2_PRIORITY 2 /* Prints "Hello World" and sleeps for three seconds */ void task1(void* pdata) { while (1) { printf("Hello from task1\n"); OSTimeDlyHMSM(0, 0, 3, 0); } } /* Prints "Hello World" and sleeps for three seconds */ void task2(void* pdata) { while (1) { printf("Hello from task2\n"); OSTimeDlyHMSM(0, 0, 3, 0); } } /* The main function creates two task and starts multi-tasking */ int main(void) { OSTaskCreateExt(task1, NULL, (void *)&task1_stk[TASK_STACKSIZE-1], TASK1_PRIORITY, TASK1_PRIORITY, task1_stk, TASK_STACKSIZE, NULL, 0); OSTaskCreateExt(task2, NULL, (void *)&task2_stk[TASK_STACKSIZE-1], TASK2_PRIORITY, TASK2_PRIORITY, task2_stk, TASK_STACKSIZE, NULL, 0); OSStart(); return 0; } /****************************************************************************** * * * License Agreement * * * * Copyright (c) 2004 Altera Corporation, San Jose, California, USA. * * All rights reserved. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the "Software"), * * to deal in the Software without restriction, including without limitation * * the rights to use, copy, modify, merge, publish, distribute, sublicense, * * and/or sell copies of the Software, and to permit persons to whom the * * Software is furnished to do so, subject to the following conditions: * * * * The above copyright notice and this permission notice shall be included in * * all copies or substantial portions of the Software. * * * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * * DEALINGS IN THE SOFTWARE. * * * * This agreement shall be governed in all respects by the laws of the State * * of California and by the laws of the United States of America. * * Altera does not recommend, suggest or require that this reference design * * file be used in conjunction or combination with any other product. * ******************************************************************************/26.在Nios II Console中打印出多任务并行的语句。
27.以上是uCOS在NIOS处理器上的移植,边操作边记录,如有不妥还请指教。
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。