Abstracted Libraries folder so it can be moved

master
Mike Szczys 10 years ago
parent 7664fe7a72
commit 1faceda5b3
  1. 15
      Makefile
  2. 2
      README.md

@ -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

@ -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:

Loading…
Cancel
Save