Преглед изворни кода

[FL-1241] Build optimization (#459)

* Makefile: enable space optimization with debug, cleanup double includes, explicitly define cpp runtime options
* Toolchain: add printf support
* Toolchain: explicit standard declaration
あく пре 4 година
родитељ
комит
3671c68b79
3 измењених фајлова са 10 додато и 9 уклоњено
  1. 0 1
      bootloader/Makefile
  2. 0 1
      firmware/Makefile
  3. 10 7
      make/toolchain.mk

+ 0 - 1
bootloader/Makefile

@@ -2,7 +2,6 @@ PROJECT_ROOT	= $(abspath $(dir $(abspath $(firstword $(MAKEFILE_LIST))))..)
 PROJECT			= bootloader
 
 include 		$(PROJECT_ROOT)/make/base.mk
-include			$(PROJECT_ROOT)/make/git.mk
 
 CFLAGS			+= -Itargets/include
 ASM_SOURCES		+= $(wildcard src/*.s)

+ 0 - 1
firmware/Makefile

@@ -4,7 +4,6 @@ PROJECT			= firmware
 include 		$(PROJECT_ROOT)/make/base.mk
 include			$(PROJECT_ROOT)/assets/assets.mk
 include			$(PROJECT_ROOT)/core/core.mk
-include			$(PROJECT_ROOT)/make/git.mk
 include 		$(PROJECT_ROOT)/applications/applications.mk
 include			$(PROJECT_ROOT)/lib/lib.mk
 

+ 10 - 7
make/toolchain.mk

@@ -6,8 +6,8 @@ PREFIX = $(GCC_PATH)/$(PREFIX)
 endif
 endif
 
-CC	= $(PREFIX)gcc
-CPP	= $(PREFIX)g++
+CC	= $(PREFIX)gcc -std=gnu17
+CPP	= $(PREFIX)g++ -std=gnu++17
 LD	= $(PREFIX)g++
 AS	= $(PREFIX)gcc -x assembler-with-cpp
 CP	= $(PREFIX)objcopy
@@ -16,12 +16,15 @@ HEX	= $(CP) -O ihex
 BIN	= $(CP) -O binary -S
 
 DEBUG ?= 1
+COMPACT ?= 0
 ifeq ($(DEBUG), 1)
-CFLAGS += -DDEBUG -g
+CFLAGS += -DDEBUG -Og -g
+else ifeq ($(COMPACT), 1)
+CFLAGS += -DNDEBUG -DLFS_NO_ASSERT -Os
 else
-CFLAGS += -DNDEBUG -Os
+CFLAGS += -DNDEBUG -DLFS_NO_ASSERT -Og
 endif
 
-CFLAGS		+= -MMD -MP -MF"$(@:%.o=%.d)"
-CPPFLAGS	+= -fno-threadsafe-statics
-LDFLAGS		+= -Wl,-Map=$(OBJ_DIR)/$(PROJECT).map,--cref -Wl,--gc-sections -Wl,--undefined=uxTopUsedPriority
+CFLAGS		+= -fdata-sections -ffunction-sections -fno-math-errno -fstack-usage -MMD -MP -MF"$(@:%.o=%.d)"
+CPPFLAGS	+= -fno-threadsafe-statics -fno-use-cxa-atexit -fno-exceptions -fno-rtti
+LDFLAGS		+= -Wl,-Map=$(OBJ_DIR)/$(PROJECT).map,--cref -Wl,--gc-sections -Wl,--undefined=uxTopUsedPriority -u _printf_float