summaryrefslogtreecommitdiff
path: root/tool/mbed/gcc.mk
diff options
context:
space:
mode:
Diffstat (limited to 'tool/mbed/gcc.mk')
-rw-r--r--tool/mbed/gcc.mk37
1 files changed, 23 insertions, 14 deletions
diff --git a/tool/mbed/gcc.mk b/tool/mbed/gcc.mk
index 032f7c6cae..b8c7336b45 100644
--- a/tool/mbed/gcc.mk
+++ b/tool/mbed/gcc.mk
@@ -1,4 +1,6 @@
-###############################################################################
+# based on Makefile exported form mbed.org
+# see http://mbed.org/handbook/Exporting-to-GCC-ARM-Embedded
+
GCC_BIN =
AS = $(GCC_BIN)arm-none-eabi-as
CC = $(GCC_BIN)arm-none-eabi-gcc
@@ -9,13 +11,21 @@ OBJDUMP = $(GCC_BIN)arm-none-eabi-objdump
SIZE = $(GCC_BIN)arm-none-eabi-size
CHKSUM = $(TMK_DIR)/tool/mbed/lpc-vector-checksum
-CPU = -mcpu=cortex-m0 -mthumb
-
-CC_FLAGS += $(CPU) -c -g -fno-common -fmessage-length=0 -Wall -fno-exceptions -ffunction-sections -fdata-sections
+CC_FLAGS += \
+ $(CPU) \
+ -c \
+ -g \
+ -fno-common \
+ -fmessage-length=0 \
+ -Wall \
+ -fno-exceptions \
+ -ffunction-sections \
+ -fdata-sections \
+ -fomit-frame-pointer
CC_FLAGS += -MMD -MP
-CC_SYMBOLS = -DTARGET_LPC11U35_401 -DTARGET_M0 -DTARGET_NXP -DTARGET_LPC11UXX -DTOOLCHAIN_GCC_ARM -DTOOLCHAIN_GCC -D__CORTEX_M0 -DARM_MATH_CM0 -DMBED_BUILD_TIMESTAMP=1399108688.49 -D__MBED__=1
-LD_FLAGS = -mcpu=cortex-m0 -mthumb -Wl,--gc-sections --specs=nano.specs
+LD_FLAGS = $(CPU) -Wl,--gc-sections --specs=nano.specs
+#LD_FLAGS += -u _printf_float -u _scanf_float
LD_FLAGS += -Wl,-Map=$(OBJDIR)/$(PROJECT).map,--cref
LD_SYS_LIBS = -lstdc++ -lsupc++ -lm -lc -lgcc -lnosys
@@ -25,7 +35,7 @@ else
CC_FLAGS += -DNDEBUG -Os
endif
-all: $(OBJDIR)/$(PROJECT).bin $(OBJDIR)/$(PROJECT).hex size
+all: $(OBJDIR)/$(PROJECT).bin $(OBJDIR)/$(PROJECT).hex
clean:
rm -f $(OBJDIR)/$(PROJECT).bin $(OBJDIR)/$(PROJECT).elf $(OBJDIR)/$(PROJECT).hex $(OBJDIR)/$(PROJECT).map $(OBJDIR)/$(PROJECT).lst $(OBJECTS) $(DEPS)
@@ -41,22 +51,21 @@ $(OBJDIR)/%.o: %.c
$(OBJDIR)/%.o: %.cpp
mkdir -p $(@D)
- $(CPP) $(CC_FLAGS) $(CC_SYMBOLS) -std=gnu++98 $(INCLUDE_PATHS) -o $@ $<
+ $(CPP) $(CC_FLAGS) $(CC_SYMBOLS) -std=gnu++98 -fno-rtti $(INCLUDE_PATHS) -o $@ $<
$(OBJDIR)/$(PROJECT).elf: $(OBJECTS) $(SYS_OBJECTS)
$(LD) $(LD_FLAGS) -T$(LINKER_SCRIPT) $(LIBRARY_PATHS) -o $@ $^ $(LIBRARIES) $(LD_SYS_LIBS) $(LIBRARIES) $(LD_SYS_LIBS)
- @echo ""
- @echo "*****"
- @echo "***** You must modify vector checksum value in *.bin and *.hex files."
- @echo "*****"
- @echo ""
+ $(SIZE) $@
$(OBJDIR)/$(PROJECT).bin: $(OBJDIR)/$(PROJECT).elf
@$(OBJCOPY) -O binary $< $@
- @echo "Writing vector checksum value into $@ ..."
+ifneq (,$(findstring TARGET_NXP,$(CC_SYMBOLS)))
+ @echo
+ @echo "For NXP writing vector checksum value into $@ ..."
@$(CHKSUM) $@
@echo
+endif
$(OBJDIR)/$(PROJECT).hex: $(OBJDIR)/$(PROJECT).elf
@$(OBJCOPY) -O ihex $< $@