TI DM64xx多核多媒体架构编程之音视频编解码工程静态编译

DVSDK 默认的工程是动态链接的,一般板子都不提供动态库依赖,需要把程序编译成静态库依赖。由于对gcc-ld链接的规则疏忽,导致一整天都在查找undefined reference to `xxxxxx'


效果:

[root@localhost dvsdk_1_30_01_41]# file demos/dm6446/decode/debug/decoded 
demos/dm6446/decode/debug/decoded: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, for GNU/Linux 2.4.17, not stripped


分享一下我对demo/dm6446/decode的修改:

# Makefile
#
# ============================================================================
# Copyright (c) Texas Instruments Inc 2007
#
# Use of this software is controlled by the terms and conditions found in the
# license agreement under which this software has been supplied or provided.
# ============================================================================

ROOTDIR = ../../..
TARGET = $(notdir $(CURDIR))

include $(ROOTDIR)/Rules.make

# Where to output configuration files
XDC_CFG = $(TARGET)_config

# Output compiler options
XDC_CFLAGS = $(XDC_CFG)/compiler.opt

# Output linker file
XDC_LFILE = $(XDC_CFG)/linker.cmd

# Input configuration file
XDC_CFGFILE = $(TARGET).cfg

# Target tools
XDC_TARGET = gnu.targets.MVArm9

# Platform (board) to build for
XDC_PLATFORM = ti.platforms.evmDM6446

# Package path for the XDC tools
XDC_PATH = $(CODEC_INSTALL_DIR)/packages;$(CE_INSTALL_DIR)/packages;$(LINK_INSTALL_DIR)/packages;$(XDAIS_INSTALL_DIR)/packages;$(CMEM_INSTALL_DIR)/packages;$(FC_INSTALL_DIR)/packages

# The XDC configuration tool command line
CONFIGURO = XDCPATH="$(XDC_PATH)" $(XDC_INSTALL_DIR)/xs xdc.tools.configuro

#modify by houwenbin
C_FLAGS += -Wall -Dti_sdo_ce_osal_Memory_USEDEPRECATEDAPIS=1

CPP_FLAGS += -I$(DVEVM_INSTALL_DIR)/demos/dm6446/utils/include \
		-I$(LINUXKERNEL_INSTALL_DIR)/include

#modify by houwenbin
LD_FLAGS += -lfreetype -lpng -ljpeg -lpthread -lz -lm

COMPILE.c = $(MVTOOL_PREFIX)gcc $(C_FLAGS) $(CPP_FLAGS) -c

#modify by houwenbin important
#LINK.c = $(MVTOOL_PREFIX)gcc $(LD_FLAGS)
LINK.c = $(MVTOOL_PREFIX)gcc -static

DBGTARGET = debug/$(TARGET)d
RELTARGET = release/$(TARGET)

DBGCFLAGS = -g -D__DEBUG
RELCFLAGS = -O2 -fno-strict-aliasing

SOURCES = $(wildcard *.c)
HEADERS = $(wildcard *.h)

DBGOBJFILES = $(SOURCES:%.c=debug/%.o)
RELOBJFILES = $(SOURCES:%.c=release/%.o)

RELLDFLAGS = $(DVEVM_INSTALL_DIR)/demos/dm6446/utils/lib/simplewidget.a \
		$(DVEVM_INSTALL_DIR)/demos/dm6446/utils/lib/msp430lib.a \
		$(DVEVM_INSTALL_DIR)/demos/dm6446/utils/lib/rszcopy.a
DBGLDFLAGS = $(DVEVM_INSTALL_DIR)/demos/dm6446/utils/lib/simplewidgetd.a \
		$(DVEVM_INSTALL_DIR)/demos/dm6446/utils/lib/msp430libd.a \
		$(DVEVM_INSTALL_DIR)/demos/dm6446/utils/lib/rszcopyd.a

.PHONY: clean debug release install

all:	debug release

install:
	install -d $(EXEC_DIR)
	install $(RELTARGET) $(EXEC_DIR)
	install -m 444 $(TARGET).txt $(EXEC_DIR)

release:	$(RELTARGET)

debug:		$(DBGTARGET)

#modify by houwenbin important
$(RELTARGET):	$(RELOBJFILES) $(XDC_LFILE)
	$(LINK.c) -o $@ $^ $(RELLDFLAGS) $(LD_FLAGS)

#modify by houwenbin
$(DBGTARGET):	$(DBGOBJFILES) $(XDC_LFILE)
	$(LINK.c) -o $@ $^ $(DBGLDFLAGS) $(LD_FLAGS)

$(RELOBJFILES):	release/%.o: %.c $(HEADERS) $(XDC_CFLAGS)
	@mkdir -p release
	$(COMPILE.c) $(RELCFLAGS) $(shell cat $(XDC_CFLAGS)) -o $@ $<

$(DBGOBJFILES):	debug/%.o: %.c $(HEADERS) $(XDC_CFLAGS)
	@mkdir -p debug
	$(COMPILE.c) $(DBGCFLAGS) $(shell cat $(XDC_CFLAGS)) -o $@ $<

$(XDC_LFILE) $(XDC_CFLAGS):	$(XDC_CFG)

$(XDC_CFG):	$(XDC_CFGFILE)
	$(CONFIGURO) -c $(MVTOOL_DIR) -o $(XDC_CFG) -t $(XDC_TARGET) \
		-p $(XDC_PLATFORM) $(XDC_CFGFILE)

clean:
	-$(RM) -rf $(XDC_CFG) release debug *~ *.d .dep


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值