make 实例 二 V56
#########################################################################
#
# Makefile used for building application.
#
# The default target (all) builds application in three formats :
# *.rec : Image in S-record format.
# *.bin : Image in binary format.
# *.elf : Image in ELF format.
# *.map : Linker generated map file.
# *.dis : Disassembly of image.
# *.sym : Symbols.
#
# Other targets are :
# clean : Deletes all files generated by makefile.
#
######################################################################### CONFIG_FILE ?= .config -include $(CONFIG_FILE) PROJ ?= S7L
PARA ?=
# **********************************************
# Build Options
# **********************************************
# Version: Debug or Retail
VERSION ?= Retail # Makefile for DVB system
TV_SYSTEM = DVB # Image name
AP_NAME = AP
BL_NAME = BL
AP_COMPRESS_NAME = AP_C
MERGE_NAME = VIDEOCON
RES_NAME = RES # **********************************************
# Tool Chain
# **********************************************
CROSSCOMPILE = aeon-
CORSSCOMPILE_VER =
AEON_FLAG = -march=$(AEON_TYPE) -mhard-div -mhard-mul -EL -mredzone-size= # AEON_FLAG = -march=aeon1 -mhard-div -mhard-mul -fno-delayed-branch -minsert-nop-before-branch CC = $(CROSSCOMPILE)gcc $(CROSSCOMPILE_VER)
CPP = $(CROSSCOMPILE)cpp
LD = $(CROSSCOMPILE)ld OBJCOPY = $(CROSSCOMPILE)objcopy
OBJDUMP = $(CROSSCOMPILE)objdump
SIZE = $(CROSSCOMPILE)size
AR = $(CROSSCOMPILE)ar
NM = $(CROSSCOMPILE)nm
AWK = /bin/gawk
FLINT = scripts/flint
REALPATH= echo # **********************************************
# Directories
# **********************************************
PREFIXDIR?=
ROOT = .
BINDIR = ./$(PREFIXDIR)/Bin_$(PROJ)
BINPATH = $(BINDIR)
OBJDIR = ./$(PREFIXDIR)/Obj_$(PROJ)
OBJPATH = $(OBJDIR)
LZSSDIR = ./scripts/lzss
MSCOMPDIR = ./scripts/util
COREDIR ?= ./core CC_TVOPTS += -DORGINAL_ALL_MERGE=
CC_TVOPTS += -DBLOADER=
CC_TVOPTS += -DSECURE_BOOT= # Source files SRC_FILE = ./core/api/utl/NoOS.c # Add "Header (include) file" directories here ...
INC_DIR = \
-I$(ROOT)/include \
-I$(BOOTDIR) \
-I$(COREDIR)/api/utl \
-I$(COREDIR)/api/closedcaption/atsc/include \
-I$(COREDIR)/middleware/closedcaption/include \
-I$(COREDIR)/bin/vdec/mvd \
-I$(COREDIR)/api/include \
-I$(COREDIR)/api/Arabic_Parser/include \
-I$(COREDIR)/api/Thai_Parser/include \
-I$(COREDIR)/driver/sys/include \
-I$(DRV_BSP_INC) \
-I$(DRV_LEGACY_INC) \
-I$(ROOT)/project/image/atsc/binitem \
-I$(ROOT)/project/image/dvbt/binitem \
-I$(ROOT)/project/image/u3/binitem \
-I$(ROOT)/project/image/s7/binitem \
-I$(ROOT)/project/image/s7ld/binitem INC_DIR += -I$(ROOT)/include/std CC_TVOPTS += -DENABLE_MSTV_UART_DEBUG= -DUSE_SW_I2C= -DCOMB_3D -DBOOTLOADER_BANK_NUM
WARN_FLAGS = -Wall -Wextra -Wcast-align -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -Wno-format -Wshadow
YOGA_GLOBAL_CFLAGS = -pipe -fno-exceptions -ffunction-sections $(WARN_FLAGS) include project/build/FILES_$(PROJ).mk #This is a patch, move to here
IMGINFO_OFFSET =
BOOTLOADER ?= project/loader/bootloader_M12_R2.ld
DRV_BSP_INC = $(COREDIR)/drv_bsp/m12_nos_r2m/include # -D__CREATE_TIMER_WITH_INTERVAL_0__
# **********************************************
# Image file names
# **********************************************
AP_BIN = $(BINPATH)/$(AP_NAME).bin
###AP_BIN2= $(BINPATH)/$(AP_NAME)_2.bin
APC_BIN = $(BINPATH)/$(AP_COMPRESS_NAME).bin
AP_ELF = $(BINPATH)/$(AP_NAME).elf
AP_MAP = $(BINPATH)/$(AP_NAME).map
AP_DIS = $(BINPATH)/$(AP_NAME).dis
AP_SYM = $(BINPATH)/$(AP_NAME).sym
AP_OBJ = $(OBJPATH)/$(AP_NAME).o MERGE_BIN = $(BINPATH)/$(MERGE_NAME).bin
#MERGE_ELF = $(BINPATH)/$(MERGE_NAME).elf
MERGE_DIS = $(BINPATH)/$(MERGE_NAME).dis
MERGE_MAP = $(BINPATH)/$(MERGE_NAME).map
MERGE_BIN_2 = $(BINPATH)/$(MERGE_NAME)_2.bin
###HK51_BOOT = $(BINPATH)/$(MERGE_NAME).bin
RES_BIN = $(BINPATH)/$(RES_NAME).bin # **********************************************
# Tools
# **********************************************
#SWAP = perl $(TOOLS)/byteswap.pl
BinIDPackFiles = python scripts/BinIDPackFiles_Compress.py
BinIDPackResources = python scripts/BinIDPackResources.py
AddBin = python scripts/Addbin.py # **********************************************
# Files to be compiled
# **********************************************
SRC_S = $(filter %.S, $(SRC_FILE))
SRC_C = $(filter %.c, $(SRC_FILE))
SRC_O = $(filter %.o, $(SRC_FILE))
SRC_B = $(filter %.bin, $(SRC_FILE)) OBJ_S = ${SRC_S:%.S=$(OBJPATH)/%.o}
OBJ_C = ${SRC_C:%.c=$(OBJPATH)/%.o}
OBJ_B = ${SRC_B:%.bin=$(OBJPATH)/%.o} OBJ = $(OBJ_C) $(OBJ_B) $(OBJ_S) BL_SRC_S = $(filter %.S, $(BL_SRC_FILE))
BL_SRC_C = $(filter %.c, $(BL_SRC_FILE))
BL_SRC_O = $(filter %.o, $(BL_SRC_FILE))
BL_SRC_B = $(filter %.bin, $(BL_SRC_FILE)) BL_OBJ_S = ${BL_SRC_S:%.S=$(OBJPATH)/%.o}
BL_OBJ_C = ${BL_SRC_C:%.c=$(OBJPATH)/%.o}
BL_OBJ_B = ${BL_SRC_B:%.bin=$(OBJPATH)/%.o} BL_OBJ = $(BL_OBJ_C) $(BL_OBJ_B) $(BL_OBJ_S)
SRC = $(SRC_C) $(BL_SRC_C) # **********************************************
# Compiler and linker options
# **********************************************
YOGA_GLOBAL_LDFLAGS = -msoft-float -g -nostdlib -Wl,--gc-sections -Wl,-static INCLUDE = $(INC_DIR) CC_OPTS0 += -c $(INCLUDE) $(AEON_FLAG) $(CC_TVOPTS) $(YOGA_GLOBAL_CFLAGS) $(MALLOC_CFLAGS)
CC_OPTS0 += -Wno-strict-aliasing
CC_OPTS = $(CC_OPTS0) -O2 LD_OPTS += -nostartfiles $(YOGA_GLOBAL_LDFLAGS) $(AEON_FLAG) -LLIB -W1,--gc-sections
LDLIB += -lc -lgcc -lm # **********************************************
# Rules
# **********************************************
.PHONY : all clean pmsleep lint
.SUFFIXES: .bin .elf .dis .sym .siz # Project Build all : $(PROJ) $(PROJ): loader setup sboot ap merge lint #Note: It's slow to produce .dis file w/o -gdwarf-2 set or original OS source code
ap: $(AP_ELF) $(AP_BIN) $(AP_SYM) merge: $(MERGE_ELF) $(MERGE_BIN) dis: $(AP_DIS) $(MERGE_DIS) HEAP_START=$$(cat HEAP_START.txt)
HEAP_END=$$(cat HEAP_END.txt)
HEAP_SIZE=$$((($(HEAP_END)-$(HEAP_START))/))
HEAP_START_STRING= ___heap = .
HEAP_END_STRING= ___heap_end = (RAM_START + RAM_SIZE) sboot: $(AP_BIN)
@grep '__heap =' $(BINPATH)/AP.map | sed 's\$(HEAP_START_STRING)\\g' | sed 's/^.*0x/0x/g'>HEAP_START.txt;
@grep '__heap_end =' $(BINPATH)/AP.map | sed 's\$(HEAP_END_STRING)\\g' | sed 's/^.*0x/0x/g'>HEAP_END.txt;
@echo "HEAP_START= $(HEAP_START)"
@echo "HEAP_END = $(HEAP_END)"
@echo "$(HEAP_SIZE)">HEAP_SIZE.txt
# @rm HEAP_START.txt
# @rm HEAP_END.txt
# @echo "HEAP_SIZE = $(HEAP_SIZE)KB"
@awk '{if($$1>=100) {print "HEAP_SIZE = "$$1" KB";rm "HEAP_SIZE.txt";}else {print "Error:HEAP_SIZE("$$1"KB) is less than 100 KB";exit 1}}' HEAP_SIZE.txt
@echo "[SBOOT] $@"
# @$(shell $(LZSSDIR)/lzss.out C $(BINPATH)/$(AP_NAME).bin $(BINPATH)/$(AP_COMPRESS_NAME).bin;)
@$(shell $(MSCOMPDIR)/mscompress -c -u - $(BINPATH)/$(AP_NAME).bin > $(BINPATH)/$(AP_COMPRESS_NAME).bin;)
@$(shell cp $(BINPATH)/$(AP_COMPRESS_NAME).bin $(ROOT)/boot/sboot/bin/$(AP_NAME).bin; cp $(BINPATH)/$(AP_NAME).map $(ROOT)/boot/sboot/bin;)
@(cd $(ROOT)/boot/sboot; $(MAKE) clean;)
@( mkdir -p $(ROOT)/boot/sboot/out;)
ifeq ($(MEMORY_SIZE),MEMORY_128MB)
@(cp $(ROOT)/boot/sboot/bin/$(BOARD_TYPE_SEL)/sboot_128.bin $(ROOT)/boot/sboot/out/sboot.bin;)
else
@(cp $(ROOT)/boot/sboot/bin/$(BOARD_TYPE_SEL)/sboot.bin $(ROOT)/boot/sboot/out/sboot.bin;)
endif
########################################################################################
# since we can use SW PM, then PM.bin should be compiled according to BOARD define
########################################################################################
@(/bin/cp -f $(ROOT)/boot/sboot/bin/$(BOARD_TYPE_SEL)/PM.bin $(ROOT)/boot/sboot/out;)
########################################################################################
@$(MAKE) -C $(ROOT)/boot/sboot $(AP_ELF) : $(OBJ_S) $(OBJ_C) $(OBJ_B) $(DTV_LIB)
@echo "[LD] $@"
@$(CC) $(LD_OPTS) -Wl,-Map,$(AP_MAP) -Wl,--start-group $^ -Wl,--end-group -T$(LOADER) -o $@ $(LDLIB)
#@$(AR) -r $(ROOT)/core/api/msAPI_Flash.a $(OBJPATH)/core/api/msAPI_Flash.o
@$(SIZE) $@ $(AP_BIN) : $(AP_ELF)
@echo "[BIN] $@"
@$(OBJCOPY) -O binary -S -g -x -X -R .sbss -R .bss -R .reginfo $< $@ $(AP_OBJ): $(AP_BIN)
# $(shell $(LZSSDIR)/lzss.out C $(BINPATH)/AP.bin $(BINPATH)/AP_C.bin; cd $(BINPATH); $(OBJCOPY) -I binary -O elf32-littleaeon -B aeon:aeonR2 --prefix-sections=bin AP_C.bin ../$(OBJPATH)/AP.o)
$(shell $(MSCOMPDIR)/mscompress -c -u - $(BINPATH)/$(AP_NAME).bin > $(BINPATH)/$(AP_COMPRESS_NAME).bin; cd $(BINPATH); $(OBJCOPY) -I binary -O elf32-littleaeon -B aeon:aeonR2 --prefix-sections=bin AP_C.bin ../$(OBJPATH)/AP.o) $(MERGE_ELF): $(BL_OBJ_S) $(BL_OBJ_C) $(BL_OBJ_B) $(AP_OBJ)
@echo "[LD] $@"
@$(CC) $(LD_OPTS) -Wl,-Map,$(MERGE_MAP) $^ -T$(BOOTLOADER) -o $@ $(LDLIB)
@$(SIZE) $@ $(MERGE_BIN) : $(AP_BIN)
@echo "[BIN] $@"
$(shell cp $(ROOT)/boot/sboot/out/all.bin $(MERGE_BIN);)
$(BinIDPackFiles) -BIGENDIAN -CRC16ENABLE -multiflash $@ $(BIN_INFO) $(IMGINFO_OFFSET) $(APC_BIN) $(OS_TYPE) $(RES_BIN) : $(AP_ELF)
@echo "[BIN] $@"
$(BinIDPackResources) -BIGENDIAN -CRC16ENABLE $< $@ $(BIN_INFO)
@cp core/bin/s7/audio/out_dvb_t3_d.bin $(BINPATH)/au_d.bin
@cp core/bin/s7/audio/out_dvb_t3_s.bin $(BINPATH)/au_s.bin
cp tv-ap/dvb/ui2/logo/Mstar_OSD_Logo_683x384.jpg $(BINPATH)/boot0.jpg
cp tv-ap/dvb/ui2/logo/mp3.mp3 $(BINPATH)/boot0.mp3
@./generate_pnl_bin.sh $(BINPATH)/AP.elf $(BINPATH) $(OBJ_B) $(BL_OBJ_B): $(OBJPATH)/%.o : %.bin
@echo "[BIN] $@"
@$(shell cd $(dir $<); $(OBJCOPY) -I binary -O elf32-littleaeon -B aeon --prefix-sections=bin $(notdir $<) $(abspath $@)) $(OBJPATH)/%.o: %.S
$(call make-depend-compile,$<,$@,$(subst .o,.d,$@)) $(OBJPATH)/%.o: %.c
$(call make-depend-compile,$<,$@,$(subst .o,.d,$@)) $(OBJPATH)/%.o: %.bin
@echo "[BIN] $@"
@$(shell cd $(dir $<); $(OBJCOPY) -I binary -O elf32-littleaeon -B aeon --prefix-sections=bin $(notdir $<) $(abspath $@)) .c.ln: ; lint -abhi $*.c
.elf.dis: ; @echo "[DIS] $@" ; $(OBJDUMP) -d -h -S $< > $@
.elf.sym: ; @echo "[SYM] $@" ; $(NM) -a -S $< > $@
.elf.siz: ; @echo "[SIZ] $@" ; $(SIZE) $< > $ LINT_INC=$(subst -I,,$(INC_DIR))
LINT_SRC_C=$(SRC_C)
LINT_DEF=$(subst -D,-d,$(filter -D%,$(CC_OPTS))) lint:
ifneq ($(DISABLE_LINT),)
@(\
echo "scripts/co-gnu3.lnt"; \
echo $(LINT_OPT1); \
echo | $(CPP) -dM | \
sed -e '/LONG_LONG/d' | \
sed -e 's/#define \([^ ]*\) "\(..*\)"/-d"\1=(\2)"/' | \
sed -e 's/#define \([^ ]*\) \(..*\)/-d"\1=\2"/' | \
sed -e 's/#define /-d/'; \
for i in $(LINT_DEF); do \
echo $$i; \
done; \
for i in $(LINT_INC); do \
echo -i\"$$i\"; \
done; \
for i in `$(REALPATH) \`echo | $(CPP) -x c -Wp,-v >& | grep '^ '\``; do \
echo -i\"$$i\"; \
done; \
for i in $(LINT_SRC_C); do \
echo $$i; \
done; \
) > $(BINPATH)/$(PROJ).lnt
@$(FLINT) -fff $(BINPATH)/$(PROJ).lnt > $(BINPATH)/LINT.txt; \
grep -v 'Module:' $(BINPATH)/LINT.txt | grep -v '^$$' ; true
@echo
@echo `grep 'Error' $(BINPATH)/LINT.txt | wc -l` LINT Errors
endif .PHONY: $(OBJPATH)/tv-ap/dvb/ui/MApp_ZUI_ACTmenufunc.o
loader: # Project Setup
setup:
@mkdir -p $(OBJDIR) $(BINDIR);
@rm -f $(call src-to-obj,$(REBUILD_FILES))
@cp -f $(ROOT)/project/loader/target.ld $(LOADER); chmod $(LOADER)
@$(AWK) '{if ($$2=="BEON_MEM_ADR") print $$3;}' $(MMAP) > $(ROOT)/project/mmap/aeon_mem_adr
@$(AWK) 'BEGIN { \
getline < "$(ROOT)/project/mmap/aeon_mem_adr"; \
ADR = $$ \
} \
{ \
if ($$=="RAM_START") gsub($$, ""ADR";", $$); \
if ($$=="ram" && $$=="ORIGIN") gsub($$, ""ADR",", $$); \
if ($$==".prog_img_info") gsub($$, "("ADR"+0x1100)", $$); \
if ($$==".img_info") gsub($$, "("ADR"+0x2000)", $$); \
if ($$==".isp_info") gsub($$, "("ADR"+0x3000)", $$); \
print > FILENAME ".tmp"; \
}' $(LOADER)
@mv -f $(LOADER).tmp $(LOADER)
@$(AWK) '{if ($$2=="BEON_MEM_LEN") print $$3;}' $(MMAP) > $(ROOT)/project/mmap/aeon_mem_len
@$(AWK) 'BEGIN { \
getline < "$(ROOT)/project/mmap/aeon_mem_len"; \
LEN = $$\
} \
{ \
if ($$=="RAM_SIZE") gsub($$, ""LEN";", $$); \
if ($$=="ram" && $$=="LENGTH") gsub($$, ""LEN"", $$); \
print > FILENAME ".tmp"; \
}' $(LOADER)
@mv -f $(LOADER).tmp $(LOADER) env:
@echo CC_OPTS = $(CC_OPTS)
@echo LD_OPTS = $(LD_OPTS)
@echo SRC = $(SRC) # Project API
DOCGEN :
# doxygen.exe $(ROOT)/project/Doxygen/Venus_3RD_PARTY_DDI_API.doxygen # Project Clean
clean :
find $(OBJPATH) -name '*.o' -exec rm -f {} \;
rm -f $(BINPATH)/$(AP_NAME).* $(BINPATH)/$(MERGE_NAME).* ###$(BINPATH)/$(AP_NAME)_2.* $(BINPATH)/$(MERGE_NAME)_2.*
ifeq ($(BUILD_TARGET),MAIN_AP_SYSTEM)
@$(MAKE) PROJ=$(PROJ)_BLOADER clean
endif realclean:
echo $($(ver)) checkstack: $(AP_ELF)
$(OBJDUMP) -d $(AP_ELF) | scripts/checkstack.pl aeon # Project Dependence # $(call make-depend-compile,source-file,object-file,depend-file)
define make-depend-compile
@echo "[CC] $1"
@mkdir -p $(dir $)
@$(CC) -MM -MF $ -MP -MT $ $(CC_OPTS) $
@$(CC) $(CC_OPTS) -o $ -c $
endef src-to-obj = $(patsubst %.bin,$(OBJPATH)%.o,\
$(patsubst %.S,$(OBJPATH)/%.o,\
$(patsubst %.c,$(OBJPATH)/%.o,$))) -include $(OBJ_S:.o=.d) $(OBJ_C:.o=.d)
make 实例 二 V56的更多相关文章
- C语言库函数大全及应用实例二
原文:C语言库函数大全及应用实例二 [编程资料]C语言库函数大全及应用实例二 函数名: bioskey 功 能 ...
- Hibernate实例二
Hibernate实例二 一.测试openSession方法和getCurrentSession方法 hebernate中可以通过上述两种方法获取session对象以对数据库进行操作,下面的代码以及注 ...
- Ajax实例二:取得新内容
Ajax实例二:取得新内容 通过点击pre和next按钮,从服务器取得最新内容. HTML代码 <div id="slide">图片显示区</div> &l ...
- WPF中的多进程(Threading)处理实例(二)
原文:WPF中的多进程(Threading)处理实例(二) //错误的处理 private void cmdBreakRules_Click(object sender, RoutedEventArg ...
- express+nodecoffee写passport登录验证实例(二)
二:实现登录认证 passport官网文档: http://passportjs.org/guide/ passport验证使用一种被称为“策略”的方式来验证请求,策略支持3种类型的验证:用户名密码 ...
- DWR入门实例(二)
DWR(Direct Web Remoting) DWR is a Java library that enables Java on the server and JavaScript in a b ...
- [原创]MongoDB综合实例二
MongoDB-Sharding部署方案 一. 部署环境 五台主机: Amongoshard01: 10.212.74.43 Amongoshard02: 10.212.84.4 Among ...
- Postman接口自动化测试实例二
在<Postman接口自动化测试实例>一文中,我是在获取随机因子的接口的Tests中对用户的密码进行加密处理的.其实正常做法应该是在请求验证接口前,即在Pre-request Script ...
- 转://Oracle 事务探索与实例(二)
一数据库版本 SYS@LEO1>select * from v$version; BANNER ------------------------------------------------- ...
随机推荐
- Python学习日记(二) list操作
l = ['a','b','c','d',1,2,[3,'e',4]] 1.list.append() 在list的结尾新增一个新的元素,没有返回值,但会修改原列表 l.append(5) print ...
- Django使用Redis进行缓存详细最全流程
背景和意义服务器数据非经常更新.若每次都从硬盘读取一次,浪费服务器资源.拖慢响应速度.而且数据更新频率较高,服务器负担比较大.若保存到数据库,还需要额外建立一张对应的表存储数据.在Django中建立表 ...
- 分布式结构化存储系统-HBase访问方式
分布式结构化存储系统-HBase访问方式 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. HBase提供了多种访问方式,包括HBase shell,HBase API,数据收集组件( ...
- 分布式结构化存储系统-HBase基本架构
分布式结构化存储系统-HBase基本架构 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 在大数据领域中,除了直接以文件形式保存数据外,还有大量结构化和半结构化的数据,这类数据通常需 ...
- sqlite3入门之sqlite3_open,sqlite3_exec,slite3_close
sqlite3_open sqlite3_open函数原型: int sqlite3_open( const char *filename, /* Database filename (UTF-8) ...
- NTP时间服务器+DHCP服务器的搭建
一.构建NTP时间服务器 ntp服务器监控端口UDP:123 安装ntp和ntpdate 命令:yum -y install ntp netdate 修改配置文件/etc/ntp.conf 启动nt ...
- MySQL增加行号rownum
select * from ( select @rownum:=@rownum+1 AS rownum, app_t.* from ( select * from app_custom where 1 ...
- 钉钉、阿里云和PaaS平台的整合开发
钉钉在企业移动办公领域有着很高的占有率,但是可能大家都会觉得,他在企业定制化,数据分析等领域有着很大的短板. 而我们的kintone作为PaaS平台,可以补足这个短板.很多开发者想知道如何利用钉钉还有 ...
- redis开发相关
1.为什么要用缓存,缓存的使用场景2.redis数据存储类型 string/list/set/hash/sort set(zset)3.redis的常用数据类型,使用方式4.redis实现的跳跃表是什 ...
- littlefs了解一下
littlefs是一个文件系统,断电数据不会出异常,适合IOT场景.