Only call strtoul when there is an argument that strtoul can work on
[fw/stlink] / example / 32vl_factory_demo / Makefile
1 # build an elf from the an3268 demonstration code
2 APP=32vl_factory_demo
3
4 CC=arm-none-eabi-gcc
5 OBJCOPY=arm-none-eabi-objcopy
6
7 CFLAGS=-O2 -mlittle-endian -mthumb
8 CFLAGS+=-mcpu=cortex-m3 -ffreestanding -nostdlib -nostdinc
9 ifeq ($(DEBUG),1)
10         CFLAGS+=-g
11 endif
12
13 # to run from SRAM
14 CFLAGS+=-Wl,-Ttext,0x20000000 -Wl,-e,0x20000000
15
16 # to write to flash then run
17 # CFLAGS+=-Wl,-Ttext,0x08000000 -Wl,-e,0x08000000
18
19 PLATFORM=stm32f10x
20 BOARD_SUPPORT=../board_support/discovery_32vl
21 LIBS_STM_PATH=../libs_stm
22
23 CFLAGS+=-I.
24 CFLAGS+=-I$(LIBS_STM_PATH)/inc/base
25 CFLAGS+=-I$(LIBS_STM_PATH)/inc/core_support
26 CFLAGS+=-I$(LIBS_STM_PATH)/inc/device_support
27 CFLAGS+=-I$(LIBS_STM_PATH)/inc/$(PLATFORM)
28 CFLAGS+=-I$(BOARD_SUPPORT)
29
30 LDFLAGS+=-L$(LIBS_STM_PATH)/build -lstm32_stdperiph_f10x
31
32
33 SRCS=$(wildcard *.c)
34 SRCS+=$(wildcard $(BOARD_SUPPORT)/*.c)
35
36 OBJS=$(SRCS:.c=.o)
37
38 all: $(APP).elf
39
40 %.bin: %.elf
41         $(OBJCOPY) -O binary $^ $@
42
43 $(APP).elf: $(OBJS)
44         $(CC) $(CFLAGS) -o $@ $(OBJS) $(LDFLAGS)
45
46 %.o: %.c
47         $(CC) $(CFLAGS) -c -o $@ $^
48
49 clean:
50         rm -rf $(OBJS)
51         rm -rf $(APP).*
52
53 .PHONY: all clean