1. 首页
  2. 课程学习
  3. 嵌入式
  4. 三份GCC中文教学文档下载

三份GCC中文教学文档下载

上传者: 2022-09-23 12:13:23上传 RAR文件 987.47 KB 热度 9次

三份GCC中文教学文档下载:首先声明:

尽管GCC是免费软件,但双龙公司仍提供了一定的技术支持。

但毕竟是非商业软件,支持终将是有限的。

Win32 build of avr-gcc 3.3,  [11.8M] Apr.23, 2003

WinAVR (pronounced "whenever") is a suite of open source software development tools for the Atmel AVR series of RISC microprocessors for the Windows platform. It includes the GCC compiler for C and C++. WinAVR contains: WinAVR contains:

GNU BinuTIls: Binary uTIliTIes for AVR target (including assembler, linker, etc.)

GCC: C and C++ compiler for AVR target.

avr-libc: C Standard Library for AVR.

objtool: ELF to COFF converter.

avrdude: User-extensible programmer software.

GNU Debugger (GDB): Debugger.

AVaRICE: Software to interface Atmel JTAG ICE with GDB.

Programmers Notepad: Editor and IDE.

SRecord: UTIlities to manipulate load files.

Documentation for: Binutils, GCC, avr-libc, as, ld, make, avrdude, GDB, and AVaRICE.

Many native Win32 GNU programs and utilities.

Examples with source code from the avr-libc project.

Sample makefile to use in your project.

Batch files for use with AVR Studio.

--------------------------------------------------------------------------

新的winavr.更方便了。

现在安装一步到位,不用手动添加路径了。新的PN也可以支持命令行编译了(不过还是没有UE方便)。

又加了许多新东东。

Announcing WinAVR 20030312

WinAVR (pronounced "whenever") is a suite of executable, open source

software development tools for the Atmel AVR series of RISC

microprocessors hosted on the Windows platform. It includes the

GNU GCC compiler for C and C++.

WinAVR can be found at http://sourceforge.net/projects/winavr/

Below is just a sample of what's new.

- The installer now automatically writes the WinAVR directories to

your PATH environment variable and checks to see if they already

exist.

 

- avrdude 4.0.0 is now included. avrdude is an open source programmer

software that is user extensible. It is the former avrprog by Brian

Dean now renamed and cross-platform.

- GNU Debugger (GDB) 5.3 for the AVR target (avr-gdb) is now

included.

- AVaRICE 2.0 is now included. AVaRICE is a program for interfacing

the Atmel JTAG ICE to GDB so users can debug their AVR.

- SRecord 1.14 is now included. SRecord is a collection of utilities

to manipulate load files in different formats and various ways.

- New version of Programmers Notepad 2. You can now call command-line

tools. (And without any batch files to do it!)

- avr-libc supports new devices: AT76C711, AT86RF401, AT43USB35x, and

AT43USB32x.

- Added a small package, tofrodos, to the utilities to convert Unix /

DOS line endings.

 

- More changes and corrections to the sample makefile.

For more information see the README.txt file that comes in the binary

installation.

Eric Weddington

------------------------------------------------------------------------

Announcing WinAVR 20030115

WinAVR (pronounced "whenever") is a suite of executable, open source

software development tools for the Atmel AVR series of RISC

microprocessors hosted on the Windows platform. It includes the

GNU GCC compiler.

WinAVR can be found at http://sourceforge.net/projects/winavr/

Below is just a sample of what's new.

- Corrected sample makefile.

- Added to the sample makefile automatic C file dependency

generation.

- Added more documentation: binutils, make, as (GNU assembler),

  ld (GNU linker), and GCC. Now there's no excuse not to RTFM!

- Refactored the utilities. Added bash.

- Added editor: Programmer's Notepad 2. This is in early stages and

will develop into an IDE in the near future. This editor includes the

Scintilla editor component.

- Note that GNU GCC 3.3 is no longer labeled experimental and is now

labeled as prerelease. The tentative release date for GCC 3.3 is mid-

February 2003.

- This version of WinAVR includes GNU Binutils 2.13.2.1 which is the

latest released version. Previous versions of WinAVR included

Binutils 2.14 experimental versions.

 

- AVRLibC now includes an experimental scanf library thanks to J鰎g

Wunsch.

 

- AVRLibC has completely new rewrites of the trigonometrical

functions asin(), atan() and atan2() that feature a better (for some

argument ranges even much better) accuracy than the previous

versions. Note that since acos() uses asin(), it also benefits from

this. These were contributed by Reiner Patommel.

- Two example projects with source code are included. These are from

AVRLibC. Look under \doc\examples. These examples also

include different kinds of makefiles than in the sample directory.

For more information see the README.txt file that comes in the binary

installation.

Eric Weddington

---------------------------------------------------------------------

WinAvr 的makefile 做得不好

得把makefile模板重写。

你可以增加几个target,如:

dump:

avr-objdump -S -h $(TARGRT).elf >dump.txt

notepad dump.txt

install :

根据你的下载器指定uisp 参数,可以并口STK 200 dongle、串口avrisp等,甚至可以是Altera ByteBlaste 下载电缆。

这样,编译完以后

make install 直接下载代码到avr。

make dump  反汇编原代码到dumop.txt,并自动用记事本打开。

------------------------------------------------------------------------

下载及安装最新的gcc3.3版本 (注:这个版本已不是最新的了)

在www.avrfreaks.net上下载最新的3.3版本(20021209)。直接安装,默认为winavr目录。然后在autoexec.bat里加上:

C:\WINAVR\bin;C:\WINAVR\utils\bin

安装后注意sample里的makefile文件有点问题,需要修改一下!否则不能运行。

问题(1):将size改为sizebefore

# Default target.

.PHONY : all

all: begin gccversion sizebefore $(TARGET).elf $(TARGET).cof $(TARGET).hex $(TARGET).eep sizeafter finished end

问题(2):将HEXSIZE该为ELFSIZE:

# Display size of file.

.PHONY : sizebefore

sizebefore:

    @echo "Size before:"

    -$(ELFSIZE)

.PHONY : sizeafter

sizeafter:

    @echo "Size after:"

    $(ELFSIZE)

该版本的cof文件转换采用objtool,在studio下调用,可配合仿真器,很好用。

-------------------------------------------------------------------------------

AVRGCC 能不能为 AT90S1200、ATTiny 系列进行 C 语言编程?

答案是肯定的!只不过,需要一些技巧……

首先,需要在 makefile 的项目中,把 MCU = 后面的内容改成 avr2,

其次,需要在程序所在的 c 文件中,把

#include

改成

#include

#include

如此,即可以直接将编译后的代码用于该两类 MCU 上,不过,还需要注意的是,由于该两

类 MCU 没有软件堆栈和 RAM,所以,程序中*禁止*使用全局变量、局部静态变量以及中断

处理以外的函数(其实在 GCC 中,中断处理程序叫做“信号”,不叫函数),并且,在中

断处理过程中,最好不要开放中断,否则会引起数据错误(并非不可以,但需要一些技

巧)。

由此可见,使用 AVRGCC,可以完全的代替其它的 AVR 程序开发工具——甚至可以直接扔掉

汇编语言。

---------------------------------------------------------------------------------

AVRGCC只支持AVR TINY系列中的TINY26 :

因为目前只有TINY26有RAM,对于其它TINY,在GCCAVR中只能用汇编

至于AVRGCC的include里带了不少的tiny的库,对那些.h文件,你都能在里面找到这样一行:

#ifndef __ASSEMBLER__

#  warning "MCU not supported by the C compiler"

#endif

当然有人提出能用一些变通的方法实现TINY的C编译(用-mmcu=avr2选项编译,并避免一些涉及RAM和堆栈的操作),但毕竟受很大限制。

其它的TINY只支持汇编。

目前支持没有RAM的TINY的C编译器基本只有ICCTINY,ICCTINY的DEMO软件可在www.imagecraft.com下载。

 

----------------------------------------------------------------------------------

与AVR-GCC配套的编程器-:)

命令行方式工作的,估计GNU阵营的会觉得比PonyProg2000好用-:)

http://www.xs4all.nl/~sbolt/e-spider_prog.html

现在能支持DOS、Win9x、WinNT/2000/XP、Linux平台了。

 

avrdude 也可以,在makefile最后加一句就可以了。

最新版的20030312版的噢:

avrdude -p $(MCU) -c pony -e -i $(PRG).hex -V

直接就写进去了,一步到位。

 

-----------------------------------------------------------------------------------

这是网上的一篇文章,对avrgcc而言要有一定的区别,只供参考:

 

GCC参数详解

文档内容

[声明]

这篇文档是我的关于gcc参数的笔记,我很怀念dos年代我用小本子,纪录所有的dos

命令的参数.哈哈,下面的东西可能也不是很全面,我参考了很多的书,和gcc的帮助.

不全的原因是,有可能我还没有看到这个参数,另一种原因是,我可能还不会用它-:)

不过,我会慢慢的补齐的.哈哈

如果你要转在本文章请保留我的email(pianopan@beeship.com)和文章的全面性. 

[介绍]

gcc and g++分别是gnu的c & c++编译器

gcc/g++在执行编译工作的时候,总共需要4步

1.预处理,生成.i的文件

2.将预处理后的文件不转换成汇编语言,生成文件.s

3.有汇编变为目标代码(机器代码)生成.o的文件

4.连接目标代码,生成可执行程序

[参数详解]

-x language filename 

   设定文件所使用的语言,使后缀名无效,对以后的多个有效.也就是根

   据约定C语言的后缀名称是.c的,而C++的后缀名是.C或者.cpp,如果

   你很个性,决定你的C代码文件的后缀名是.pig 哈哈,那你就要用这

   个参数,这个参数对他后面的文件名都起作用,除非到了下一个参数

   的使用。

   可以使用的参数吗有下面的这些

     `c', `objective-c', `c-header', `c++', `cpp-output', 

     `assembler', and `assembler-with-cpp'.

   看到英文,应该可以理解的。

   例子用法:

   gcc -x c hello.pig

  

-x none filename

  关掉上一个选项,也就是让gcc根据文件名后缀,自动识别文件类型

  例子用法:

  gcc -x c hello.pig -x none hello2.c

  

-c 

  只激活预处理,编译,和汇编,也就是他只把程序做成obj文件

  例子用法:

  gcc -c hello.c

  他将生成.o的obj文件 

-S

  只激活预处理和编译,就是指把文件编译成为汇编代码。

  例子用法

  gcc -S hello.c

  他将生成.s的汇编代码,你可以用文本编辑器察看

-E

  只激活预处理,这个不生成文件,你需要把它重定向到一个输出文件里

  面.

  例子用法:

  gcc -E hello.c > pianoapan.txt

  gcc -E hello.c | more

  慢慢看吧,一个hello word 也要与处理成800行的代码

-o

  制定目标名称,缺省的时候,gcc 编译出来的文件是a.out,很难听,如果

  你和我有同感,改掉它,哈哈

  例子用法

  gcc -o hello.exe hello.c (哦,windows用习惯了)

  gcc -o hello.asm -S hello.c

-pipe

  使用管道代替编译中临时文件,在使用非gnu汇编工具的时候,可能有些问

  题

  gcc -pipe -o hello.exe hello.c

-ansi

  关闭gnu c中与ansi c不兼容的特性,激活ansi c的专有特性(包括禁止一

  些asm inline typeof关键字,以及UNIX,vax等预处理宏,

-fno-asm

  此选项实现ansi选项的功能的一部分,它禁止将asm,inline和typeof用作

  关键字。

    

-fno-strict-prototype

  只对g++起作用,使用这个选项,g++将对不带参数的函数,都认为是没有显式

  的对参数的个数和类型说明,而不是没有参数.

  而gcc无论是否使用这个参数,都将对没有带参数的函数,认为城没有显式说

  明的类型

  

-fthis-is-varialble

  就是向传统c++看齐,可以使用this当一般变量使用.

  

-fcond-mismatch

  允许条件表达式的第二和第三参数类型不匹配,表达式的值将为void类型

  

-funsigned-char

-fno-signed-char

-fsigned-char

-fno-unsigned-char

  这四个参数是对char类型进行设置,决定将char类型设置成unsigned char(前

  两个参数)或者 signed char(后两个参数)

  

-include file

  包含某个代码,简单来说,就是便以某个文件,需要另一个文件的时候,就可以

  用它设定,功能就相当于在代码中使用#include

  例子用法:

  gcc hello.c -include /root/pianopan.h

  

-imacros file

  将file文件的宏,扩展到gcc/g++的输入文件,宏定义本身并不出现在输入文件

  中

  

-Dmacro

  相当于C语言中的#define macro

  

-Dmacro=defn

  相当于C语言中的#define macro=defn

  

-Umacro

  相当于C语言中的#undef macro

-undef

  取消对任何非标准宏的定义

  

-Idir

  在你是用#include"file"的时候,gcc/g++会先在当前目录查找你所制定的头

  文件,如果没有找到,他回到缺省的头文件目录找,如果使用-I制定了目录,他

  回先在你所制定的目录查找,然后再按常规的顺序去找.

  对于#include,gcc/g++会到-I制定的目录查找,查找不到,然后将到系

  统的缺省的头文件目录查找

  

-I-

  就是取消前一个参数的功能,所以一般在-Idir之后使用

  

-idirafter dir

  在-I的目录里面查找失败,讲到这个目录里面查找.

  

-iprefix prefix

-iwithprefix dir

  一般一起使用,当-I的目录查找失败,会到prefix+dir下查找

  

-nostdinc

  使编译器不再系统缺省的头文件目录里面找头文件,一般和-I联合使用,明确

  限定头文件的位置

  

-nostdin C++

  规定不在g++指定的标准路经中搜索,但仍在其他路径中搜索,.此选项在创建

  libg++库使用

  

-C

  在预处理的时候,不删除注释信息,一般和-E使用,有时候分析程序,用这个很

  方便的

  

-M

  生成文件关联的信息。包含目标文件所依赖的所有源代码

  你可以用gcc -M hello.c来测试一下,很简单。

  

-MM

  和上面的那个一样,但是它将忽略由#include造成的依赖关系。

  

-MD

  和-M相同,但是输出将导入到.d的文件里面

  

-MMD

  和-MM相同,但是输出将导入到.d的文件里面

  

-Wa,option

  此选项传递option给汇编程序;如果option中间有逗号,就将option分成多个选

  项,然后传递给会汇编程序

  

-Wl.option

  此选项传递option给连接程序;如果option中间有逗号,就将option分成多个选

  项,然后传递给会连接程序.

  

-llibrary 

  制定编译的时候使用的库

  例子用法

  gcc -lcurses hello.c

  使用ncurses库编译程序

  

-Ldir

  制定编译的时候,搜索库的路径。比如你自己的库,可以用它制定目录,不然

  编译器将只在标准库的目录找。这个dir就是目录的名称。

  

-O0

-O1

-O2

-O3

  编译器的优化选项的4个级别,-O0表示没有优化,-O1为缺省值,-O3优化级别最

  高  

  

-g

  只是编译器,在编译的时候,产生条是信息。

  

-gstabs

  此选项以stabs格式声称调试信息,但是不包括gdb调试信息.

  

-gstabs+

  此选项以stabs格式声称调试信息,并且包含仅供gdb使用的额外调试信息.

  

-ggdb

  此选项将尽可能的生成gdb的可以使用的调试信息.

[参考资料]

-Linux/UNIX高级编程

  中科红旗软件技术有限公司编著.清华大学出版社出版

[ChangeLog]

-2002-08-10

  发布最初的文档

-2002-08-11

  修改文档格式  

下载地址
用户评论