Skip to content

Commit

Permalink
updated makefiles for parallel execution
Browse files Browse the repository at this point in the history
  • Loading branch information
rajszym committed Jan 16, 2020
1 parent 9c439b4 commit 61a37cf
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 72 deletions.
28 changes: 12 additions & 16 deletions makefile.armcc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#**********************************************************#
#file makefile
#author Rajmund Szymanski
#date 03.12.2019
#date 16.01.2020
#brief STM32F4xx makefile.
#**********************************************************#

Expand Down Expand Up @@ -92,15 +92,9 @@ TXTS := $(OBJS:.o=.txt)

#----------------------------------------------------------#

ifneq ($(MAKECMDGOALS),qemu)
CORE_F := --cpu=cortex-m4.fp --apcs=/hardfp/interwork
else
CORE_F := --cpu=cortex-m4
endif
COMMON_F = --md --depend=$(@:.o=.d) # --feedback=$(FED)
ifneq ($(filter DEBUG,$(DEFS)),)
COMMON_F += --debug
endif
COMMON_F = --thumb --cpu=cortex-m4.fp.sp
COMMON_F += $(if $(filter qemu,$(MAKECMDGOALS)),--fpu=softvfp,)
COMMON_F += --md --depend=$(@:.o=.d) # --feedback=$(FED)

OPTIM_F := -O$(OPTF) --split_sections --interleave

Expand All @@ -118,6 +112,9 @@ endif
ifneq ($(filter __MICROLIB,$(DEFS)),)
LD_FLAGS += --library_type=microlib
endif
ifneq ($(filter DEBUG,$(DEFS)),)
COMMON_F += --debug
endif

#----------------------------------------------------------#

Expand Down Expand Up @@ -146,10 +143,9 @@ AS_FLAGS += # $(foreach d,$(DEFS),$(if $(findstring =,$d),--pd="$(subst =, SET
AS_FLAGS += --cpreproc --cpreproc_opts=$(call clist,$(DEFS_F) $(INC_DIRS_F))
LD_FLAGS += $(DEFS_F:%=--pd=%) $(INC_DIRS_F:%=--pd=%)

AS_FLAGS += $(CORE_F) $(COMMON_F)
C_FLAGS += $(CORE_F) $(COMMON_F) $(DEFS_F) $(INC_DIRS_F) $(OPTIM_F)
CXX_FLAGS += $(CORE_F) $(COMMON_F) $(DEFS_F) $(INC_DIRS_F) $(OPTIM_F)
LD_FLAGS += $(CORE_F)
AS_FLAGS += $(COMMON_F)
C_FLAGS += $(COMMON_F) $(DEFS_F) $(INC_DIRS_F) $(OPTIM_F)
CXX_FLAGS += $(COMMON_F) $(DEFS_F) $(INC_DIRS_F) $(OPTIM_F)

#----------------------------------------------------------#

Expand Down Expand Up @@ -219,11 +215,11 @@ $(LSS) : $(ELF)
$(info Creating extended listing: $(LSS))
$(DUMP) $< --text -c -z --output $@

print_size :
print_size : $(OBJS_ALL)
$(info Size of modules:)
$(SIZE) -B -t --common $(OBJS_ALL)

print_elf_size : # print_size
print_elf_size : $(ELF)
$(info Size of target file:)
$(SIZE) -B $(ELF)

Expand Down
34 changes: 14 additions & 20 deletions makefile.clang
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#**********************************************************#
#file makefile
#author Rajmund Szymanski
#date 03.12.2019
#date 16.01.2020
#brief STM32F4xx makefile.
#**********************************************************#

Expand Down Expand Up @@ -90,30 +90,17 @@ TXTS := $(OBJS:.o=.txt)

#----------------------------------------------------------#

COMMON_F = --target=arm-arm-none-eabi -mthumb
ifneq ($(MAKECMDGOALS),qemu)
COMMON_F += -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffast-math
else
COMMON_F += -mcpu=cortex-m3
endif
COMMON_F = --target=arm-arm-none-eabi -mthumb -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -ffast-math
COMMON_F += -mfloat-abi=$(if $(filter qemu,$(MAKECMDGOALS)),soft,hard)
COMMON_F += -O$(OPTF) -ffunction-sections -fdata-sections
ifneq ($(filter USE_LTO,$(DEFS)),)
COMMON_F += -flto
endif
COMMON_F += -Wall -Wextra -Wshadow # -Wpedantic
COMMON_F += -MD -MP
ifneq ($(filter DEBUG,$(DEFS)),)
COMMON_F += --debug
endif

AS_FLAGS =
C_FLAGS =
CXX_FLAGS = -fno-rtti -fno-exceptions # -Wzero-as-null-pointer-constant # -fno-use-cxa-atexit
CXX_FLAGS = -fno-rtti -fno-exceptions # -fno-use-cxa-atexit -Wzero-as-null-pointer-constant
LD_FLAGS = --strict --scatter=$(SCRIPT) --symbols --list_mapping_symbols
LD_FLAGS += --map --info common,sizes,summarysizes,totals,veneers,unused --list=$(MAP) # --callgraph
ifneq ($(filter USE_LTO,$(DEFS)),)
LD_FLAGS += --lto
endif

#----------------------------------------------------------#

Expand All @@ -123,6 +110,13 @@ endif
ifneq ($(filter __MICROLIB,$(DEFS)),)
LD_FLAGS += --library_type=microlib
endif
ifneq ($(filter USE_LTO,$(DEFS)),)
COMMON_F += -flto
LD_FLAGS += --lto
endif
ifneq ($(filter DEBUG,$(DEFS)),)
COMMON_F += --debug
endif

#----------------------------------------------------------#

Expand All @@ -145,7 +139,7 @@ INC_DIRS += $(CLANG)../../RV31/INC/
INC_DIRS_F := $(INC_DIRS:%=-I%)
LIB_DIRS += $(CLANG)../../RV31/LIB/
LIB_DIRS_F := --libpath=$(ARM_LIB)
LIB_DIRS_F += --userlibpath=$(call clist, $(LIB_DIRS))
LIB_DIRS_F += --userlibpath=$(call clist,$(LIB_DIRS))

LD_FLAGS += $(DEFS_F:%=--pd=%) $(INC_DIRS_F:%=--pd=%)

Expand Down Expand Up @@ -221,11 +215,11 @@ $(LSS) : $(ELF)
$(info Creating extended listing: $(LSS))
$(DUMP) --demangle -S $< > $@

print_size :
print_size : $(OBJS_ALL)
$(info Size of modules:)
$(SIZE) -B -t --common $(OBJS_ALL)

print_elf_size : # print_size
print_elf_size : $(ELF)
$(info Size of target file:)
$(SIZE) -B $(ELF)

Expand Down
19 changes: 9 additions & 10 deletions makefile.csmcc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#**********************************************************#
#file makefile
#author Rajmund Szymanski
#date 03.12.2019
#date 16.01.2020
#brief STM32F4xx makefile.
#**********************************************************#

Expand Down Expand Up @@ -93,17 +93,16 @@ TXTS := $(OBJS:.o=.la)

#----------------------------------------------------------#

AS_FLAGS := #-ax
AS_FLAGS += -l -ep
C_FLAGS := #+strict +warn
C_FLAGS += +$(MODEL) -pc99 -l -pad
ifneq ($(MAKECMDGOALS),qemu)
C_FLAGS += +fpu
endif
AS_FLAGS := -l -ep #-ax
C_FLAGS := +$(MODEL) -pc99 -l -pad # +warn # +strict
C_FLAGS += $(if $(filter qemu,$(MAKECMDGOALS)),,+fpu)
LD_FLAGS := -m $(MAP) -p

#----------------------------------------------------------#

ifneq ($(filter DEBUG,$(DEFS)),)
C_FLAGS += +debug
endif
LD_FLAGS := -m $(MAP) -p

#----------------------------------------------------------#

Expand Down Expand Up @@ -185,7 +184,7 @@ $(HEX) : $(CXM)
$(info Creating HEX image: $(HEX))
$(DUMP) -o $@ $<

print_elf_size :
print_elf_size : $(ELF)
$(info Size of target file:)
$(SIZE) -B $(ELF)

Expand Down
26 changes: 11 additions & 15 deletions makefile.gnucc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#**********************************************************#
#file makefile
#author Rajmund Szymanski
#date 03.12.2019
#date 16.01.2020
#brief STM32F4xx makefile.
#**********************************************************#

Expand Down Expand Up @@ -88,22 +88,12 @@ LSTS := $(OBJS:.o=.lst)

#----------------------------------------------------------#

COMMON_F = -mthumb
ifneq ($(MAKECMDGOALS),qemu)
COMMON_F += -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffast-math
else
COMMON_F += -mcpu=cortex-m4
endif
COMMON_F = -mthumb -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -ffast-math
COMMON_F += -mfloat-abi=$(if $(filter qemu,$(MAKECMDGOALS)),soft,hard)
COMMON_F += -O$(OPTF) -ffunction-sections -fdata-sections
ifneq ($(filter USE_LTO,$(DEFS)),)
COMMON_F += -flto
endif
COMMON_F += -Wall -Wextra -Wshadow -Wpedantic
COMMON_F += -MD -MP
COMMON_F += # -Wa,-amhls=$(@:.o=.lst)
ifneq ($(filter DEBUG,$(DEFS)),)
COMMON_F += -g -ggdb
endif

AS_FLAGS =
C_FLAGS =
Expand Down Expand Up @@ -135,6 +125,12 @@ endif
ifneq ($(filter USE_SEMIHOST,$(DEFS)),)
LD_FLAGS += --specs=rdimon.specs
endif
ifneq ($(filter USE_LTO,$(DEFS)),)
COMMON_F += -flto
endif
ifneq ($(filter DEBUG,$(DEFS)),)
COMMON_F += -g -ggdb
endif

#----------------------------------------------------------#

Expand Down Expand Up @@ -219,11 +215,11 @@ $(LSS) : $(ELF)
$(info Creating extended listing: $(LSS))
$(DUMP) --demangle -S $< > $@

print_size :
print_size : $(OBJS_ALL)
$(info Size of modules:)
$(SIZE) -B -t --common $(OBJS_ALL)

print_elf_size : # print_size
print_elf_size : $(ELF)
$(info Size of target file:)
$(SIZE) -B $(ELF)

Expand Down
30 changes: 19 additions & 11 deletions makefile.iarcc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#**********************************************************#
#file makefile
#author Rajmund Szymanski
#date 03.12.2019
#date 16.01.2020
#brief STM32F4xx makefile.
#**********************************************************#

Expand Down Expand Up @@ -88,19 +88,15 @@ LSTS := $(OBJS:.o=.lst)

#----------------------------------------------------------#

ifneq ($(MAKECMDGOALS),qemu)
CORE_F := --cpu Cortex-M4 --fpu VFPv4_sp
else
CORE_F := --cpu Cortex-M4
endif
CORE_F := --cpu=cortex-m4.fp.sp
CORE_F += $(if $(filter qemu,$(MAKECMDGOALS)),--fpu=soft,)

COMMON_F = --thumb -O$(OPTF) -e --dependencies=m $*.d

AS_FLAGS = -S -s+ -w+
C_FLAGS = --silent
CXX_FLAGS = --silent --enable_restrict --c++ --no_rtti --no_exceptions
LD_FLAGS = --silent --config $(SCRIPT) --map $(MAP) --no_exceptions
ifneq ($(filter USE_SEMIHOST,$(DEFS)),)
LD_FLAGS += --semihosting
endif
ifneq ($(filter main_stack_size%,$(DEFS)),)
LD_FLAGS += --config_def $(filter main_stack_size%,$(DEFS))
endif
Expand All @@ -110,6 +106,18 @@ endif

#----------------------------------------------------------#

ifneq ($(strip $(CXX_SRCS)),)
DEFS += __USES_CXX
endif
ifneq ($(filter USE_SEMIHOST,$(DEFS)),)
LD_FLAGS += --semihosting
endif
ifneq ($(filter DEBUG,$(DEFS)),)
COMMON_F += --debug
endif

#----------------------------------------------------------#

DEFS_F := $(DEFS:%=-D%)
LIBS += $(LIB_SRCS:lib%.a=%)
LIBS_F := $(LIBS:%=-l%)
Expand Down Expand Up @@ -193,11 +201,11 @@ $(LSS) : $(ELF)
$(info Creating extended listing: $(LSS))
$(DUMP) --demangle -S $< > $@

print_size :
print_size : $(OBJS_ALL)
$(info Size of modules:)
$(SIZE) -B -t --common $(OBJS_ALL)

print_elf_size : # print_size
print_elf_size : $(ELF)
$(info Size of target file:)
$(SIZE) -B $(ELF)

Expand Down

0 comments on commit 61a37cf

Please sign in to comment.