1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/boards/common/qn908x/Makefile.include

32 lines
1.3 KiB
Makefile

# This board uses OpenOCD. Note that support for QN908x in OpenOCD at the time
# of writing has not been merged in the tree and is only available at
# http://openocd.zylin.com/#/c/5584/ .
PROGRAMMER ?= openocd
PROGRAMMERS_SUPPORTED += openocd
# Using dap or jlink depends on which firmware the OpenSDA debugger is running
#OPENOCD_DEBUG_ADAPTER ?= dap
OPENOCD_DEBUG_ADAPTER ?= jlink
# Use the shared OpenOCD configuration
OPENOCD_CONFIG ?= $(RIOTBOARD)/common/qn908x/dist/openocd.cfg
# Disable the watchdog when flashing. OpenOCD runs a CRC program in RAM to
# verify the image, which needs to have the WDT disabled but it is normally
# enabled after a 'reset halt' command.
OPENOCD_PRE_FLASH_CMDS += "-c qn908x disable_wdog"
# In order to boot, the CPU requires that the Vector table contain a valid
# checksum in one of the "reserved" fields. We don't generate this checksum when
# compiling and linking the code, instead this make target computes the checksum
# in another ELF file and we set it as the FLASHFILE.
ELFFILE ?= $(BINDIR)/$(APPLICATION).elf
ELFFILE_CHECKSUM ?= $(ELFFILE:.elf=-checksum.elf)
$(ELFFILE_CHECKSUM): $(ELFFILE)
$(Q)$(OBJCOPY) --dump-section .vectors=$<.vectors $<
$(Q)$(RIOTBOARD)/common/qn908x/dist/nxp_checksum.py $(if $(Q),--quiet) \
$<.vectors
$(Q)$(OBJCOPY) --update-section .vectors=$<.vectors $< $@
FLASHFILE ?= $(ELFFILE_CHECKSUM)