|
本帖最后由 QianFan 于 2015-10-27 19:54 编辑 ' _% C$ {6 k2 U* q ; `8 t& e7 Y% V, V6 L" F1 V 记事本用习惯了,论坛写帖子的时候动不动Ctrl+S一下。。。 在Ubuntu下开发STM32,两个常用软件是必须的。一是我们的交叉编译器,arm-none-eabi-xxx。二是st-link的驱动。这里的st-link并不像我们windows下面用的那样,一路点Next就好了。这里我们需要从github上面下载源码,自己编译,安装。st-link不仅仅是我们下载代码的工具,更是我们使用gdb调试的基础。# d8 T* S m" L( e ?6 n* D6 Y5 Q: o; z4 T% q8 s6 i% O" c3 L linux对USB虚拟串口的支持:5 C# H( N& r# L* j: Z linux下自带虚拟串口的驱动。不需要手动安装。linux对串口的命名不同于windows。像CP2102之类的USB转串口,是ttyUSBx,虚拟串口之类的是ttyACMx。我们先来找一下串口的编号。所有的设备都在/dev目录下。那么插Nucleo前后/dev中的新增项就是Nucleo的串口。 K1 l# [$ d% _& m6 T" ?7 {% A
常用的串口软件: 在linux下工作,串口软件我更喜欢minicom。他小巧,使用控制台窗口。有多种模式可以选择。当然,putty也是一个不错的选择。
st-link的安装: 在github上有st-link在linux下的源代码。为了操作简便,还是在使用st-link之前将它升级为v2。8 D9 C$ V0 y9 H. T2 F7 {( y
arm-none-eabi-xxx的安装:http://launchpad.net/~terry.guo/+archive/ubuntu/gcc-arm-embedded arm-none-eabi-xxx不仅仅包含gcc,g++,而是一整套完整的工具链。像CoIDE,RIDE,TrueStudio这些都是使用它作为编译工具的。只不过在命令行的基础上,套上了一个Eclipse的壳子罢了。3 k9 W) y: _+ P b' e. A: A
+ p# ^1 X) L5 q 4 V8 D$ I- N6 L# t) j |
微信公众号
手机版
6 W0 @9 U7 [( h4 J6 L" l! h
请教一下:安装stlink,你有没有遇到过下面的情况:
abyte@u-server-amd64:~/stlink-master$ ./configure
checking for a BSD-compatible install... /usr/bin/install -c5 k' j8 ^% u" R1 M# W
checking whether build environment is sane... yes% I- S1 c. G" G% \, r' r) O
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... no
checking whether make supports nested variables... no' I* u( H! W) h( Z! C5 r
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in `/home/abyte/stlink-master':
configure: error: C compiler cannot create executables
See `config.log' for more details
abyte@u-server-amd64:~/stlink-master$more config.log This file contains any messages produced by compilers while5 E2 c5 |4 k% p% H" ?! N; @: C' x6 |
running configure, to aid debugging if configure makes a mistake.
It was created by stlink configure 0.5.6, which was3 Q5 h8 H# H* p9 S) \9 c
generated by GNU Autoconf 2.69. Invocation command line was
$ ./configure
## --------- ## J( \% ^! R% G0 e" m( F J
## Platform. ### }/ r/ B! Y2 [7 t( Z9 D! z
## --------- ##
....+ q1 U8 J7 @, E
...
...
gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04)
configure:3102: $? = 0
configure:3091: gcc -V >&5! j E( q# q& o+ [0 Z
gcc: error: unrecognized command line option '-V') X) F8 |7 N4 P$ c) I" \3 O
gcc: fatal error: no input files" n; T9 v) }9 m3 ^; `
compilation terminated.6 D) Z% t8 W! I. o5 N/ j& g3 X0 K9 ~
configure:3102: $? = 4' Q2 A1 m# k% G9 ]! V+ V: @' j. A
configure:3091: gcc -qversion >&5" [& |9 w/ c4 K
gcc: error: unrecognized command line option '-qversion'0 @; o' E( S, n- z
gcc: fatal error: no input files
compilation terminated.: q. t6 `% Y0 r9 `" t& D
configure:3102: $? = 44 @: J# d" e4 o8 L) a' F6 m$ g
configure:3122: checking whether the C compiler works- q$ W+ \/ q$ I9 W
configure:3144: gcc conftest.c >&5
/usr/bin/ld: cannot find crt1.o: No such file or directory
/usr/bin/ld: cannot find crti.o: No such file or directory' j1 X: j! R" Q9 y/ X8 W
/usr/bin/ld: cannot find -lc
/usr/bin/ld: cannot find crtn.o: No such file or directory( @( X8 M' v4 F" r/ @: |
collect2: error: ld returned 1 exit status" R& G1 t! ^3 [# r3 p* t' x3 c5 R
configure:3148: $? = 1
configure:3186: result: no
configure: failed program was:
. Q7 }& K. \& Q6 t. I; z d8 b
...
...
8 G v1 U' |5 I; W) F/ S' D
checking for sys/mman.h... yes1 j# c4 f' a; n% [8 F7 u6 }
checking sys/poll.h usability... yes/ l! o' j! f( K/ Q. b3 e7 o q
checking sys/poll.h presence... yes
checking for sys/poll.h... yes3 T+ b U3 K1 T& T g+ M. T
checking for mmap... yes& D3 ^4 _# {; D* Q
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for USB... yes7 L, A* P, I& J+ j2 W! P3 }
checking for usb_path2devnum in -lusbpath... no, V4 _& U/ N, `" k( I) w
checking that generated files are newer than configure... done: d9 ?4 s4 `& Z3 H* [- F
configure: creating ./config.status
config.status: creating Makefile
config.status: executing depfiles commands, j$ m5 t) k( W2 u, i2 f% D! O( F
aoems@ubuntu:~/stlink-master$ gcc --version
gcc (Ubuntu 5.2.1-22ubuntu2) 5.2.1 20151010
Copyright (C) 2015 Free Software Foundation, Inc.) F N0 E) B0 D" l- }' I }% w
This is free software; see the source for copying conditions. There is NO5 G# A& \. z! t
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.* H+ f: B! Y4 u! |) e$ h+ X
+ r8 `1 o0 d2 T+ d7 l9 u
aoems@ubuntu:~/stlink-master$ sudo make install; Y Q5 j+ c" \% Q! L6 m ^- v
...
make[2]: Entering directory '/home/aoems/stlink-master'
/bin/mkdir -p '/usr/local/bin'$ X. \& p/ G, t
/usr/bin/install -c st-flash st-util st-term st-info '/usr/local/bin'6 G k# |5 E0 y3 M( y" X$ z+ C
make[2]: Nothing to be done for 'install-data-am'.
make[2]: Leaving directory '/home/aoems/stlink-master'
make[1]: Leaving directory '/home/aoems/stlink-master'0 H6 s3 n9 t- C
aoems@ubuntu:~/stlink-master$" ~' p1 l* E0 r# T
安装时,显示没做任何事情,不明白安装是否成功。
已经执行了的。这一步没报错误。---我的ubuntu是14.04 server版。另外我编辑了上一个帖子,吧config.log的内容也附上了。3 c* v5 M5 A" V! b. }
./autogen.sh的运行结果:
abyte@u-server-amd64:~/stlink-master$ ./autogen.sh * s8 d- J9 G" L3 j/ b
autoreconf: Entering directory `.'! _& e8 a9 Q' o& n- p! S
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force
autoreconf: configure.ac: tracing
autoreconf: configure.ac: not using Libtool* {1 l" c. H" b+ m) Y8 _
autoreconf: running: /usr/bin/autoconf --force/ G/ ^" N6 u- J! N, ^. k4 U
autoreconf: configure.ac: not using Autoheader
autoreconf: running: automake --add-missing --copy --force-missing
autoreconf: Leaving directory `.'
对啊,专门给橙子哥留的啊
一开始的sudo sh ./autogen.sh执行了吗?
你下载的文件没有被改过吧。看这个地方
configure:3091: gcc -V >&5
gcc: error: unrecognized command line option '-V'; I7 E: E8 G2 z" f
gcc: fatal error: no input files
compilation terminated.
3 V9 M. p. y. s p! i9 O
应该是gcc -v才对啊。要不你重新下载一次。在重新编译试试看。不行的话我给你发一份编译好的也行。这个我也是照着github上来的。有问题可以去github上给开发者留言看看。