当前位置:网站首页>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模板 。
边栏推荐
- If the college entrance examination goes well, I'm already graying out at the construction site at the moment
- [daily problem insight] prefix and -- count the number of fertile pyramids in the farm
- Pytest multi process / multi thread execution test case
- openresty ngx_ Lua subrequest
- 基於GO語言實現的X.509證書
- Compilation of kickstart file
- Leecode brush questions record sword finger offer 11 Rotate the minimum number of the array
- Imeta | Chen Chengjie / Xia Rui of South China Agricultural University released a simple method of constructing Circos map by tbtools
- 2022 PMP project management examination agile knowledge points (9)
- Use source code compilation to install postgresql13.3 database
猜你喜欢

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

1000字精选 —— 接口测试基础

DAY TWO

Lombok 同时使⽤ @Data 和 @Builder 的坑,你中招没?

基於GO語言實現的X.509證書

Mujoco Jacobi - inverse motion - sensor

What can the interactive slide screen demonstration bring to the enterprise exhibition hall

What is AVL tree?

智能运维应用之道,告别企业数字化转型危机

Uniapp uploads and displays avatars locally, and converts avatars into Base64 format and stores them in MySQL database
随机推荐
[CVPR 2022] target detection sota:dino: Detr with improved detecting anchor boxes for end to end object detection
The way of intelligent operation and maintenance application, bid farewell to the crisis of enterprise digital transformation
Lombok 同时使⽤ @Data 和 @Builder 的坑,你中招没?
Pytest multi process / multi thread execution test case
DAY ONE
File and image comparison tool kaleidoscope latest download
pytest多进程/多线程执行测试用例
509 certificat basé sur Go
Mujoco second order simple pendulum modeling and control
Data analysis course notes (V) common statistical methods, data and spelling, index and composite index
uniapp中redirectTo和navigateTo的区别
Mujoco Jacobi - inverse motion - sensor
37 pages Digital Village revitalization intelligent agriculture Comprehensive Planning and Construction Scheme
2022/2/12 summary
如何判断一个数组中的元素包含一个对象的所有属性值
Leecode brush questions record sword finger offer 44 A digit in a sequence of numbers
三维扫描体数据的VTK体绘制程序设计
Leecode brush question record sword finger offer 58 - ii Rotate string left
Are you ready to automate continuous deployment in ci/cd?
刘永鑫报告|微生物组数据分析与科学传播(晚7点半)