Abstracted Libraries folder so it can be moved

This commit is contained in:
Mike Szczys 2012-06-16 17:19:45 -05:00
parent 7664fe7a72
commit 1faceda5b3
2 changed files with 10 additions and 7 deletions

View File

@ -1,11 +1,12 @@
# put your *.o targets here, make should handle the rest! # put your *.o targets here, make should handle the rest!
SRCS = main.c system_stm32f0xx.c SRCS = main.c system_stm32f0xx.c
# all the files will be generated with this name (main.elf, main.bin, main.hex, etc) # all the files will be generated with this name (main.elf, main.bin, main.hex, etc)
PROJ_NAME=main 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') # location of OpenOCD Board .cfg files (only used with 'make program')
OPENOCD_BOARD_DIR=/usr/share/openocd/scripts/board 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 %.c src
vpath %.a Libraries vpath %.a $(STD_PERIPH_LIB)
ROOT=$(shell pwd) ROOT=$(shell pwd)
CFLAGS += -Iinc -ILibraries -ILibraries/CMSIS/Device/ST/STM32F0xx/Include CFLAGS += -Iinc -I$(STD_PERIPH_LIB) -I$(STD_PERIPH_LIB)/CMSIS/Device/ST/STM32F0xx/Include
CFLAGS += -ILibraries/CMSIS/Include -ILibraries/STM32F0xx_StdPeriph_Driver/inc 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 SRCS += Device/startup_stm32f0xx.s # add startup file to build
@ -40,12 +41,12 @@ OBJS = $(SRCS:.c=.o)
all: lib proj all: lib proj
lib: lib:
$(MAKE) -C Libraries $(MAKE) -C $(STD_PERIPH_LIB)
proj: $(PROJ_NAME).elf proj: $(PROJ_NAME).elf
$(PROJ_NAME).elf: $(SRCS) $(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 ihex $(PROJ_NAME).elf $(PROJ_NAME).hex
$(OBJCOPY) -O binary $(PROJ_NAME).elf $(PROJ_NAME).bin $(OBJCOPY) -O binary $(PROJ_NAME).elf $(PROJ_NAME).bin

View File

@ -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: * **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/ * 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/ 2. Device/
* Folder contains device specific files: * 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: * **stm32_flash.ld** is the linker script taken from the STM32F0-Discovery firmware package. It is found in the following directory: