当前位置:网站首页>ZYNQ移植uCOSIII
ZYNQ移植uCOSIII
2022-07-06 16:48:00 【Chenxr32】
我参考B站上的视频《FPGA(ZYNQ)上运行UC/OS的实例-TCP通讯》,在自己的ZYNQ开发板上移植uCOSIII操作系统,配置BSP,这里记录部分步骤。
软件:Vivado 2017.4
芯片:xc7z010clg400-1
硬件设计
第一步:新建Vivado工程,创建Block Design,在Block Design中添加ZYNQ7 Processing System IP核。
第二步:配置ZYNQ7 Processing System IP核。
配置PS的UART,点击Peripheral I/O Pins页面,选择UART1,我的板子引出的是MIO48和MIO49,波特率设置为115200。
配置PS的Ethernet,点击Peripheral I/O Pins页面,选择Ethernet0,我的板子用的PHY芯片是RTL8211E,Ethernet0引出的是MIO16~MIO27,MDC和MDIO分配到MIO52、MIO53。
MIO Configuration页面的设置如下图所示。
最后把剩下的所有GPIO MIO选中,留作他用(点灯)。DDR3、PS时钟、中断等配置按自己的需求来,这里不记录了。配置好的Block Design如下图所示。
第三步:验证当前设计,生成顶层HDL模块,导出硬件,启动SDK。
软件设计
第一步:下载uCOSIII代码。
可以到开头视频给的网站上下载。网址:https://github.com/suisuisi/zynq_guide/tree/main/ucos。这是开发操作系统的公司针对ZYNQ的Cortex-A9 CPU移植好的代码,我们不需要做任何修改,只需在SDK中配置一下可以。
第二步:在SDK中导入uCOSIII代码。
解压下载后的压缩包,将uCOSIII代码文件夹放到自己的工程目录下。
点击SDK软件上方的Xilinx->Repositories,在Local Repositories栏中导入uCOSIII代码文件夹的路径,点击“OK”。
第三步:新建应用。
OS Platform选择ucos,点击“Next”。下一页选择Micrium uc/OS-III Hello World模板。(其他模板也可试一试)。
第四步:配置BSP。
右击左侧的ucos_base_bsp,点击Board Support Package Settings,打开配置BSP的界面。
Ovrview中按下图勾选模块,我选了必须要的三个模块,其他模块按需勾选。其中ucos_standalone模块允许我们在代码中使用Xilinx提供的外设驱动代码。
在ucos_standalone中,将stdin和stdout设置为ps7_uart_1,也就是前面我们在硬件设计中选中的UART1。
在drivers中,将ps7_ethernet_0的驱动选为ucos_emacps,留着后面做网络实验用(本文未涉及)。
第五步:写代码。
ucos_base->src->app.c里有自动生成的代码,可以直接编译下载到板子上实验。
#include <stdio.h>
#include <Source/os.h>
#include <ucos_bsp.h>
void MainTask (void *p_arg);
int main()
{
UCOSStartup(MainTask);
return 0;
}
void MainTask (void *p_arg)
{
OS_ERR os_err;
UCOS_Print ("Hello world from the main task\r\n");
while (DEF_TRUE) {
OSTimeDlyHMSM(0, 0, 10, 0, OS_OPT_TIME_HMSM_STRICT, &os_err);
UCOS_Print("Periodic output every 10 seconds from the main task\r\n");
}
}
我还尝试了TCP和DNS的模板,开发板连接路由器,可以成功获得IP地址。
完整的工程下载地址:ZYNQ7010的uCOSIII模板 。
边栏推荐
猜你喜欢

Racher integrates LDAP to realize unified account login

Jenkins' user credentials plug-in installation

如何判断一个数组中的元素包含一个对象的所有属性值

Devops can help reduce technology debt in ten ways

Uniapp uploads and displays avatars locally, and converts avatars into Base64 format and stores them in MySQL database

The programmer resigned and was sentenced to 10 months for deleting the code. Jingdong came home and said that it took 30000 to restore the database. Netizen: This is really a revenge

2021 SASE integration strategic roadmap (I)

37 page overall planning and construction plan for digital Village revitalization of smart agriculture

37頁數字鄉村振興智慧農業整體規劃建設方案

【vulnhub】presidential1
随机推荐
After leaving a foreign company, I know what respect and compliance are
TypeScript中使用类型别名
三维扫描体数据的VTK体绘制程序设计
St table
Everyone is always talking about EQ, so what is EQ?
Pdf document signature Guide
509 certificat basé sur Go
一图看懂对程序员的误解:西方程序员眼中的中国程序员
Cross-entrpy Method
《LaTex》LaTex数学公式简介「建议收藏」
Jenkins' user credentials plug-in installation
ldap创建公司组织、人员
Imeta | Chen Chengjie / Xia Rui of South China Agricultural University released a simple method of constructing Circos map by tbtools
[boutique] Pinia Persistence Based on the plug-in Pinia plugin persist
48 page digital government smart government all in one solution
华为mate8电池价格_华为mate8换电池后充电巨慢
Pytest multi process / multi thread execution test case
What is AVL tree?
【vulnhub】presidential1
如何判断一个数组中的元素包含一个对象的所有属性值