zoukankan      html  css  js  c++  java
  • Ubuntu18.04搭建STM32开发环境

    1、安装STM32CUbeMX

    利用STM32CubeMX生成stm32工程,以及Makefile文件。(在Toolchain/IDE中记得选择Makefile)

    下载地址:https://www.st.com/content/st_com/zh/products/development-tools/software-development-tools/stm32-software-development-tools/stm32-configurators-and-code-generators/stm32cubemx.html

    STM32CubeMX-4.24.0安装包解压后有四个文件:

    Readme.html
    SetupSTM32CubeMX-4.24.0.app
    SetupSTM32CubeMX-4.24.0.exe
    SetupSTM32CubeMX-4.24.0.linux

    执行./SetupSTM32CubeMX-4.24.0.linux安装。

    可能遇到问题:

    a. 如果SetupSTM32CubeMX-4.24.0.linux是32位的可执行文件,而我的Ubuntu是64位系统。首先安装32位运行时库。

    sudo apt install libc6-i386

    b. 需要java运行环境

    sudo apt install default-jre

    2、安装GDB Sever

      该工具往下用于连接jlink或stlink,往上提供reset,halt,flash等常用功能,用于程序下载和调试。此处选用OpenOCD,使用方便且开源。

    2.1 指令安装版本较低

    sudo apt install openocd 

    2.2 编译安装

    git clone git://git.code.sf.net/p/openocd/code openocd
    cd openocd
    sudo ./bootstrap
    sudo ./configure
    make
    sudo make install

    测试是否安装成功:

    openocd --version

    可能遇到问题:

        + aclocal
        + libtoolize --automake --copy
        + autoconf
        configure.ac:12: error: possibly undefined macro: AC_MSG_WARN
              If this token and others are legitimate, please use m4_pattern_allow.
              See the Autoconf documentation.
        configure.ac:36: error: possibly undefined macro: AC_DISABLE_SHARED
        configure.ac:37: error: possibly undefined macro: AC_PROG_LIBTOOL
        configure.ac:204: error: possibly undefined macro: AC_DEFINE
        configure.ac:608: error: possibly undefined macro: AC_MSG_NOTICE

    缺少libtool和libsysfs-dev

    sudo apt-get install libtool libsysfs-dev

    3、编译工具链

    3.1 指令安装

    sudo add-apt-repository ppa:team-gcc-arm-embedded/ppa
    sudo apt-get update
    sudo apt-get install gcc-arm-embedded

    4、Vscode安装配置

    4.1 Cortex-debug插件

     launch.json例子:

        {
            "version": "0.2.0",
            "configurations": [
                {
                    "name": "Cortex Debug",
                    "cwd": "${workspaceRoot}",
                    "executable": "build/L496ZGTx_LPUASRT.elf",
                    "request": "launch",
                    "type": "cortex-debug",
                    "servertype": "openocd",
                    "BMPGDBSerialPort": "/dev/ttyACM0",
                    "runToMain": true,
                    "device": "STM32L496ZG",
                    //"preLaunchTask": "build-elf",
                    "configFiles": [
                        "board/st_nucleo_l4.cfg"
                    ]
         
                }
            ]
        }

    4.3 PlatformIO IDE插件

    请戳:http://docs.platformio.org/en/latest/ide/vscode.html#quick-start

  • 相关阅读:
    [转]MyBatis传入多个参数的问题
    【转】赶集网mysql开发36军规
    C#套接字和windowsAPI套接字
    java中的注解
    java中的枚举类型
    过去的汇编代码
    近日错误集锦
    java swing模仿随机频谱
    java泛型中的对象
    XML-RPC远程方法调用
  • 原文地址:https://www.cnblogs.com/Mike2019/p/13577029.html
Copyright © 2011-2022 走看看