项目作者: Matiasus

项目描述 :
stm32f103 - Toolchains for Ubuntu
高级语言:
项目地址: git://github.com/Matiasus/stm32f103c8t6.git
创建时间: 2020-02-24T14:19:39Z
项目社区:https://github.com/Matiasus/stm32f103c8t6

开源协议:GNU General Public License v3.0

下载


Start with stm32 in Ubuntu 20.04

Dependencies / Softwer

  • Install libusb - userspace USB programming library development files
  • Install stlink - open source toolset to program and debug STM32 devices and boards
  • Install GNU Arm Embedded Toolchain - is a ready-to-use, open-source suite of tools for C, C++ and assembly programming
  • STM32-Template - according to Geoffrey Brown stm32 template
  • Standard Periheral Library - the Library includes a complete register address mapping with all bits, bitfields and registers declared in C a collection of routines and data structures covering all peripheral functions (drivers with common API)

Install libusb

  1. ubuntu@ubuntu:~$ sudo apt-get install libusb-1.0-0-dev

There are two possible ways described how to install stlink, e.g.:

Install .deb package

Download and install .deb package using Software Center. Another possible way to install stlink is described in section below.

Install from source

Install stlink into folder /opt

  1. ubuntu@ubuntu:~$ cd /opt
  2. ubuntu@ubuntu:~$ git clone https://github.com/texane/stlink.git
  3. ubuntu@ubuntu:~$ cd stlink
  4. ubuntu@ubuntu:~$ make clean
  5. ubuntu@ubuntu:~$ make release
  6. ubuntu@ubuntu:~$ make install
  1. // install udev rules
  2. ubuntu@ubuntu:~$ sudo cp etc/udev/rules.d/49-stlinkv* /etc/udev/rules.d/
  3. // restart sudo restart udev
  4. ubuntu@ubuntu:~$ sudo udevadm control --reload
  5. // using this command no need to disconnect and connect device
  6. ubuntu@ubuntu:~$ sudo udevadm trigger

Troubleshooting

  1. // error message
  2. st-info: error while loading shared libraries: libstlink.so.1:
  3. cannot open shared object file: No such file or directory.
  4. // solving
  5. ubuntu@ubuntu:~$ sudo ldconfig

Install GNU Toolchain

The GNU Arm Embedded toolchain contains integrated and validated packages featuring the GCC compiler, libraries, and other tools necessary for bare-metal software development.

Download and extract GNU Toolchain. Then copy extracted files into folder /opt/gcc-arm:

  1. ubuntu@ubuntu:~$ sudo cp -a /home/<your name of home directory>/Downloads/<Extracted GNU Toolchain package> /opt/gcc-arm

Structure of folder /opt/gcc-arm should look like:

  • arm-none-eabi
  • bin
  • lib
  • share
  1. ubuntu@ubuntu:~$ sudo ln -s /opt/gcc-arm/bin/arm-none-eabi-gcc /usr/bin/arm-none-eabi-gcc
  2. ubuntu@ubuntu:~$ sudo ln -s /opt/gcc-arm/bin/arm-none-eabi-ar /usr/bin/arm-none-eabi-ar
  3. ubuntu@ubuntu:~$ sudo ln -s /opt/gcc-arm/bin/arm-none-eabi-as /usr/bin/arm-none-eabi-as
  4. ubuntu@ubuntu:~$ sudo ln -s /opt/gcc-arm/bin/arm-none-eabi-objcopy /usr/bin/arm-none-eabi-objcopy
  5. ubuntu@ubuntu:~$ sudo ln -s /opt/gcc-arm/bin/arm-none-eabi-size /usr/bin/arm-none-eabi-size

Trobleshooting

  1. // error message
  2. arm-none-eabi-gdb: error while loading shared libraries: libncurses.so.5:
  3. cannot open shared object file: No such file or directory
  4. // solve
  5. ubuntu@ubuntu:~$ sudo apt-get install libncurses5

Links