Added JLink flash scripts

This commit is contained in:
Kristian Sloth Lauszus
2018-05-02 10:37:27 +02:00
parent 0c4c736552
commit 66252eabf0
5 changed files with 39 additions and 2 deletions

View File

@@ -31,6 +31,9 @@ FPU = -mfloat-abi=soft
# Command for flashing the left half of the keyboard. # Command for flashing the left half of the keyboard.
FLASH_CMD = node ../lib/agent/packages/usb/update-module-firmware.js leftHalf $(PROJECT_OBJ:.axf=.bin) FLASH_CMD = node ../lib/agent/packages/usb/update-module-firmware.js leftHalf $(PROJECT_OBJ:.axf=.bin)
# Path to the JLink script used for the left half.
JLINK_SCRIPT = ../scripts/flash-left.jlink
# Source files. # Source files.
SOURCE = $(wildcard src/*.c) \ SOURCE = $(wildcard src/*.c) \
../lib/KSDK_2.0_MKL03Z8xxx4/devices/MKL03Z4/system_MKL03Z4.c \ ../lib/KSDK_2.0_MKL03Z8xxx4/devices/MKL03Z4/system_MKL03Z4.c \

View File

@@ -31,6 +31,9 @@ FPU = -mfpu=fpv4-sp-d16 -mfloat-abi=hard
# Command for flashing the right half of the keyboard. # Command for flashing the right half of the keyboard.
FLASH_CMD = node ../lib/agent/packages/usb/update-device-firmware.js $(PROJECT_OBJ:.axf=.hex) FLASH_CMD = node ../lib/agent/packages/usb/update-device-firmware.js $(PROJECT_OBJ:.axf=.hex)
# Path to the JLink script used for the right half.
JLINK_SCRIPT = ../scripts/flash-right.jlink
# Preprocessor directives. # Preprocessor directives.
BUILD_FLAGS = -DCPU_$(PART)_cm4 -DUSB_STACK_BM -DBL_HAS_BOOTLOADER_CONFIG=1 BUILD_FLAGS = -DCPU_$(PART)_cm4 -DUSB_STACK_BM -DBL_HAS_BOOTLOADER_CONFIG=1

View File

@@ -29,10 +29,24 @@ PROJECT_OBJ = $(BUILD_DIR)/$(PROJECT_NAME).axf
# Set the prefix for the tools to use. # Set the prefix for the tools to use.
PREFIX ?= arm-none-eabi PREFIX ?= arm-none-eabi
# Set WIN=1 manually for Windows Subsystem for Linux.
WIN ?= 0
# Determine if we are on a Windows machine and set the .exe suffix. # Determine if we are on a Windows machine and set the .exe suffix.
# We can not use the suffix command, as the PREFIX might contain spaces.
UNAME_S := $(shell uname -s) UNAME_S := $(shell uname -s)
ifeq ($(OS),Windows_NT) # Native Windows. ifeq ($(OS),Windows_NT) # Native Windows.
WIN = 1
endif
# Set J-Link executable.
ifeq ($(WIN),1)
JLINK := JLink.exe
else
JLINK := JLinkExe
endif
# We can not use the suffix command, as the PREFIX might contain spaces.
ifeq ($(WIN),1)
SUFFIX := .exe SUFFIX := .exe
endif endif
@@ -148,7 +162,7 @@ ifeq ($(INTERACTIVE),1)
color_purple = \033[38;5;097m color_purple = \033[38;5;097m
endif endif
.PHONY: all clean flash .PHONY: all clean flash flash-jlink
# The default rule, which causes the project to be built. # The default rule, which causes the project to be built.
all: $(PROJECT_OBJ) all: $(PROJECT_OBJ)
@@ -161,6 +175,9 @@ clean:
flash: all flash: all
@$(FLASH_CMD) || exit 1 @$(FLASH_CMD) || exit 1
flash-jlink: all
$(JLINK) -if SWD -CommandFile $(JLINK_SCRIPT) || exit 1
# Rebuild all objects when the Makefiles change. # Rebuild all objects when the Makefiles change.
$(OBJS): $(MAKEFILE_LIST) $(OBJS): $(MAKEFILE_LIST)

7
scripts/flash-left.jlink Normal file
View File

@@ -0,0 +1,7 @@
speed 4000
device MKL03Z32xxx4
connect
loadfile build_make/uhk_left.hex
RSetType 2
r
qc

View File

@@ -0,0 +1,7 @@
speed 4000
device MK22FN512xxx12
connect
loadfile build_make/uhk_right.hex
RSetType 2
r
qc