winavr包含库文件时编译

其实也可这样干:
假如有个库文件是libtest.a
可以在这个地方跟加
MATH_LIB = -lm \
           libtest.a

大约在Makefile240多行 

MATH_LIB = -lm 
TW2835_LIB_PATH = TW2835/lib 
TW2835_LIB = -ltw2835


# List any extra directories to look for libraries 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. 
EXTRALIBDIRS = 

#---------------- 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,--section-start,.data=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 += $(patsubst %,-L%,$(EXTRALIBDIRS)) 
LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB) 
#LDFLAGS += -T linker_script.x 
LDFLAGS += -L$(TW2835_LIB_PATH) 
LDFLAGS += $(TW2835_LIB)



生成库文件时只需在Tool里添加 make lib就行了

没有更多推荐了,返回首页