搜索
bottom↓
回复: 8

菜鸟的avr-gcc for linux 安装过程

[复制链接]

出0入0汤圆

发表于 2008-7-11 10:45:23 | 显示全部楼层 |阅读模式
为了满足极度膨胀的虚荣心,本菜鸟不自量力的搞起了linux,但毕竟咱是要在上面作硬件开发的,装个linux系统已经是有点钱穷计驴的感觉了,安装这些应用软件更是一头雾水,幸好网络无敌,开死吧

环境:fedora 8

1我使用的版本:
binutils-2.18.tar.bz2
ftp://ftp.gnu.org/gnu/binutils

gcc-core-4.2.2.tar.bz2
ftp://ftp.informatik.rwth-aachen.de/pub/gnu/gcc/

avr-libc-1.6.2.tar.bz2
http://download.savannah.gnu.org/releases/avr-libc/

注意网上有些教程中下载点很久没更新了,以上是我下载的地方

其中gcc-core-4.2.2.tar.bz2必须在配置时加入 --disable-libssp

将以上文件都解压,路径随便

2安装:

安装目录:/usr/avrgcc

1)
在终端中
进入binutils-2.18目录
./configure --target=avr --prefix=/usr/avrgcc
make
make install

打开/etc/ld.so.conf ,在最后加入
/usr/avrgcc/lib
保存

在终端中  
/sbin/ldconfig

2)
在终端中
进入gcc-core-4.2.2目录
./configure --target=avr --prefix=/usr/avrgcc --disable-nls --enable-language=c --disable-libssp
make
make install

到root目录,选显示隐藏文件,打开.bashrc文件,在最后加入
export PATH=/usr/avrgcc/bin:${PATH}
保存

注销一次,

在终端中
avr-gcc
如果报 no input file 则安装成功
如果报 command not found 则是上面的路径加入不对或其他问题
3)在终端中
export CC=avr-gcc
export AS=avr-as
export AR=avr-ar
export RANLIB=avr-ranlib
export PATH=/usr/avrgcc/bin:${PATH}
进入avr-libc-1.6.2目录
./configure --prefix=/usr/avrgcc/avr --target=avr --enable-languages=c --host=avr
make
make install
4)编写makefile
用的是本站的模版,似乎是站长写的吧,n年以前的事了

将target改为c源文件名,不要扩展名
TARGET = test

在#---------------- Compiler Options ----------------区域最后加入
CFLAGS += -I/usr/avrgcc/avr/avr/include
CFLAGS += -B/usr/avrgcc/avr/avr/lib
注意是两个avr
保存
5)在终端中
进入c源文件目录
make
如果没问题那么会提示
-------- begin --------
avr-gcc (GCC) 4.2.2
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


Compiling: test.c
avr-gcc -c -mmcu=atmega8 -I. -gdwarf-2 -DF_CPU=1000000UL  -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=test.lst  -std=gnu99 -I/usr/avrgcc/avr/avr/include  -B/usr/avrgcc/avr/avr/lib -MD -MP -MF .dep/test.o.d test.c -o test.o

Linking: test.elf
avr-gcc -mmcu=atmega8 -I. -gdwarf-2 -DF_CPU=1000000UL  -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=test.o  -std=gnu99 -I/usr/avrgcc/avr/avr/include  -B/usr/avrgcc/avr/avr/lib -MD -MP -MF .dep/test.elf.d test.o --output test.elf -Wl,-Map=test.map,--cref    -lm

Creating load file for Flash: test.hex
avr-objcopy -O ihex -R .eeprom test.elf test.hex

Creating load file for EEPROM: test.eep
avr-objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load" \
        --change-section-lma .eeprom=0 -O ihex test.elf test.eep
avr-objcopy: --change-section-lma .eeprom=0x00000000 never used

Creating Extended Listing: test.lss
avr-objdump -h -S test.elf > test.lss

Creating Symbol Table: test.sym
avr-nm -n test.elf > test.sym

Size after:
test.elf  :
section           size   addr
.text              106      0
.stab             1716      0
.stabstr            84      0
.debug_aranges      32      0
.debug_pubnames     27      0
.debug_info        118      0
.debug_abbrev       65      0
.debug_line         83      0
.debug_frame        32      0
.debug_str          90      0
Total             2353



-------- end --------

3目前只进行到这一步,用了3天时间...
几点心得:
1)linux是锻炼人忍耐力的好dd
2)如果安装失败而且想改变安装目录,那么必须重新解压软件包,也就是一切要重头来,不能为了偷懒用make过的文件直接make,会报错
3)编译时报
缺少分隔符
是makefile文件的问题
找到他提示有问题的行,将光标定位在行首(如果有空格就都删掉),按 tab
4)编译时报
文结尾有什么错误的
是makefile文件的问题,可能是直接把window下的makefile考过来用的,
可以用vi打开,然后执行
:set fileformat=unix
:w
:q
试试
4测试程序
test.c

#include <avr/io.h>

int main(void)
{
while(1);
}

4makefile


#这是一个简单makefile,仅用于初学者使用
#修改于WINAVR20050214所生成的makefile
#简单实验只需更改 [单片机类型][目标文件名][C源文件名][系统时钟频率]即可
#修改好参数后另存到单片机程序所在目录,然后执行[make all]命令
#生成 烧录FLASH的*.hex,烧录EEPROM的*.eep,调试用的*.elf 文件
#
#           www.OurAVR.com

# MCU name
# 单片机类型 参考格式是:atmega8 / at90s2313 / attiny15


MCU = atmega8


# Processor frequency.
# 系统时钟频率(Hz),用于生成延时 _delay_us() _delay_ms() 见delay.h
#     This will define a symbol, F_CPU, in all source code files equal to the
#     processor frequency. You can then use this symbol in your source code to
#     calculate timings. Do NOT tack on a 'UL' at the end, this will be done
#     automatically to create a 32-bit value in your source code.
F_CPU = 1000000

# Target file name (without extension).
# 目标文件名(即生成的.hex/.eep/.elf的文件名)
TARGET = test

# List C source files here. (C dependencies are automatically generated.)
# C源文件名(不带路径)
# 多个文件名间用空格隔开 例如 SRC = file1.c file2.c file3.c
# 不需要加上 h头文件
SRC = $(TARGET).c


#**************后面内容基本不需要修改,除非你是老手*****************************#


# Output format. (can be srec, ihex, binary)
# 输出烧录文件格式
FORMAT = ihex

# Optimization level, can be [0, 1, 2, 3, s].
# 优化级别
#     0 = turn off optimization. s = optimize for size.
#     (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s


# Debugging format.
# 输出调试格式
#     Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs.
#     AVR Studio 4.10 requires dwarf-2.
#     AVR [Extended] COFF format requires stabs, plus an avr-objcopy run.
DEBUG = dwarf-2

# List Assembler source files here.
# 汇编源文件名(不带路径,但扩展名 .sS 需大写,否则将会被make clean 所误删)
#     Make them always end in a capital .S. Files ending in a lowercase .s
#     will not be considered source files but generated files (assembler
#     output from the compiler), and will be deleted upon "make clean"!
#     Even though the DOS/Win* filesystem matches both .s and .S the same,
#     it will preserve the spelling of the filenames, and gcc itself does
#     care about how the name is spelled on its command-line.
ASRC =


# Hey Emacs, this is a -*- makefile -*-
#----------------------------------------------------------------------------
# WinAVR Makefile Template written by Eric B. Weddington, J鰎g Wunsch, et al.
#
# Released to the Public Domain
#
# Additional material for this makefile was written by:
# Peter Fleury
# Tim Henigan
# Colin O'Flynn
# Reiner Patommel
# Markus Pfaff
# Sander Pool
# Frederik Rouleau
#
#----------------------------------------------------------------------------
# On command line:
#
# make all = Make software.
#
# make clean = Clean out built project files.
#
# make coff = Convert ELF to AVR COFF.
#
# make extcoff = Convert ELF to AVR Extended COFF.
#
# make program = Download the hex file to the device, using avrdude.
#                Please customize the avrdude settings below first!
#
# make debug = Start either simulavr or avarice as specified for debugging,
#              with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
#
# make filename.i = Create a preprocessed source file for use in submitting
#                   bug reports to the GCC project.
#
# To rebuild project do "make clean" then "make all".
#----------------------------------------------------------------------------


# List any extra directories to look for include files here.
#     Each directory must be seperated by a space.
#     Use forward slashes for directory separators.
#     For a directory that has spaces, enclose it in quotes.
EXTRAINCDIRS =


# Compiler flag to set the C Standard level.
#     c89   = "ANSI" C
#     gnu89 = c89 plus GCC extensions
#     c99   = ISO C99 standard (not yet fully implemented)
#     gnu99 = c99 plus GCC extensions
CSTANDARD = -std=gnu99


# Place -D or -U options here
CDEFS = -DF_CPU=$(F_CPU)UL


# Place -I options here
CINCS =


#---------------- Compiler Options ----------------
# -g*:          generate debugging information
# -O*:          optimization level
# -f...:        tuning, see GCC manual and avr-libc documentation
# -Wall...:     warning level
# -Wa,...:      tell GCC to pass this to the assembler.
#    -adhlns...: create assembler listing
CFLAGS = -g$(DEBUG)
CFLAGS += $(CDEFS) $(CINCS)
CFLAGS += -O$(OPT)
CFLAGS += -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums
CFLAGS += -Wall -Wstrict-prototypes
CFLAGS += -Wa,-adhlns=$(<:.c=.lst)
CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
CFLAGS += $(CSTANDARD)
CFLAGS += -I/usr/avrgcc/avr/avr/include
CFLAGS += -B/usr/avrgcc/avr/avr/lib


#---------------- Assembler Options ----------------
# -Wa,...:   tell GCC to pass this to the assembler.
# -ahlms:    create listing
# -gstabs:   have the assembler create line number information; note that
#             for use in COFF files, additional information about filenames
#             and function names needs to be present in the assembler source
#             files -- see avr-libc docs [FIXME: not yet described there]
ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs


#---------------- Library Options ----------------
# Minimalistic printf version
PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min

# Floating point printf version (requires MATH_LIB = -lm below)
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt

# If this is left blank, then it will use the Standard printf version.
PRINTF_LIB =
#PRINTF_LIB = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)


# Minimalistic scanf version
SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min

# Floating point + %[ scanf version (requires MATH_LIB = -lm below)
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt

# If this is left blank, then it will use the Standard scanf version.
SCANF_LIB =
#SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)


MATH_LIB = -lm


#---------------- External Memory Options ----------------

# 64 KB of external RAM, starting after internal RAM (ATmega128!),
# used for variables (.data/.bss) and heap (malloc()).
#EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff

# 64 KB of external RAM, starting after internal RAM (ATmega128!),
# only used for heap (malloc()).
#EXTMEMOPTS = -Wl,--defsym=__heap_start=0x801100,--defsym=__heap_end=0x80ffff

EXTMEMOPTS =

#---------------- Linker Options ----------------
# -Wl,...:     tell GCC to pass this to linker.
#    -Map:      create map file
#    --cref:    add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB)

#---------------- Programming Options (avrdude) ----------------

# Programming hardware: alf avr910 avrisp bascom bsd
# dt006 pavr picoweb pony-stk200 sp12 stk200 stk500
#
# Type: avrdude -c ?
# to get a full listing.
#
AVRDUDE_PROGRAMMER = stk500

# com1 = serial port. Use lpt1 to connect to parallel port.
AVRDUDE_PORT = com1    # programmer connected to serial device

AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep


# Uncomment the following if you want avrdude's erase cycle counter.
# Note that this counter needs to be initialized first using -Yn,
# see avrdude manual.
#AVRDUDE_ERASE_COUNTER = -y

# Uncomment the following if you do /not/ wish a verification to be
# performed after programming the device.
#AVRDUDE_NO_VERIFY = -V

# Increase verbosity level. Please use this when submitting bug
# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v

AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)
AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY)
AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE)
AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER)

#---------------- Debugging Options ----------------

# For simulavr only - target MCU frequency.
DEBUG_MFREQ = $(F_CPU)

# Set the DEBUG_UI to either gdb or insight.
# DEBUG_UI = gdb
DEBUG_UI = insight

# Set the debugging back-end to either avarice, simulavr.
DEBUG_BACKEND = avarice
#DEBUG_BACKEND = simulavr

# GDB Init Filename.
GDBINIT_FILE = __avr_gdbinit

# When using avarice settings for the JTAG
JTAG_DEV = /dev/com1

# Debugging port used to communicate between GDB / avarice / simulavr.
DEBUG_PORT = 4242

# Debugging host used to communicate between GDB / avarice / simulavr, normally
#     just set to localhost unless doing some sort of crazy debugging when
#     avarice is running on a different computer.
DEBUG_HOST = localhost


#============================================================================

# Define programs and commands.
SHELL = sh
CC = avr-gcc
OBJCOPY = avr-objcopy
OBJDUMP = avr-objdump
SIZE = avr-size
NM = avr-nm
AVRDUDE = avrdude
REMOVE = rm -f
COPY = cp
WINSHELL = cmd


# Define Messages
# English
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
MSG_FLASH = Creating load file for Flash:
MSG_EEPROM = Creating load file for EEPROM:
MSG_EXTENDED_LISTING = Creating Extended Listing:
MSG_SYMBOL_TABLE = Creating Symbol Table:
MSG_LINKING = Linking:
MSG_COMPILING = Compiling:
MSG_ASSEMBLING = Assembling:
MSG_CLEANING = Cleaning project:

# Define all object files.
OBJ = $(SRC:.c=.o) $(ASRC:.S=.o)

# Define all listing files.
LST = $(SRC:.c=.lst) $(ASRC:.S=.lst)


# Compiler flags to generate dependency files.
GENDEPFLAGS = -MD -MP -MF .dep/$(@F).d


# Combine all necessary flags and optional flags.
# Add target processor to flags.
ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS)
ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)


# Default target.
all: begin gccversion sizebefore build sizeafter end

build: elf hex eep lss sym

elf: $(TARGET).elf
hex: $(TARGET).hex
eep: $(TARGET).eep
lss: $(TARGET).lss
sym: $(TARGET).sym

# Eye candy.
# AVR Studio 3.x does not check make's exit code but relies on
# the following magic strings to be generated by the compile job.
begin:
        @echo
        @echo $(MSG_BEGIN)

end:
        @echo $(MSG_END)
        @echo


# Display size of file.
HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
ELFSIZE = $(SIZE) -A $(TARGET).elf
AVRMEM = avr-mem.sh $(TARGET).elf $(MCU)

sizebefore:
        @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \
        $(AVRMEM) 2>/dev/null; echo; fi

sizeafter:
        @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \
        $(AVRMEM) 2>/dev/null; echo; fi

# Display compiler version information.
gccversion :
        @$(CC) --version

# Program the device.
program: $(TARGET).hex $(TARGET).eep
        $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)

# Generate avr-gdb config/init file which does the following:
#     define the reset signal, load the target file, connect to target, and set
#     a breakpoint at main().
gdb-config:
        @$(REMOVE) $(GDBINIT_FILE)
        @echo define reset >> $(GDBINIT_FILE)
        @echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
        @echo end >> $(GDBINIT_FILE)
        @echo file $(TARGET).elf >> $(GDBINIT_FILE)
@echo target remote $(DEBUG_HOST):$(DEBUG_PORT) >> $(GDBINIT_FILE)
ifeq ($(DEBUG_BACKEND),simulavr)
        @echo load >> $(GDBINIT_FILE)
endif
        @echo break main >> $(GDBINIT_FILE)

debug: gdb-config $(TARGET).elf
ifeq ($(DEBUG_BACKEND), avarice)
        @echo Starting AVaRICE - Press enter when "waiting to connect" message displays.
        @$(WINSHELL) /c start avarice --jtag $(JTAG_DEV) --erase --program --file \
$(TARGET).elf $(DEBUG_HOST):$(DEBUG_PORT)
        @$(WINSHELL) /c pause

else
        @$(WINSHELL) /c start simulavr --gdbserver --device $(MCU) --clock-freq \
        $(DEBUG_MFREQ) --port $(DEBUG_PORT)
endif
        @$(WINSHELL) /c start avr-$(DEBUG_UI) --command=$(GDBINIT_FILE)

# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
        COFFCONVERT=$(OBJCOPY) --debugging \
        --change-section-address .data-0x800000 \
        --change-section-address .bss-0x800000 \
        --change-section-address .noinit-0x800000 \
        --change-section-address .eeprom-0x810000

coff: $(TARGET).elf
        @echo
        @echo $(MSG_COFF) $(TARGET).cof
        $(COFFCONVERT) -O coff-avr $< $(TARGET).cof

extcoff: $(TARGET).elf
        @echo
        @echo $(MSG_EXTENDED_COFF) $(TARGET).cof
        $(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof

# Create final output files (.hex, .eep) from ELF output file.
%.hex: %.elf
        @echo
        @echo $(MSG_FLASH) $@
        $(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@

%.eep: %.elf
        @echo
        @echo $(MSG_EEPROM) $@
        -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
        --change-section-lma .eeprom=0 -O $(FORMAT) $< $@

# Create extended listing file from ELF output file.
%.lss: %.elf
        @echo
        @echo $(MSG_EXTENDED_LISTING) $@
        $(OBJDUMP) -h -S $< > $@

# Create a symbol table from ELF output file.
%.sym: %.elf
        @echo
        @echo $(MSG_SYMBOL_TABLE) $@
        $(NM) -n $< > $@

# Link: create ELF output file from object files.
.SECONDARY : $(TARGET).elf
.PRECIOUS : $(OBJ)
%.elf: $(OBJ)
        @echo
        @echo $(MSG_LINKING) $@
        $(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS)

# Compile: create object files from C source files.
%.o : %.c
        @echo
        @echo $(MSG_COMPILING) $<
        $(CC) -c $(ALL_CFLAGS) $< -o $@

# Compile: create assembler files from C source files.
%.s : %.c
        $(CC) -S $(ALL_CFLAGS) $< -o $@

# Assemble: create object files from assembler source files.
%.o : %.S
        @echo
        @echo $(MSG_ASSEMBLING) $<
        $(CC) -c $(ALL_ASFLAGS) $< -o $@

# Create preprocessed source for use in sending a bug report.
%.i : %.c
        $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@

# Target: clean project.
clean: begin clean_list end

clean_list :
        @echo
        @echo $(MSG_CLEANING)
        $(REMOVE) $(TARGET).hex
        $(REMOVE) $(TARGET).eep
        $(REMOVE) $(TARGET).cof
        $(REMOVE) $(TARGET).elf
        $(REMOVE) $(TARGET).map
        $(REMOVE) $(TARGET).sym
        $(REMOVE) $(TARGET).lss
        $(REMOVE) $(OBJ)
        $(REMOVE) $(LST)
        $(REMOVE) $(SRC:.c=.s)
        $(REMOVE) $(SRC:.c=.d)
        $(REMOVE) .dep/*

# Include the dependency files.
-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)

# Listing of phony targets.
.PHONY : all begin finish end sizebefore sizeafter gccversion \
        build elf hex eep lss sym coff extcoff \
        clean clean_list program debug gdb-config

阿莫论坛20周年了!感谢大家的支持与爱护!!

一只鸟敢站在脆弱的枝条上歇脚,它依仗的不是枝条不会断,而是自己有翅膀,会飞。

出0入0汤圆

发表于 2008-7-11 17:00:29 | 显示全部楼层
晕啊。。。看的头大。。。

出0入0汤圆

发表于 2008-7-12 23:54:01 | 显示全部楼层
帮你置个cool,非常不错哈

出0入0汤圆

发表于 2008-7-13 07:44:41 | 显示全部楼层
我的是F8下用RPM安的

出0入0汤圆

 楼主| 发表于 2008-7-13 09:18:06 | 显示全部楼层
2楼:谢谢支持,只是笔记性质的而已,没什么技术含量,另外,那个,就是我怎么没看到有“酷”呢

3楼:能详细说说吗,还有个问题请教,我在root下安装的软件,怎么在普通用户下使用呢

出0入0汤圆

发表于 2008-7-16 11:46:51 | 显示全部楼层
请问搂住你root下装的软件普通用户不能用吗?有什么现象?

出0入0汤圆

发表于 2008-7-16 11:56:29 | 显示全部楼层
在root用户下执行
#chown [username]:[group] -R [软件路径]
#chmod +w +r -R [软件路径]

执行不了可能是权限问题。chown 用来改变用户和组,chmod 使文件可写可读,-R是应用于所有子文件夹文件。
再进普通用户试试。(以上命令没有测试,楼主随便吧)

出0入0汤圆

 楼主| 发表于 2008-7-16 12:55:15 | 显示全部楼层
谢谢xylch101,我的现象是:
在root用户下正常,但是在普通用户下提示说:
avr-gcc:command not found
是不是什么地方路径没有加入

出0入0汤圆

发表于 2008-7-16 14:03:42 | 显示全部楼层
o,那是当前用户PATH变量里找不到avr-gcc的路径

1、这是你自己写的“到root目录,选显示隐藏文件,打开.bashrc文件,在最后加入export PATH=/usr/avrgcc/bin:${PATH} ”,这个只是改root的配置,普通用户登陆时要读用户自己的配置,用同样的方法把你的用户的目录里的.bashrc加上那句话,注销,登陆,就能找到了(普通用户的目录在/home/[用户名]下)。

2、
或者是
在命令行下敲
$export PATH=/usr/avrgcc/bin:${PATH}
$avr-gcc
也行,不过下次登陆还得这样做。

3、或者是
在命令行下敲
$cd /usr/avrgcc/bin
$./avr-gcc
也可以执行,不过最好用第一种方法,路经加到用户环境变量里,方便以后使用。
回帖提示: 反政府言论将被立即封锁ID 在按“提交”前,请自问一下:我这样表达会给举报吗,会给自己惹麻烦吗? 另外:尽量不要使用Mark、顶等没有意义的回复。不得大量使用大字体和彩色字。【本论坛不允许直接上传手机拍摄图片,浪费大家下载带宽和论坛服务器空间,请压缩后(图片小于1兆)才上传。压缩方法可以在微信里面发给自己(不要勾选“原图),然后下载,就能得到压缩后的图片】。另外,手机版只能上传图片,要上传附件需要切换到电脑版(不需要使用电脑,手机上切换到电脑版就行,页面底部)。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|Archiver|amobbs.com 阿莫电子技术论坛 ( 粤ICP备2022115958号, 版权所有:东莞阿莫电子贸易商行 创办于2004年 (公安交互式论坛备案:44190002001997 ) )

GMT+8, 2024-5-20 19:44

© Since 2004 www.amobbs.com, 原www.ourdev.cn, 原www.ouravr.com

快速回复 返回顶部 返回列表