日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

zynq中mgtx应用_基于ZYNQ的UCOS移植(TCP通讯)

發布時間:2023/12/15 编程问答 31 豆豆
生活随笔 收集整理的這篇文章主要介紹了 zynq中mgtx应用_基于ZYNQ的UCOS移植(TCP通讯) 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
周五在某小徐處借到了一塊Zedboard開發板,平時在公司沒有機會做SDK開發的筆記,今天就趁著這塊開發板簡要記錄一些SDK的基本操作。一、功能簡介

? ? 通過第三方庫創建SDK工程

????在ZYNQ-UCOS中實現TCP echo通訊

二、配置需求

操作系統Windows 10(64位)
開發環境SDK 2018.3

三、操作流程

1、添加資源庫。啟動SDK軟件,選擇Xilinx->Repositories彈出Perferences視圖,在Local Repositories中添加ucos資源庫(ucos資源庫下載鏈接見附件部分)。

2、創建新工程。選擇File->New->Application Project彈出New Project視圖,輸入工程名稱ucos_tcp,選擇操作系統平臺ucos,點擊Next>,在彈出的Templates選項中選擇Micrium uc/OS-Ⅱ?Hello World,點擊Finish完成基礎示例工程的創建。

3、配置emac。在ucos_tcp_bsp文件夾上單擊鼠標右鍵,選擇Board Support Pcakage Settings,在彈出的Board Support Pcakage Settings視圖中選擇drivers,修改ucos_emacps為emacps,單擊OK完成emac的配置。

4、移植Lwip。將lwip212文件夾及內容拷貝到工程源文件目錄下(Lwip資源庫下載鏈接見附件部分)。

5、設置頭文件路徑,在src文件夾上單擊鼠標右鍵,選擇Properties,在彈出的Properties for src視圖中選擇C/C++ Build->Settings->Directories,在Include Paths中依次添加lwip212文件下的contrib、contrib/xilinx/include,lwip-2.1.2/include三個文件夾。單擊Apply應用配置變更,單擊OK退出Properties for src視圖。

6、刪除報錯的頭文件。

注釋/ucos_tcp/src/lwip212/contrib/xilinx/include/netif/xemacpsif.h中xuartps.h的引用

注釋/ucos_tcp/src/lwip212/contrib/xilinx/netif/xemacpsif.c中xuartps.h的引用

注釋/ucos_tcp/src/lwip212/contrib/LwipEnter.h中platform_config.h的引用

7、修改入口函數文件。將app.c文件進行如下修改。/*********************************************************************************************************** uCOS XSDK BSP** (c) Copyright 2014-2020; Silicon Laboratories Inc.,* 400 W. Cesar Chavez, Austin, TX 78701** All rights reserved. Protected by international copyright laws.** Your use of this software is subject to your acceptance of the terms* of a Silicon Labs Micrium software license, which can be obtained by* contacting info@micrium.com. If you do not agree to the terms of this* license, you may not use this software.** Please help us continue to provide the Embedded community with the finest* software available. Your honesty is greatly appreciated.** You can find our product's documentation at: doc.micrium.com** For more information visit us at: www.micrium.com**********************************************************************************************************//*********************************************************************************************************** SETUP INSTRUCTIONS** This demonstration project illustrate a basic uC/OS-II project with simple "hello world" output.** By default some configuration steps are required to compile this example :** 1. Include the require Micrium software components* In the BSP setting dialog in the "overview" section of the left pane the following libraries* should be added to the BSP :** ucos_common* ucos_osii* ucos_standalone** 2. Kernel tick source - (Not required on the Zynq-7000 PS)* If a suitable timer is available in your FPGA design it can be used as the kernel tick source.* To do so, in the "ucos" section select a timer for the "kernel_tick_src" configuration option.** 3. STDOUT configuration* Output from the print() and UCOS_Print() functions can be redirected to a supported UART. In* the "ucos_standalone" section the stdout configuration will list the available UARTs.** Troubleshooting :* By default the Xilinx SDK may not have selected the Micrium drivers for the timer and UART.* If that is the case they must be manually selected in the drivers configuration section.** Finally make sure the FPGA is programmed before debugging.*** Remember that this example is provided for evaluation purposes only. Commercial development requires* a valid license from Micrium.**********************************************************************************************************//*********************************************************************************************************** INCLUDE FILES**********************************************************************************************************/#include #include #include #include "ucos_ii.h"#include "LwipEnter.h"/*********************************************************************************************************** LOCAL FUNCTION PROTOTYPES**********************************************************************************************************/OS_STK Polling_thread_Stk[256u];OS_STK LwipEnter_thread_Stk[512u];void MainTask (void *p_arg);void PollingTask (void *p_arg);/*********************************************************************************************************** main()** Description : Entry point for C code.***********************************************************************************************************/int main(){ UCOSStartup(MainTask); return 0;}/*********************************************************************************************************** MainTask()** Description : Startup task example code.** Returns : none.** Created by : main().**********************************************************************************************************/void MainTask (void *p_arg){ OS_CPU_SR cpu_sr; OS_ENTER_CRITICAL(); // Create Task OSTaskCreate(PollingTask, (void*)0, (OS_STK*)&Polling_thread_Stk[255u], 20u); OSTaskCreate(LwipEnter_thread, (void*)0, (OS_STK*)&LwipEnter_thread_Stk[511u], 50); OS_EXIT_CRITICAL(); // Suspend this Start Task after initialization OSTaskSuspend(OS_PRIO_SELF);}/*********************************************************************************************************** PollingTask()** Description : Polling task example code.** Returns : none.** Created by : MainTask().**********************************************************************************************************/void PollingTask (void *p_arg){ UCOS_Print ("Hello world from the main task\r\n"); while (DEF_TRUE) { OSTimeDlyHMSM(0, 0, 3, 0); UCOS_Print("Periodic output every 3 seconds from the main task\r\n"); }}

8、調試配置。調試配置如下圖所示。

9、啟動調試。將測試PC機IP設置為192.168.1.99(與Zedboard處于同一網段),子網掩碼為255.255.255.0。此時即可通過網口調試助手測試TCP的通訊功能。

四、資源鏈接

鏈接:https://pan.baidu.com/s/1iVkFfXC964F7cCZVK8URCA

提取碼:s5p1

總結

以上是生活随笔為你收集整理的zynq中mgtx应用_基于ZYNQ的UCOS移植(TCP通讯)的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。