From: batt Date: Tue, 24 Jun 2008 16:31:55 +0000 (+0000) Subject: Now each project can have its own EMBEDDED_TGT variable to be compiled in embedded... X-Git-Tag: 2.0.0~450 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=22e903f490208fcc6f6de86250c723b1f200a61d;p=bertos.git Now each project can have its own EMBEDDED_TGT variable to be compiled in embedded or hosted mode. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@1484 38d2e660-2303-0410-9eaa-f027e97ec537 --- diff --git a/app/at91sam7s/at91sam7s.mk b/app/at91sam7s/at91sam7s.mk index 81bc4c2b..5cb34b68 100644 --- a/app/at91sam7s/at91sam7s.mk +++ b/app/at91sam7s/at91sam7s.mk @@ -12,6 +12,9 @@ # Set to 1 for debug builds at91sam7s_DEBUG = 1 +#This is an embedded project +at91sam7s_EMBEDDED_TGT = 1 + # Our target application TRG += at91sam7s diff --git a/app/demo/demo.mk b/app/demo/demo.mk index f9dbd818..7bf46ae5 100644 --- a/app/demo/demo.mk +++ b/app/demo/demo.mk @@ -11,6 +11,9 @@ include bertos/fonts/fonts.mk include bertos/emul/emul.mk +#Demo application is hosted +demo_EMBEDDED_TGT = 0 + # Set to 1 for debug builds demo_DEBUG = 1 diff --git a/app/triface/triface.mk b/app/triface/triface.mk index 9cf4fed6..e3792be5 100644 --- a/app/triface/triface.mk +++ b/app/triface/triface.mk @@ -9,6 +9,8 @@ # # +# This is an embedded project +triface_EMBEDDED_TGT = 1 # Set to 1 for debug builds triface_DEBUG = 1 diff --git a/bertos/config.mk b/bertos/config.mk index b21b2c1f..81512594 100644 --- a/bertos/config.mk +++ b/bertos/config.mk @@ -13,11 +13,6 @@ -include pgm_config.mk DPROG ?= -V -c stk500 -P /dev/ttyS0 -# Set to 1 to build for embedded devices. -# e.g. produce target.elf instead of target and target_nostrip -#EMBEDDED_TARGET = 1 -EMBEDDED_TARGET = 0 - OPTCFLAGS = -ffunction-sections -fdata-sections #OPTCFLAGS = -funsafe-loop-optimizations @@ -74,11 +69,9 @@ DEP_FLAGS = -MMD -MP LIST_FLAGS = -Wa,-anhlmsd=$(@:.o=.lst) # Linker flags for generating map files -ifeq ($(EMBEDDED_TARGET), 1) -MAP_FLAGS = -Wl,-Map=$(@:%.elf=%.map),--cref -else -MAP_FLAGS = -endif +# Only in embedded related projects generate map files +MAP_FLAGS_EMB = -Wl,-Map=$(@:%.elf=%.map),--cref +MAP_FLAGS_HOST = # Compiler warning flags for both C and C++ WARNFLAGS = \ @@ -113,7 +106,7 @@ ASFLAGS = $(DEBUGCFLAGS) #LDFLAGS = $(MAP_FLAGS) #bernie: does not complain for missing symbols! -LDFLAGS = $(MAP_FLAGS) -Wl,--gc-sections +LDFLAGS = -Wl,--gc-sections # Flags for avrdude AVRDUDEFLAGS = $(DPROG) diff --git a/bertos/rules.mk b/bertos/rules.mk index 15336494..f62c5cd8 100644 --- a/bertos/rules.mk +++ b/bertos/rules.mk @@ -36,25 +36,16 @@ endif # Initialize $(top_srcdir) with current directory, unless it was already initialized top_srcdir ?= $(shell pwd) -# Products -TRG_ELF = $(TRG:%=$(OUTDIR)/%.elf) -TRG_S19 = $(TRG:%=$(OUTDIR)/%.s19) -TRG_HEX = $(TRG:%=$(OUTDIR)/%.hex) -TRG_BIN = $(TRG:%=$(OUTDIR)/%.bin) -TRG_ROM = $(TRG:%=$(OUTDIR)/%.rom) -TRG_COF = $(TRG:%=$(OUTDIR)/%.cof) -TRG_EXE = $(TRG:%=$(OUTDIR)/%) - +# Virtual Product: based on target products may be different. +# e.g. Embedded target = hex, s19, bin +# Hosted = exe +TRG_TGT = $(TRG:%=$(OUTDIR)/%.tgt) RECURSIVE_TARGETS = all-recursive install-recursive clean-recursive # The default target .PHONY: all -ifeq ($(EMBEDDED_TARGET),1) -all:: all-recursive $(TRG_S19) $(TRG_HEX) $(TRG_BIN) -else -all:: all-recursive $(TRG_EXE) -endif +all:: all-recursive $(TRG_TGT) # Generate project documentation .PHONY: docs @@ -76,6 +67,20 @@ check: define build_target +ifeq ($$($(1)_EMBEDDED_TGT),1) +#use embedded specific map flags +$(1)_MAP_FLAGS = $$(MAP_FLAGS_EMB) +#In embedded we need s19, hex and bin +$$(OUTDIR)/$(1).tgt : $$(OUTDIR)/$(1).s19 $$(OUTDIR)/$(1).hex $$(OUTDIR)/$(1).bin +else +#use hosted specific map flags +$(1)_MAP_FLAGS = $$(MAP_FLAGS_HOST) +#in hosted application we need only executable file. +$$(OUTDIR)/$(1).tgt : $$(OUTDIR)/$(1) +endif + +$(1)_LDFLAGS += $$($(1)_MAP_FLAGS) + ifneq ($$(strip $$($(1)_MCU)),) # Define all project specific object files $(1)_CFLAGS += -mmcu=$$($(1)_MCU)