##
## This file is part of the libopencm3 project.
##
## Copyright (C) 2009 Uwe Hermann <uwe@hermann-uwe.de>
##
## This library is free software: you can redistribute it and/or modify
## it under the terms of the GNU Lesser General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
## This library is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
## GNU Lesser General Public License for more details.
##
## You should have received a copy of the GNU Lesser General Public License
## along with this library.  If not, see <http://www.gnu.org/licenses/>.
##

BINARY = relay-driver

OBJS =	console.o console_stm32.o

# when building for M0
#LDSCRIPT = ./stm32f051-openblt.ld
#LIBNAME         = opencm3_stm32f0
#DEFS            += -DSTM32F0
#FP_FLAGS        ?= -msoft-float
#ARCH_FLAGS      = -mthumb -mcpu=cortex-m3 $(FP_FLAGS)

DFU_ADDRESS	= 0x08002000
LDSCRIPT	= ./lctech-f103-dfu.ld
LIBNAME         = opencm3_stm32f1
DEFS            += -DSTM32F1 -DF_CPU=72000000
FP_FLAGS        ?= -msoft-float
ARCH_FLAGS      = -mthumb -mcpu=cortex-m3 $(FP_FLAGS) -mfix-cortex-m3-ldrd

################################################################################
# OpenOCD specific variables

OOCD            ?= openocd
OOCD_INTERFACE  ?= stlink-v2
OOCD_TARGET     ?= stm32f1x

ARCH_FLAGS += --specs=/usr/lib/picolibc/arm-none-eabi/picolibc.specs

# selective libcommon parts
OBJS += watchdog.o fault.o iob_stm32_nonblocking.o kill.o #microvty.o

all: elf bin srec

include ../../mk/libcommon.mk
include ../../mk/librfn.mk
include ../../mk/librfm3.rules.mk
include ../../mk/libopencm3.mk
