|
本帖最后由 QianFan 于 2015-10-27 19:54 编辑 3 Q8 Q7 x; ], E6 @7 x 记事本用习惯了,论坛写帖子的时候动不动Ctrl+S一下。。。; K' \. V. W8 f( [ 在Ubuntu下开发STM32,两个常用软件是必须的。一是我们的交叉编译器,arm-none-eabi-xxx。二是st-link的驱动。这里的st-link并不像我们windows下面用的那样,一路点Next就好了。这里我们需要从github上面下载源码,自己编译,安装。st-link不仅仅是我们下载代码的工具,更是我们使用gdb调试的基础。8 X+ I- m: P" l9 {+ _1 \2 y2 O4 v linux对USB虚拟串口的支持:- v" w- N1 i/ j3 W% R, ]8 n linux下自带虚拟串口的驱动。不需要手动安装。linux对串口的命名不同于windows。像CP2102之类的USB转串口,是ttyUSBx,虚拟串口之类的是ttyACMx。我们先来找一下串口的编号。所有的设备都在/dev目录下。那么插Nucleo前后/dev中的新增项就是Nucleo的串口。
常用的串口软件:7 d4 P- X8 w& ?! w/ S; N 在linux下工作,串口软件我更喜欢minicom。他小巧,使用控制台窗口。有多种模式可以选择。当然,putty也是一个不错的选择。
st-link的安装: 在github上有st-link在linux下的源代码。为了操作简便,还是在使用st-link之前将它升级为v2。0 ?0 m9 i( f; [/ u l, b
arm-none-eabi-xxx的安装:http://launchpad.net/~terry.guo/+archive/ubuntu/gcc-arm-embedded* Q; t+ I& ~! Y$ Z: B0 W; T arm-none-eabi-xxx不仅仅包含gcc,g++,而是一整套完整的工具链。像CoIDE,RIDE,TrueStudio这些都是使用它作为编译工具的。只不过在命令行的基础上,套上了一个Eclipse的壳子罢了。5 T$ p% k7 `9 E, k6 @
7 Q$ d' T [, c# V" H8 z( | * A. ?% p" ~" a0 w( W0 m, T ' w" V" w* B4 h: N9 e4 L* B; N N |
微信公众号
手机版
请教一下:安装stlink,你有没有遇到过下面的情况:; Y3 }0 j- b; `% O- N$ o
abyte@u-server-amd64:~/stlink-master$ ./configure 0 ]' U. Q# J- q# P
checking for a BSD-compatible install... /usr/bin/install -c x" E* u+ [- F L
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... no8 A- b) y4 ?$ e3 b
checking whether make supports nested variables... no
checking for gcc... gcc# d) {# T! k* h' \! X8 j
checking whether the C compiler works... no
configure: error: in `/home/abyte/stlink-master':; Y m. q) b, q! F% ]; |2 H( R7 h
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 while
running configure, to aid debugging if configure makes a mistake.0 V6 Q+ K+ I1 Q1 K' Y A$ b' O
It was created by stlink configure 0.5.6, which was
generated by GNU Autoconf 2.69. Invocation command line was; W5 _" M& y' n" c- o5 f, ]3 G
$ ./configure
5 f) u) N, n+ m- Q( w
## --------- ##8 l `9 a. O5 ]# z) S5 ^
## Platform. ##% b5 B, N: G: V: \0 d& w* t
## --------- ## N" j- p8 P2 ]- @) F/ ~
....
...% s s5 V2 v7 H' q$ J# @
...
gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04)
configure:3102: $? = 0. Y( X# `8 \ `: c0 `
configure:3091: gcc -V >&54 [0 q* g) ~* \ B0 Y
gcc: error: unrecognized command line option '-V' V6 F* A4 W, ?( @1 J0 P
gcc: fatal error: no input files
compilation terminated.
configure:3102: $? = 4! [$ P/ f- c8 R8 R: J G
configure:3091: gcc -qversion >&5% U1 Z k3 A- E* ^: J" Z: W
gcc: error: unrecognized command line option '-qversion'
gcc: fatal error: no input files
compilation terminated.9 j* w" p/ z3 x" N$ Y
configure:3102: $? = 4$ l# ]% `9 |( B6 s8 V2 q7 [' v
configure:3122: checking whether the C compiler works1 e% G3 ^( X4 G+ U1 N/ O
configure:3144: gcc conftest.c >&5 L! E: A6 w0 q* m9 `1 ~" b
/usr/bin/ld: cannot find crt1.o: No such file or directory% i$ }: k$ Q( z) B( a
/usr/bin/ld: cannot find crti.o: No such file or directory
/usr/bin/ld: cannot find -lc
/usr/bin/ld: cannot find crtn.o: No such file or directory: ]1 U1 ]( C# ^& L2 s7 d
collect2: error: ld returned 1 exit status$ A3 f% O f% U- @" i
configure:3148: $? = 1
configure:3186: result: no
configure: failed program was:
...
.... G& |4 l7 E/ D
checking for sys/mman.h... yes
checking sys/poll.h usability... yes
checking sys/poll.h presence... yes" i6 p4 B" a m: K8 i
checking for sys/poll.h... yes' ~; r- j* [$ O- y
checking for mmap... yes: Q! r7 t% V0 K0 e* c8 A
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes1 i m* J8 \- e. {" r: e6 D
checking for USB... yes( J2 G! [% O6 |: ~+ H3 E
checking for usb_path2devnum in -lusbpath... no$ ]. g; A% h5 V$ m6 F& p }
checking that generated files are newer than configure... done/ q w6 m: P7 o3 h
configure: creating ./config.status
config.status: creating Makefile
config.status: executing depfiles commands
aoems@ubuntu:~/stlink-master$ gcc --version. K2 D0 ~9 \; h1 x& E
gcc (Ubuntu 5.2.1-22ubuntu2) 5.2.1 20151010
Copyright (C) 2015 Free Software Foundation, Inc.7 c3 C/ ~& ]! w$ v6 B. V/ E1 ?4 `
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
aoems@ubuntu:~/stlink-master$ sudo make install C- X" f$ B0 l) q* V
...
make[2]: Entering directory '/home/aoems/stlink-master'
/bin/mkdir -p '/usr/local/bin'
/usr/bin/install -c st-flash st-util st-term st-info '/usr/local/bin'
make[2]: Nothing to be done for 'install-data-am'.1 |* I- o0 T( {: G/ {5 s
make[2]: Leaving directory '/home/aoems/stlink-master'5 _. ^0 k: |& q/ h2 Y
make[1]: Leaving directory '/home/aoems/stlink-master'
aoems@ubuntu:~/stlink-master$
安装时,显示没做任何事情,不明白安装是否成功。
已经执行了的。这一步没报错误。---我的ubuntu是14.04 server版。另外我编辑了上一个帖子,吧config.log的内容也附上了。2 c* |1 h: \! m1 C. z1 k
# ^0 |0 I" h, K; T3 ]
7 y, K0 S9 e' T0 A, l
./autogen.sh的运行结果:) V( G X: S% L6 L! c
abyte@u-server-amd64:~/stlink-master$ ./autogen.sh 7 T5 Q( ]+ t, ^/ g) D4 j* L! k
autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force . e. a( b& s7 o+ o$ z0 h% b _( J" T
autoreconf: configure.ac: tracing
autoreconf: configure.ac: not using Libtool7 X i/ n+ a- s+ }1 y% k
autoreconf: running: /usr/bin/autoconf --force
autoreconf: configure.ac: not using Autoheader
autoreconf: running: automake --add-missing --copy --force-missing0 Y3 B8 F' g& T$ j! D5 a% N) d9 h0 L
autoreconf: Leaving directory `.'
对啊,专门给橙子哥留的啊
一开始的sudo sh ./autogen.sh执行了吗?
你下载的文件没有被改过吧。看这个地方8 @ ^: \# ^* t
configure:3091: gcc -V >&5
gcc: error: unrecognized command line option '-V': R: W+ Q6 a$ \- ^6 e# L8 ~+ o; [; G( f
gcc: fatal error: no input files( B6 w2 K! X' W! L9 T( ?
compilation terminated.
[0 I4 d8 r) @9 X+ {8 y
应该是gcc -v才对啊。要不你重新下载一次。在重新编译试试看。不行的话我给你发一份编译好的也行。这个我也是照着github上来的。有问题可以去github上给开发者留言看看。