RISC-V OpenOCD Windows下编译环境搭建

1. 安装MinGW64

  MinGW-w64 官方网站的地址是:http://mingw-w64.org ,点击红框中的“Downloads”超链接,进入 MinGW-w64 下载详情页面。

2. 安装Msys2

     MSYS2

3. 配置工具链及基本编译需要的工具及库文件:

# pacman -Syu

# pacman -S --needed base-devel

# pacman -S mingw-w64-i686-pkg-config

# pacman -S --needed  autoconf

# pacman -S --needed  automake

# pacman -S --needed libtool

# pacman -S mingw-w64-x86_64-libftdi

# pacman -S mingw-w64-x86_64-libusb

# pacman -S mingw-w64-x86_64-libftdi

4. 如果编译OpenOCD支持cmsis-dap,还需要安装HIDAPI库,下载 hidapi:

$ cd ~
$ git clone https://github.com/signal11/hidapiGitHub - signal11/hidapi: A Simple library for communicating with USB and Bluetooth HID devices on Linux, Mac, and Windows.A Simple library for communicating with USB and Bluetooth HID devices on Linux, Mac, and Windows. - GitHub - signal11/hidapi: A Simple library for communicating with USB and Bluetooth HID devices on Linux, Mac, and Windows.https://github.com/signal11/hidapi.git
$ cd hidapi
$ ./bootstrap 
$ ./configure --disable-shared

$ make
$ make install
$ cd ~
会把 hidapi 库安装到 /usr/local/lib 目录下,
$ ll /usr/local/lib 应是这样:

5. OpenOCD 编译时默认连接 hidapi 和 libusb-1.0 以及libftdi1的动态库,因此把静态库覆盖动态库
    $ cp /usr/local/lib/libhidapi.a /usr/local/lib/libhidapi.dll.a
    $ cp /usr/local/lib/libusb-1.0.a /usr/local/lib/libusb-1.0.dll.a

    $ cp /usr/local/lib/libftdi1.a /usr/local/lib/libftdi1.dll.a

7. 下载RISC-V对应的Openocd:

     $ git clone https://github.com/riscv/riscv-openocd.git

8. 依次执行以下命令:

     $./bootstrap

     $ ./configure --prefix=/home/bin --enable-fdti --enable-jlink --enable-ftdi-oscan1 --enable-cmsis-dap --enable-static=yes --disable-shared PKG_CONFIG_PATH=/mingw64/lib/pkgconfig

     $ make && make install

9. 最后在/home/bin下生成不需要依赖动态库的OpenOCD,用生成的OpenOCD连接GD32VF103V如下所示:

  • 2
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 4
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值