Build system builds the peripheral library proprly now.

This commit is contained in:
Solomon Peachy 2013-08-03 14:11:44 -04:00
parent 91d3726b46
commit b39a79582c
6 changed files with 22 additions and 31 deletions

1
.gitignore vendored
View File

@ -9,6 +9,7 @@
*.o
*.elf
*.bin
*.ld
# Autogenerated files
inc/version.h

View File

@ -22,9 +22,9 @@ LIBS_OBJS = $(MCU_LIBS_OBJS)
PROGRAM_LIBS = src/core.a
# Generic compilation rules
XXXX.ld: libs/$(MCU).ld.in inc/hw.h
XXXX.ld: libs/$(MCU).ld.in inc/hw.h $(LIBRARIES)
@$(E) " GENERATE " $@
$(Q)$(CPP) $(TARGET_LDCPPFLAGS) $(MCU).ld.in -P -o $@
$(Q)$(CPP) $(TARGET_LDCPPFLAGS) -I$(TOP) libs/$(MCU).ld.in -P -o $@
%.bin: %.elf
@$(E) " OBJCOPY " $@
@ -50,11 +50,10 @@ distclean: clean
${RM} -f $(DEPFILE) $(VERSION_H)
${RM} -f $(LIBS_OBJS) $(LIBRARIES)
${RM} -Rf $(TOOLCHAIN_SRC_DIR)/.build
if [ -r ${TOOLCHAIN_SRC_DIR}/Makefile ] ; then \
@if [ -r ${TOOLCHAIN_SRC_DIR}/Makefile ] ; then \
cd ${TOOLCHAIN_SRC_DIR} ; \
make uninstall ; \
make clean ; \
make distclean ; \
MAKELEVEL='' make clean ; \
MAKELEVEL='' make distclean ; \
fi
${RM} -f .toolchain
${RM} -f tags TAGS

View File

@ -26,8 +26,8 @@ JLEVEL:=${shell cat /proc/cpuinfo |grep processor |wc -l}
LIBDIR=$(TOP)/libs
# Compiler flags
CFLAGS += -pipe -Wall -Wextra -g -Os -flto -fuse-linker-plugin -fwhole-program -std=c99 $(TARGET_CFLAGS)
CPPFLAGS += $(MCU_CFLAGS) $(MCU_INCLUDE) $(TARGET_CPPFLAGS) $(INCLUDE)
CFLAGS += -pipe -Wall -Wextra -g -Os -flto -fuse-linker-plugin -fwhole-program -std=c99 $(MCU_CFLAGS) $(TARGET_CFLAGS)
CPPFLAGS += $(MCU_INCLUDE) $(INCLUDE) $(MCU_CPPFLAGS) $(TARGET_CPPFLAGS)
# Linker Flags
LDFLAGS += -fno-exceptions -ffunction-sections -fdata-sections -nostartfiles # -fuse-linker-plugin

View File

@ -1,7 +1,8 @@
# Add build-specific stuff here:
MCU=stm32f10x
MCU_SUBTYPE=stm32f10x_ld ### _ld, _ld_vl, _md, _md_vl, _hd, _hd_vl, _xl, _cl
MCU_SUBTYPE=stm32f10x_ld
### _ld, _ld_vl, _md, _md_vl, _hd, _hd_vl, _xl, _cl
TARGET_LDCPPFLAGS = -DMCU=$(MCU) -DFLASH=_FLASH_0
#TARGET_CPPFLAGS = -DVECT_TAB_SRAM

View File

@ -1,14 +0,0 @@
# Generated file, do not edit
# Default values as found by ./configure
config CONFIGURE_has_xz
def_bool y
config CONFIGURE_has_lzma
bool
config CONFIGURE_has_cvs
def_bool y
config CONFIGURE_has_svn
bool

View File

@ -4,14 +4,18 @@ MCU_CORE=cm3
MCU_INCLUDE += -I$(LIBDIR)/CMSIS/Include
MCU_INCLUDE += -I$(LIBDIR)/CMSIS/Device/ST/STM32F10x/Include
MCU_INCLUDE += -I$(LIBDIR)/STM32F10x_StdPeriph_Driver/inc
# Set up CFLAGS
MCU_CPPFLAGS += -D$(call uc,$MCU_SUBTYPE)
#MCU_CPPFLAGS += -D$(call uc,$(MCU_SUBTYPE))
MCU_CPPFLAGS += -D$(shell echo -n $(MCU_SUBTYPE) | tr a-z A-Z )
MCU_CPPFLAGS += -D"assert_param(expr)=((void)0)"
MCU_CFLAGS += -mcpu=cortex-m3 -mthumb -Wa,-mthumb
# Target Libraries
MCU_LIBS += $(LIBDIR)/libstm32f10x.a
# CMSIS
STM32F10x_OBJS = $(LIBDIR)/$(MCU_SUBTYPE)_startup.o $(LIBDIR)/CMSIS/Device/ST/STM32F10x/Source/Templates/system_stm32f10x.o
STM32F10x_OBJS = $(LIBDIR)/CMSIS/Device/ST/STM32F10x/Source/Templates/system_stm32f10x.o
# Standard Peripheral Library
STM32F10x_OBJSR = misc.o stm32f10x_dac.o stm32f10x_gpio.o stm32f10x_sdio.o \
stm32f10x_adc.o stm32f10x_dbgmcu.o stm32f10x_i2c.o stm32f10x_spi.o \
@ -20,17 +24,17 @@ STM32F10x_OBJSR = misc.o stm32f10x_dac.o stm32f10x_gpio.o stm32f10x_sdio.o \
stm32f10x_cec.o stm32f10x_flash.o stm32f10x_rcc.o stm32f10x_wwdg.o \
stm32f10x_crc.o stm32f10x_fsmc.o stm32f10x_rtc.o
STM32F10x_OBJS += $(addprefix $(LIBDIR)/STM32F10x_StdPeriph_Driver/src,$(STM32F10x_OBJSR))
STM32F10x_OBJS += $(addprefix $(LIBDIR)/STM32F10x_StdPeriph_Driver/src/,$(STM32F10x_OBJSR))
# Bookkeeping
MCU_LIBS_OBJS += $(STM32F10x_OBJS)
# Build Rules
$(LIBDIR)/$(MCU_SUBTYPE)_startup.o: $(LIBDIR)/CMSIS/Device/ST/STM32F10x/Source/Templates/gcc_ride7/startup_$(MCU_SUBTYPE).s
@$(E) " AR " $@
$(Q)$(AS) -o $@ $<
$(LIBDIR)/startup_$(MCU_SUBTYPE).o: $(LIBDIR)/CMSIS/Device/ST/STM32F10x/Source/Templates/gcc_ride7/startup_$(MCU_SUBTYPE).s
@$(E) " AS " $@
$(Q)$(AS) -c -o $@ $<
$(LIBDIR)/libstm32f10x.a: $(STM32F10x_OBJS)
$(LIBDIR)/libstm32f10x.a: $(STM32F10x_OBJS) $(LIBDIR)/startup_$(MCU_SUBTYPE).o
@$(E) " AR " $@
$(Q)$(AR) cr $@ $(STM32F10x_OBJS)
$(Q)$(AR) cr $@ $(STM32F10x_OBJS) $(LIBDIR)/startup_$(MCU_SUBTYPE).o