Xilinx Vitis 2021 Cannot create listening port tcp:127.0.0.1:3121: Socket bind error

本文档详细记录了在使用Xilinx Vitis 2021时遇到的编程设备错误及其解决过程。首先尝试了官方文档的建议,但未成功。然后通过打开XSCT Console并运行特定命令重新连接设备,问题得到解决。当该方法仍无法正常工作时,检查并重新安装FTDI驱动,并尝试通过修改TCP端口范围来解决问题。最后,通过禁用Hyper-V或执行其他网络端口设置解决了问题,使得设备能够顺利编程。
摘要由CSDN通过智能技术生成

Update on September 13, 2022: please refer to To V Or Not To V? – FPGA Coding.

In Xilinx Vitis 2021, Menu->Xilinx->Program Device:

It showed an error:

I referred to 67426 - SDSoC - Cannot debug application when targeting a custom platform (xilinx.com)https://support.xilinx.com/s/article/67426?language=en_US

but it is not applicable for Xilinx Vitis 2021. Inspired by【分享】如何使用coresight作为MPSoC的标准输入输出? - HankFu - 博客园 (cnblogs.com)https://www.cnblogs.com/hankfu/p/14441851.html

I opened Menu->Xilinx->XSCT Console and ran

connect

If closing Xilinx Vivado on my computer and tried to reconnect, it succeeded:

Then, re-program the device; anything would be OK. Sometimes this still does not work. However, it seems that restarting the computer always works. What is the reason for this indeed?

  1. Try to reinstall the drivers:
    cd F:\Xilinx\Vivado\2022.1\data\xicom\cable_drivers\nt64
    install_drivers_wrapper.bat
  2. Check the driver setup for the FTDI device. In Device Manager->Universal Serial Bus controllers->USB Serial Converter A and USB Serial Converter B:

    Check the "Driver" tab:

    To Update Driver does not update because it is already the latest. Check "Driver Details":

    Check the "Details" tab and select "Bus reported device description" Property. Check the value "Diligent Adept USB Device":
  3. Run
    F:\Xilinx\Vivado\2022.1\bin\unwrapped\win64.o\hw_server.exe

    in CMD. It should output

    ****** Xilinx hw_server v2022.1.2
      **** Build date : Aug  5 2022 at 23:12:38
        ** Copyright 1986-2022 Xilinx, Inc. All Rights Reserved.

    INFO: hw_server application started
    INFO: Use Ctrl-C to exit hw_server application

    INFO: To connect to this hw_server instance use url: TCP:Administrator:3121

    but it instead shows:

    Cannot create listening port: Socket bind error. An attempt was made to access a socket in a way forbidden by its access permissions

  4. Run

    netstat -ano | findstr 3121

    or

    netstat -abp TCP | find “3121”

    but found nothing. No processes are listening or connected to that port.

  5. Test by code:

    int createListenSocket(int port) {
        errCode = E_NONE;
     
        auto s = socket(PF_INET, SOCK_STREAM, 0);
        SOCKADDR_IN sin;
     
        sin.sin_family = PF_INET;
        sin.sin_addr.s_addr = 0;
        sin.sin_port = htons(port);
     
        auto result = bind(s, (LPSOCKADDR)&sin, sizeof(sin));
        if (result) {
            errCode = WSAGetLastError();
            closesocket(s);
            return errCode;
        }
     
        result = listen(s, SOMAXCONN);
        if (result) {
            errCode = WSAGetLastError();
        }
     
        closesocket(s);
        return errCode;
    }
     
    int main(int argc, char *argv[]) {
        auto result = initWinsock();
     
        // check ports
        result = createListenSocket(3121);
     
        assert(result == E_NONE);
     
        // cleanup
        WSACleanup();
    }

    The code was unable to bind successfully to port 3121.

  6. One way is to run hw_server by

    hw_server.exe -s tcp::50000

    However, it cannot change 3001-3003:

    Warning: Cannot create '3001:arm64' GDB server: An attempt was made to access a socket in a way forbidden by its access permissions Warning: Cannot create '3002:microblaze' GDB server: An attempt was made to access a socket in a way forbidden by its access permissions Warning: Cannot create '3003:microblaze64' GDB server: An attempt was made to access a socket in a way forbidden by its access permissions

    If try

    connect_hw_server -url TCP:localhost:50000

    it will show the error:

    INFO: [Labtools 27-2285] Connecting to hw_server url TCP:localhost:50000 INFO: [Labtools 27-3415] Connecting to cs_server url TCP:localhost:3042 INFO: [Labtools 27-3417] Launching cs_server... INFO: [Labtools 27-2221] Launch Output: Traceback (most recent call last): File "git_cs_server\chipscope\server\main.py", line 401, in <module> File "git_cs_server\chipscope\server\main.py", line 397, in main File "site-packages\click-7.0-py3.7.egg\click\core.py", line 764, in __call__ File "site-packages\click-7.0-py3.7.egg\click\core.py", line 717, in main File "site-packages\click-7.0-py3.7.egg\click\core.py", line 956, in invoke File "site-packages\click-7.0-py3.7.egg\click\core.py", line 555, in invoke File "git_cs_server\chipscope\server\main.py", line 279, in start_server File "git_cs_server\chipscope\server\main.py", line 259, in start_server File "git_cs_server\chipscope\server\main.py", line 293, in __init__ OSError: [WinError 10013] An attempt was made to access a socket in a way forbidden by its access permissions [22024] Failed to execute script main ERROR: [Labtools 27-3733] Error during cs_server initialization: Unable to connect to cs_server at URL: TCP:localhost:3042. connect_hw_server: Time (s): cpu = 00:00:00 ; elapsed = 00:00:14 . Memory (MB): peak = 1042.156 ; gain = 0.000 ERROR: [Common 17-39] 'connect_hw_server' failed due to earlier errors.

  7. The second way is to disable Hyper-V in Settings->Apps & Features->Programs and Features->Windows Features, which is to host Windows Subsystem for Linux (WSL). However, the problem also exists on machines that do not enable Hyper-V.

  8. The final solution is given in another article:netsh int ip 添加/删除 TCP 协议 excludedportrange 的方法_Ayka的博客-CSDN博客. After that, re-program the device. In XSCT Console->XSCT Process:

xsct% 
****** Xilinx Software Commandline Tool (XSCT) v2022.1.2
  **** SW Build 49 on 2022-08-02-23:22:20
    ** Copyright 1986-2022 Xilinx, Inc. All Rights Reserved.


XSDB Server URL: TCP:localhost:1137
xsct% XSDB Server Channel: tcfchan#0
INFO: [Hsi 55-2053] elapsed time for repository (F:/Xilinx/Vitis/2022.1/data/embeddedsw) loading 0 seconds
attempting to launch hw_server

****** Xilinx hw_server v2022.1.2
  **** Build date : Aug  5 2022 at 23:12:38
    ** Copyright 1986-2022 Xilinx, Inc. All Rights Reserved.

INFO: hw_server application started
INFO: Use Ctrl-C to exit hw_server application

****** Xilinx hw_server v2022.1.2

  **** Build date : Aug  5 2022 at 23:12:38

    ** Copyright 1986-2022 Xilinx, Inc. All Rights Reserved.

INFO: hw_server application started

INFO: Use Ctrl-C to exit hw_server application


INFO: To connect to this hw_server instance use url: TCP:127.0.0.1:3121


initializing
  0%    0MB   0.0MB/s  ??:?? ETA
 27%    1MB   2.1MB/s  ??:?? ETA
 49%    1MB   1.8MB/s  ??:?? ETA
 68%    2MB   1.7MB/s  ??:?? ETA
 94%    3MB   1.7MB/s  ??:?? ETA
100%    3MB   1.8MB/s  00:02    

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Ayka

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值