2018/12/27

stm32f4 discovery board, test run in debian.

stlink 沒有 package,要從 source code build
build 文件參考 Compiling

大概就是...需要 build-essential, cmake, libusb-1.0-0-dev , libgtk-3-dev(if stlink-gui)

ref:
發現 debian 有..stlink-tools,package 頁面,列出的主頁面就是texane/stlink
所以大概是一樣的。

所以就 apt-get install slink-tools 就可以

cross-compile 用 gcc-arm-none-eabi 這個 package 就可以。
debian 的 arm-none-eabi-gdb 在 gdb-arm-none-eabi 這個 package 中。

所以合起來,toolchain and download utility 就是.
  • stlink-tools
  • gcc-arm-none-eabi
  • gdb-arm-none-eabi

Test build and run.

libopencm3 的 example 來測試就可以,
git clone https://gitub.com/libopencm3/libopencm3-examples.git
cd libopencm3-examples
git submodule init
git submodule update
然後就可以直接 make..


ref:how to compile and burn the code to stm32 chip on linux ubuntu

很奇怪的是,用 package 的版本,TrueStudio 沒辦法正確invoke。
follow github 版本 make, install 之後,TrueStudio 就可以正卻進入 debug mode..
git clone git@github.com:texane/stlink.git
cd stlink
make release
cd build/Release
然後 sudo make install
log:
[ 23%] Built target stlink-static
[ 46%] Built target stlink
[ 53%] Built target st-info
[ 63%] Built target st-flash
[ 76%] Built target st-util
[ 86%] Built target flash
[ 93%] Built target sg
[100%] Built target usb
Install the project...
-- Install configuration: "Release"
-- Installing: /usr/local/lib/libstlink.so.1.5.1
-- Installing: /usr/local/lib/libstlink.so.1
-- Installing: /usr/local/lib/libstlink.so
-- Installing: /usr/local/lib/libstlink.a
-- Installing: /usr/local/bin/st-flash
-- Set runtime path of "/usr/local/bin/st-flash" to ""
-- Installing: /usr/local/bin/st-info
-- Set runtime path of "/usr/local/bin/st-info" to ""
-- Installing: /etc/modprobe.d/stlink_v1.conf
-- Installing: /etc/udev/rules.d/49-stlinkv1.rules
-- Installing: /etc/udev/rules.d/49-stlinkv2-1.rules
-- Installing: /etc/udev/rules.d/49-stlinkv2.rules
-- Installing: /etc/udev/rules.d/49-stlinkv3.rules
-- Installing: /usr/local/bin/st-util
-- Set runtime path of "/usr/local/bin/st-util" to ""
-- Installing: /usr/local/lib/pkgconfig/stlink.pc
-- Installing: /usr/local/include/stlink.h
-- Installing: /usr/local/include/stlink/backend.h
-- Installing: /usr/local/include/stlink/chipid.h
-- Installing: /usr/local/include/stlink/commands.h
-- Installing: /usr/local/include/stlink/flash_loader.h
-- Installing: /usr/local/include/stlink/logging.h
-- Installing: /usr/local/include/stlink/mmap.h
-- Installing: /usr/local/include/stlink/reg.h
-- Installing: /usr/local/include/stlink/sg.h
-- Installing: /usr/local/include/stlink/usb.h
-- Installing: /usr/local/include/stlink/version.h
-- Installing: /usr/local/share/man/man1/st-util.1
-- Installing: /usr/local/share/man/man1/st-flash.1
-- Installing: /usr/local/share/man/man1/st-info.1
因為 rules 有改變,所以如果不要重新開機,要叫 udev reload:
#udevadm control --reload-rules
#udevadm trigger

TrueStudio 的 Debug Configuration 選 :
  • Debug Probe: ST-LINK
  • Audostart local GDB server
  • Hostname or IP adress : localhost
  • Port Number: 61234
-- all are the default value of 'ST-LINK' option

沒有留言:

張貼留言