include $(TOPDIR)/stm32f4/Makefile-stm32f4.defs

INC = \
	ao.h \
	ao_arch.h \
	ao_arch_funcs.h \
	ao_flash_pins.h \
	ao_flash_stm_pins.h \
	ao_flash_task.h \
	ao_pins.h \
	ao_product.h \
	Makefile

#
# Common AltOS sources
#
SRC = \
	ao_interrupt.c \
	ao_romconfig.c \
	ao_boot_chain.c \
	ao_boot_pin.c \
	ao_product.c \
	ao_notask.c \
	ao_timer.c \
	ao_usb_stm.c \
	ao_flash_stm.c \
	ao_flash_task.c \
	ao_flash_loader_stm.c

OBJ=$(SRC:.c=.o)

PRODUCT=AltosFlash
PRODUCT_DEF=-DALTOS_FLASH
IDPRODUCT=0x000a

CFLAGS = $(PRODUCT_DEF) $(STM32F4_CFLAGS)

LDFLAGS=$(CFLAGS) -L$(TOPDIR)/stm32f4 -Wl,-Taltos-loader.ld

PROGNAME=$(HARDWARE)-altos-flash
PROG=$(PROGNAME)-$(VERSION).elf
BIN=$(PROGNAME)-$(VERSION).bin

MAKEBIN=$(TOPDIR)/../ao-tools/ao-makebin/ao-makebin
FLASH_ADDR=0x08000000

all: $(PROG) $(BIN)

$(PROG): Makefile $(OBJ) altos-loader.ld
	$(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(OBJ) $(LIBS)

$(BIN): $(PROG)
	$(MAKEBIN) --output=$@ --base=$(FLASH_ADDR) $(PROG)
	
$(OBJ): $(INC)

distclean:	clean

clean:
	rm -f *.o $(PROGNAME)-*.elf $(PROGNAME)-*.bin $(PROGNAME)-*.map
	rm -f ao_product.h

install:

uninstall:
