kopia lustrzana https://github.com/stlink-org/stlink
Restructure libs source to support multi platform
The "libstm32l_discovery" was actually the ST std periph library, plus the CMSIS core files. Renamed it as such, and restructured the directories and naming to make this easier to contain the std periph drivers for more than just one board. Verified with the LCD demo makefile, and loading it in sram again.pull/29/head
rodzic
77f2d8b76c
commit
29cf5d590c
|
@ -7,11 +7,20 @@ CFLAGS+=-mcpu=cortex-m3 -ffreestanding -nostdlib -nostdinc
|
|||
|
||||
CFLAGS+=-I.
|
||||
|
||||
# stm32l_discovery lib
|
||||
CFLAGS+=-I../libstm32l_discovery/inc
|
||||
CFLAGS+=-I../libstm32l_discovery/inc/base
|
||||
CFLAGS+=-I../libstm32l_discovery/inc/core_support
|
||||
CFLAGS+=-I../libstm32l_discovery/inc/device_support
|
||||
|
||||
PLATFORM=stm32l1xx
|
||||
LIBS_STM_PATH=../libs_stm
|
||||
|
||||
INC_CORE_SUPPORT=$(LIBS_STM_PATH)/inc/core_support
|
||||
SRC_CORE_SUPPORT=$(LIBS_STM_PATH)/inc/core_support
|
||||
INC_DEVICE_SUPPORT=$(LIBS_STM_PATH)/inc/device_support
|
||||
INC_PLATFORM=$(LIBS_STM_PATH)/inc/$(PLATFORM)
|
||||
|
||||
CFLAGS+=-I$(INC_CORE_SUPPORT)
|
||||
CFLAGS+=-I$(INC_DEVICE_SUPPORT)
|
||||
CFLAGS+=-I$(INC_PLATFORM)
|
||||
CFLAGS+=-I$(LIBS_STM_PATH)/inc/base
|
||||
|
||||
|
||||
# to run from SRAM
|
||||
CFLAGS+=-Wl,-T,linker_stm32l.lds
|
||||
|
@ -25,7 +34,7 @@ OBJS=$(SRCS:.c=.o)
|
|||
all: $(ELF)
|
||||
|
||||
$(ELF): $(OBJS)
|
||||
$(CC) $(CFLAGS) -o $@ $(OBJS) -L../libstm32l_discovery/build -lstm32l_discovery
|
||||
$(CC) $(CFLAGS) -o $@ $(OBJS) -L$(LIBS_STM_PATH)/build -lstm32l_discovery
|
||||
|
||||
%.o: %.c
|
||||
$(CC) $(CFLAGS) -c -o $@ $^
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
LIB = libstm32l_discovery.a
|
||||
|
||||
CC = arm-none-eabi-gcc
|
||||
AR = arm-none-eabi-ar
|
||||
RANLIB = arm-none-eabi-ranlib
|
||||
|
||||
PLATFORM=stm32l1xx
|
||||
|
||||
INC_CORE_SUPPORT=../inc/core_support
|
||||
SRC_CORE_SUPPORT=../inc/core_support
|
||||
INC_DEVICE_SUPPORT=../inc/device_support
|
||||
INC_PLATFORM=../inc/$(PLATFORM)
|
||||
SRC_PLATFORM=../src/$(PLATFORM)
|
||||
|
||||
CFLAGS = -Wall -O2 -mlittle-endian -mthumb
|
||||
CFLAGS += -mcpu=cortex-m3 -ffreestanding -nostdlib -nostdinc
|
||||
CFLAGS += -I$(INC_PLATFORM) -I$(INC_DEVICE_SUPPORT) -I$(INC_CORE_SUPPORT) -I../inc/base
|
||||
|
||||
SRCS=$(wildcard $(SRC_PLATFORM)/*.c)
|
||||
SRCS+=$(SRC_CORE_SUPPORT)/core_cm3.c
|
||||
|
||||
OBJS = $(SRCS:.c=.o)
|
||||
|
||||
all: $(LIB)
|
||||
|
||||
$(LIB): $(OBJS)
|
||||
$(AR) -r $(LIB) $(OBJS)
|
||||
$(RANLIB) $(LIB)
|
||||
|
||||
%.o : %.c
|
||||
$(CC) $(CFLAGS) -c -o $@ $^
|
||||
|
||||
clean:
|
||||
-rm -f $(OBJS)
|
||||
-rm -f $(LIB)
|
||||
|
||||
.PHONY: all clean
|
|
@ -1,51 +0,0 @@
|
|||
LIB = libstm32l_discovery.a
|
||||
|
||||
CC = arm-none-eabi-gcc
|
||||
AR = arm-none-eabi-ar
|
||||
RANLIB = arm-none-eabi-ranlib
|
||||
|
||||
CFLAGS = -Wall -O2 -mlittle-endian -mthumb
|
||||
CFLAGS += -mcpu=cortex-m3 -ffreestanding -nostdlib -nostdinc
|
||||
CFLAGS += -I../inc -I../inc/device_support -I../inc/core_support -I../inc/base
|
||||
|
||||
SRCS = \
|
||||
../src/misc.c \
|
||||
../src/stm32l1xx_adc.c \
|
||||
../src/stm32l1xx_comp.c \
|
||||
../src/stm32l1xx_crc.c \
|
||||
../src/stm32l1xx_dac.c \
|
||||
../src/stm32l1xx_dbgmcu.c \
|
||||
../src/stm32l1xx_dma.c \
|
||||
../src/stm32l1xx_exti.c \
|
||||
../src/stm32l1xx_flash.c \
|
||||
../src/stm32l1xx_flash_ramfunc.c \
|
||||
../src/stm32l1xx_gpio.c \
|
||||
../src/stm32l1xx_i2c.c \
|
||||
../src/stm32l1xx_iwdg.c \
|
||||
../src/stm32l1xx_lcd.c \
|
||||
../src/stm32l1xx_pwr.c \
|
||||
../src/stm32l1xx_rcc.c \
|
||||
../src/stm32l1xx_rtc.c \
|
||||
../src/stm32l1xx_spi.c \
|
||||
../src/stm32l1xx_syscfg.c \
|
||||
../src/stm32l1xx_tim.c \
|
||||
../src/stm32l1xx_usart.c \
|
||||
../src/stm32l1xx_wwdg.c \
|
||||
../inc/core_support/core_cm3.c
|
||||
|
||||
OBJS = $(SRCS:.c=.o)
|
||||
|
||||
all: $(LIB)
|
||||
|
||||
$(LIB): $(OBJS)
|
||||
$(AR) -r $(LIB) $(OBJS)
|
||||
$(RANLIB) $(LIB)
|
||||
|
||||
%.o : %.c
|
||||
$(CC) $(CFLAGS) -c -o $@ $^
|
||||
|
||||
clean:
|
||||
-rm -f $(OBJS)
|
||||
-rm -f $(LIB)
|
||||
|
||||
.PHONY: all clean
|
Ładowanie…
Reference in New Issue