返回> 网站首页 

在ubuntu下创建stm32开发调试环境

yoours2023-10-02 17:24:02 阅读 1447

简介一边听听音乐,一边写写文章。

一、开发工具

        下载安装VSCode编辑器

二、编译器

        gcc-arm-none-eabi-10.3-2021.10-aarch64-linux.tar.bz2

三、调试工具

        openocd-0.12.0.tar.gz

        1. 安装依赖

        sudo apt install libusb-1.0-0-dev

        sudo apt install libhidapi-dev

        sudo apt install libftdi-dev

        2. 若安装不上  libusb-1.0-0-dev,则下载libusb1.0.26源代码进行编译

            ./configure --build=x86_64-linux --disable-udev

        3. 编译openocd

            tar -zxvf openocd-0.12.0.tar.gz

            ./configure --prefix=/tools/openocd-0.12.0/build/ --enable-cmsis-dap --enable-cmsis-dap-v2 --enable-openjtag

            make

            make install

四、Makefile

            使用 STM32CubeMX 创建对应芯片工程产生Makefile。

五、VSCode在线调试配置

            修改launch.json

            "configurations": [

        {

            "name": "Cortex Debug",

            "cwd": "${workspaceFolder}",

            "executable": "./build/yxt.elf",

            "request": "launch",

            "type": "cortex-debug",

            "device": "STM32F407ZGT6",

            "runToEntryPoint": "main",

            "servertype": "openocd",

            "interface": "swd",

            "configFiles": [

                "/home/soskp/STM32/yxt/jlink-swd.cfg",

                "/tools/openocd-0.12.0/build/share/openocd/scripts/target/stm32f4x.cfg"

            ],

            // Work around for stopping at main on restart

            "postRestartCommands": [

                "break main",

                "continue"

            ],

            "searchDir": [

                "/tools/openocd-0.12.0/tcl/"

            ],

        }

    ]


微信小程序扫码登陆

文章评论

1447人参与,0条评论