# (c) Copyright 2018 by Coinkite Inc. This file is covered by license found in COPYING-CC.
#
# Build micropython for stm32 (an ARM processor). Also handles signing of resulting firmware images.
#
include version.mk

BOARD = COLDCARD
MK_NUM = 3

# These values used to make .DFU files. Flash memory locations.
FIRMWARE_BASE   = 0x08008000
BOOTLOADER_BASE = 0x08000000
FILESYSTEM_BASE = 0x080e0000

# This is release of the bootloader that will be built into the release firmware.
BOOTLOADER_VERSION = 2.0.1
BOOTLOADER_DIR = bootloader

LATEST_RELEASE = $(shell ls -t1 ../releases/*.dfu | grep -v mk4 | head -1)

include shared.mk

# This is fast for Coinkite devs, but no DFU support in the wild.
up: dev.dfu
	$(PYTHON_DO_DFU) -u dev.dfu


# In another window: 
#
#		openocd -f openocd-mk3.cfg
#
# Can do:
# - "load" which writes the flash (medium speed, lots of output on st-util)
# - "cont" starts/continues system
# - "br main" sets breakpoints
# - "mon reset" to reset micro
# - and so on
#
debug:
	arm-none-eabi-gdb $(BUILD_DIR)/firmware.elf -x gogo-mk3.gdb

# EOF
