Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Full clang build for standard apps #793

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 1 addition & 14 deletions Makefile.defines
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,6 @@ else
CFLAGS += --sysroot="$(SYSROOT)"
endif

# optimization and debug levels
ifneq ($(DEBUG),0)
OPTI_LVL = -Og
OPTI_ALVL = $(OPTI_LVL)
DBG_LVL = -g3
else
OPTI_LVL = -Oz
OPTI_ALVL = -Os # assembler does not handle -Oz, use -Os instead
DBG_LVL = -g0
endif

CFLAGS += $(OPTI_LVL) $(DBG_LVL)
CFLAGS += -fomit-frame-pointer -momit-leaf-frame-pointer

CFLAGS += -fno-common -mlittle-endian
Expand All @@ -91,9 +79,8 @@ CFLAGS += -fropi
CFLAGS += -fno-jump-tables # avoid jump tables for switch to avoid problems with invalid PIC access
CFLAGS += -nostdlib -nodefaultlibs

AFLAGS += $(OPTI_ALVL) $(DBG_LVL) -fno-common
AFLAGS += -fno-common

LDFLAGS += $(OPTI_LVL) $(DBG_LVL)
LDFLAGS += -fomit-frame-pointer
LDFLAGS += -Wall
LDFLAGS += -fno-common -ffunction-sections -fdata-sections -fwhole-program
Expand Down
21 changes: 21 additions & 0 deletions Makefile.rules
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,25 @@ OBJECTS_DIR += $(sort $(dir $(OBJECT_FILES)))
DEPEND_FILES = $(subst $(OBJ_DIR), $(DEP_DIR), $(addsuffix .d, $(basename $(OBJECT_FILES))))
DEPEND_DIR += $(sort $(dir $(DEPEND_FILES)))

# optimization and debug levels
# this should be in Makefile.defines, but $(AS) is not yet defined at that point
ifneq ($(DEBUG),0)
OPTI_LVL = -Og
OPTI_ALVL = $(OPTI_LVL)
DBG_LVL = -g3
else
OPTI_LVL = -Oz
ifeq ($(AS),$(CLANGPATH)clang)
OPTI_ALVL = $(OPTI_LVL)
else
# GCC assembler does not handle -Oz
OPTI_ALVL = -Os
endif
DBG_LVL = -g0
endif
# at the beginning so they can be overridden by apps
CFLAGS := $(OPTI_LVL) $(DBG_LVL) $(CFLAGS)
AFLAGS := $(OPTI_ALVL) $(DBG_LVL) $(AFLAGS)
LDFLAGS := $(OPTI_LVL) $(DBG_LVL) $(LDFLAGS)

include $(BOLOS_SDK)/Makefile.rules_generic
7 changes: 5 additions & 2 deletions Makefile.standard_app
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,11 @@ APP_FLAGS_APP_LOAD_PARAMS = $(shell printf '0x%x' $$(( $(STANDARD_APP_FLAGS) + $
# COMPILER SETTINGS #
#####################################################################
CC := $(CLANGPATH)clang
AS := $(GCCPATH)arm-none-eabi-gcc
LD := $(GCCPATH)arm-none-eabi-gcc
AS := $(CLANGPATH)clang
LD := $(CLANGPATH)clang
ifeq ($(AS),$(CLANGPATH)clang)
AFLAGS += --target=arm-arm-none-eabi -Wno-unused-command-line-argument
endif
LDLIBS += -lm -lgcc -lc

#####################################################################
Expand Down
Loading