From 1faceda5b3f891b2f84e44b43eda3434f7cca382 Mon Sep 17 00:00:00 2001 From: Mike Szczys Date: Sat, 16 Jun 2012 17:19:45 -0500 Subject: [PATCH] Abstracted Libraries folder so it can be moved --- Makefile | 15 ++++++++------- README.md | 2 ++ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 78613af..924a78d 100755 --- a/Makefile +++ b/Makefile @@ -1,11 +1,12 @@ # put your *.o targets here, make should handle the rest! - SRCS = main.c system_stm32f0xx.c # all the files will be generated with this name (main.elf, main.bin, main.hex, etc) - PROJ_NAME=main +# Location of the Libraries folder from the STM32F0xx Standard Peripheral Library +STD_PERIPH_LIB=Libraries + # location of OpenOCD Board .cfg files (only used with 'make program') OPENOCD_BOARD_DIR=/usr/share/openocd/scripts/board @@ -22,12 +23,12 @@ CFLAGS += -mlittle-endian -mthumb -mcpu=cortex-m0 -march=armv6s-m ################################################### vpath %.c src -vpath %.a Libraries +vpath %.a $(STD_PERIPH_LIB) ROOT=$(shell pwd) -CFLAGS += -Iinc -ILibraries -ILibraries/CMSIS/Device/ST/STM32F0xx/Include -CFLAGS += -ILibraries/CMSIS/Include -ILibraries/STM32F0xx_StdPeriph_Driver/inc +CFLAGS += -Iinc -I$(STD_PERIPH_LIB) -I$(STD_PERIPH_LIB)/CMSIS/Device/ST/STM32F0xx/Include +CFLAGS += -I$(STD_PERIPH_LIB)/CMSIS/Include -I$(STD_PERIPH_LIB)/STM32F0xx_StdPeriph_Driver/inc SRCS += Device/startup_stm32f0xx.s # add startup file to build @@ -40,12 +41,12 @@ OBJS = $(SRCS:.c=.o) all: lib proj lib: - $(MAKE) -C Libraries + $(MAKE) -C $(STD_PERIPH_LIB) proj: $(PROJ_NAME).elf $(PROJ_NAME).elf: $(SRCS) - $(CC) $(CFLAGS) $^ -o $@ -LLibraries -lstm32f0 + $(CC) $(CFLAGS) $^ -o $@ -L$(STD_PERIPH_LIB) -lstm32f0 $(OBJCOPY) -O ihex $(PROJ_NAME).elf $(PROJ_NAME).hex $(OBJCOPY) -O binary $(PROJ_NAME).elf $(PROJ_NAME).bin diff --git a/README.md b/README.md index 88780ce..d5c5722 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,8 @@ This template will serve as a quick-start for those who do not wish to use an ID * **stm32f0xx_conf.h** is used to configure the peripheral library. It must be copied here if the library is upgraded. The file was file taken from the STM32F0-Discovery firmware package. It is found in the following directory: * Project/Demonstration/ + * **Abstracting the libraries:** You may place this folder anywhere you like in order to use it for multiple projects. Just change the path of the STD_PERIPH_LIB variable in the Makefile + 2. Device/ * Folder contains device specific files: * **stm32_flash.ld** is the linker script taken from the STM32F0-Discovery firmware package. It is found in the following directory: