本帖最后由 andeyqi 于 2018-12-29 10:08 编辑
之前在linux使用过JLINK方式开发stm32,不过官方的板子都是自带的STLIK,偶然间发现一个开源的STLINK驱动,终于可以再linux调试自带STLINK的板子了。
①获取源代码:
http://github.com/texane/stlink
②安装依赖的工具包
编译工具使用的是cmake和libusb,最低版本要求为 2.8.7
- cmake_minimum_required(VERSION 2.8.7)
复制代码- sudo apt-get install libusb-1.0-0-dev cmake
复制代码 UBUNTU安装版本3.5.1能够满足最低要求
- andey@andey-VirtualBox:~$ cmake --version
- cmake version 3.5.1
- CMake suite maintained and supported by Kitware (kitware.com/cmake).
复制代码
③编译安装源码
安装过程参照如下链接文档:
http://github.com/texane/stlink/blob/master/doc/compiling.md
④运行效果安装完成后,会在系统中安装st-util 工具,使用方法如下:
- ^Candey@andey-VirtualBox:~$ st-util --help
- st-util - usage:
- -h, --help Print this help
- -V, --version Print the version
- -vXX, --verbose=XX Specify a specific verbosity level (0..99)
- -v, --verbose Specify generally verbose logging
- -s X, --stlink_version=X
- Choose what version of stlink to use, (defaults to 2)
- -1, --stlinkv1 Force stlink version 1
- -p 4242, --listen_port=1234
- Set the gdb server listen port. (default port: 4242)
- -m, --multi
- Set gdb server to extended mode.
- st-util will continue listening for connections after disconnect.
- -n, --no-reset
- Do not reset board on connection.
- --semihosting
- Enable semihosting support.
- --serial <serial>
- Use a specific serial number.
- The STLINKv2 device to use can be specified in the environment
- variable STLINK_DEVICE on the format <USB_BUS>:<USB_ADDR>.
复制代码
- andey@andey-VirtualBox:~$ st-util
- st-util 1.5.1
- 2018-12-28T12:06:28 INFO common.c: Loading device parameters....
- 2018-12-28T12:06:28 INFO common.c: Device connected is: F04x device, id 0x10006445
- 2018-12-28T12:06:28 INFO common.c: SRAM size: 0x1800 bytes (6 KiB), Flash: 0x8000 bytes (32 KiB) in pages of 1024 bytes
- 2018-12-28T12:06:28 INFO gdb-server.c: Chip ID is 00000445, Core ID is 0bb11477.
- 2018-12-28T12:06:28 INFO gdb-server.c: Listening at *:4242...
复制代码
除了命令行的工具外,还会安装带ui的:stlink-gui工具
连接后会自动识别出芯片的型号,coreid等信息,跟jlink的下载界面很相似,熟悉的味道,熟悉的感觉。
最新master 源码安装包如下:
stlink-master.zip
(223.23 KB, 下载次数: 45)
|
感谢支持
多谢 支持
linux开发的话 就能用STlink调试了,以前尝试opendcd没搞定,一直没找到合适的工具,这下找到个能用的了