Windows下Vivado hw_server 由于端口绑定失败无法启动的解决方法

在Windows上使用Vivado hw_server 可能会遇到类似问题:

INFO: [Labtools 27-2285] Connecting to hw_server url TCP:localhost:3121
INFO: [Labtools 27-2222] Launching hw_server...
INFO: [Labtools 27-2221] Launch Output:

****** Xilinx hw_server v2020.1
  **** Build date : May 27 2020 at 20:24:38
    ** Copyright 1986-2020 Xilinx, Inc. All Rights Reserved.
ERROR: [Labtools 27-2220] Launch Error:
Unable to launch local hw_server executable.

ERROR: [Common 17-39] 'connect_hw_server' failed due to earlier errors.

查看Console输出定位到 hw_server 的报错信息

****** Xilinx hw_server v2020.1
 **** Build date : May 27 2020 at 20:24:38
   ** Copyright 1986-2020 Xilinx, Inc. All Rights Reserved.

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

Cannot create listening port: Socket bind error.

查找资料发现是Windows系统保留了部分端口不允许应用使用导致的,一个解决方法如下:

管理员权限运行cmd或powershell,运行命令

netsh int ip show excludedportrange protocol=tcp

可以看到输出如下,保留端口包括了hw_server的3121等端口

协议 tcp 端口排除范围

开始端口    结束端口
----------    --------
      7257        7356
      7357        7456
      7457        7556
      7557        7656
      7681        7780
      7781        7880
      7881        7980
      7981        8080
      8081        8180
      8181        8280
      8281        8380
      8381        8480
      8481        8580
      8681        8780
      8781        8880
      8881        8980
     50000       50059     *

* - 管理的端口排除。

为了正常运行hw_server 需要允许应用使用必要端口,关闭wsl、虚拟机等用到Hyper-V以及NAT的程序,运行如下命令:

net stop winnat 
netsh int ip add excludedportrange protocol=tcp numberofports=3 startport=3000
netsh int ip add excludedportrange protocol=tcp numberofports=1 startport=3121
net start winnat 

此时netsh int ip show excludedportrange protocol=tcp查看保留端口:

协议 tcp 端口排除范围

开始端口    结束端口
----------    --------
      3000        3002     *
      3121        3121     *
      7257        7356
      7357        7456
      7457        7556
      7557        7656
      7681        7780
      7781        7880
      7881        7980
      7981        8080
      8081        8180
      8181        8280
      8281        8380
      8381        8480
      8481        8580
      8681        8780
      8781        8880
      8881        8980
     50000       50059     *

* - 管理的端口排除。

可见3121 等端口已经排除(带*)在保留端口外。

现可成功运行hw_server

posted @ 2024-07-17 21:42  Ddddavid-he  阅读(615)  评论(0)    收藏  举报