当前位置:网站首页>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模板 。
边栏推荐
- Leecode brush questions record sword finger offer 11 Rotate the minimum number of the array
- uniapp中redirectTo和navigateTo的区别
- On February 19, 2021ccf award ceremony will be held, "why in Hengdian?"
- Oracle EMCC 13.5 environment in docker every minute
- Leecode brush questions record sword finger offer 43 The number of occurrences of 1 in integers 1 to n
- MIT 6.824 - Raft学生指南
- 刘永鑫报告|微生物组数据分析与科学传播(晚7点半)
- Introduction au GPIO
- Use type aliases in typescript
- Compilation of kickstart file
猜你喜欢

刘永鑫报告|微生物组数据分析与科学传播(晚7点半)

准备好在CI/CD中自动化持续部署了吗?

On February 19, 2021ccf award ceremony will be held, "why in Hengdian?"

2022年PMP项目管理考试敏捷知识点(9)

Core knowledge of distributed cache

JWT signature does not match locally computed signature. JWT validity cannot be asserted and should

DAY ONE

量子时代计算机怎么保证数据安全?美国公布四项备选加密算法

rancher集成ldap,实现统一账号登录

Lombok 同时使⽤ @Data 和 @Builder 的坑,你中招没?
随机推荐
Encryption algorithm - password security
Interface master v3.9, API low code development tool, build your interface service platform immediately
48 page digital government smart government all in one solution
Pytest multi process / multi thread execution test case
Leecode brush questions record sword finger offer 44 A digit in a sequence of numbers
基于GO语言实现的X.509证书
X.509 certificate based on go language
陀螺仪的工作原理
Three sentences to briefly introduce subnet mask
Things like random
Racher integrates LDAP to realize unified account login
kubernetes部署ldap
TypeScript增量编译
[automated testing framework] what you need to know about unittest
dynamic programming
谷歌百度雅虎都是中国公司开发的通用搜索引擎_百度搜索引擎url
[CVPR 2022] target detection sota:dino: Detr with improved detecting anchor boxes for end to end object detection
Introduction to GPIO
PostgreSQL uses pgpool II to realize read-write separation + load balancing
Quickly use various versions of PostgreSQL database in docker