ubuntu下编译STM32程序和烧写

参考链接:

https://www.linuxidc.com/Linux/2015-08/121322.htm

 

验证工程:

https://github.com/zenglongGH/stm32f4-CANopen-project

 

编译工具链下载安装:

The toolchain is here:

https://launchpad.net/gcc-arm-embedded

Find the link for the PPA and add to your system:

https://launchpad.net/~terry.guo/+archive/gcc-arm-embedded

sudo add-apt-repository ppa:terry.guo/gcc-arm-embedded
sudo apt-get update
sudo apt-get install gcc-arm-none-eabi

在Ubuntu上安装ST-LINK烧写软件

Install stlink

sudo apt-get install libusb-1.0
git clone https://github.com/texane/stlink
cd stlink
./autogen.sh 
./configure
make
sudo mkdir /opt/stlink
sudo cp st-util st-flash /opt/stlink
sudo cp 49-stlinkv2.rules /etc/udev/rules.d
sudo /etc/init.d/udev restart 

Add /opt/stlink to your PATH and test out the st-util utility

st-util -h

编译工程:

Run

make

to build the application code.

Use "make clean" to remove program build files. Use "make realclean" to remove library build files as well.

源码在编译时会出现如下错误:

解决方案是在工程目录下建立bin文件夹:

再执行make即可生成bin文件。

 

烧写bin到单片机

While your laptop is connected to the board via the debugger run

st-flash write out.bin 0x08000000

工程是F4的,我的板子是F1的,所以擦除成功,烧写失败。想用Ubuntu开发STM32的童鞋,可以参考这个来进行配置调试,这个也可以进行gdb调试哦。

 

  • 1
    点赞
  • 15
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

yzxjd1314

多谢鼓励,探索前行

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值