Building On STM32F0
Here's our toolchain:
CC := $(GCC_ARM_BASE)arm-none-eabi-gcc
LD := $(GCC_ARM_BASE)arm-none-eabi-gcc
OBJCPY := $(GCC_ARM_BASE)arm-none-eabi-objcopy
OBJDUMP := $(GCC_ARM_BASE)arm-none-eabi-objdump
SIZE := $(GCC_ARM_BASE)arm-none-eabi-size
AR := $(GCC_ARM_BASE)arm-none-eabi-gcc-ar
GDB := $(GCC_ARM_BASE)arm-none-eabi-gdb
First we include all the libs, and projects:
$(foreach lib,$(VALID_LIBRARIES),$(call include_lib,$(lib)))
include_lib is defined as:
# $(call include_lib,libname) define include_lib $(eval TARGET := $(1)); $(eval TARGET_TYPE := LIB); $(eval include $(MAKE_DIR)/build.mk); $(eval undefine TARGET; undefine TARGET_TYPE) endef
We make the binary here:
178 $(BIN_DIR)/%.bin: $(BIN_DIR)/%$(PLATFORM_EXT) 179 @$(OBJCPY) -O binary $< $(<:$(PLATFORM_EXT)=.bin)
We make application target here:
# Application target $(BIN_DIR)/$(T)$(PLATFORM_EXT): $($(T)_OBJ) $(call dep_to_lib,$($(T)_DEPS)) | $(T) $(BIN_DIR) @echo "Building $(notdir $@) for $(PLATFORM)" @$(CC) $($(firstword $|)_CFLAGS) -Wl,-Map=$(BIN_DIR)/$(notdir $(@:%$(PLATFORM_EXT)=%.map)) $^ -o $@ \ -L$(STATIC_LIB_DIR) $(addprefix -l,$($(firstword $|)_DEPS)) \ $(LDFLAGS) $(addprefix -I,$($(firstword $|)_INC_DIRS)) @$(OBJDUMP) -St $@ >$(basename $@).lst @$(SIZE) $@
So this is what's happening:
- we call cc with -o, and we link all the libraries, then we call objdump