2014-11-28 10:02:16 +00:00
|
|
|
# ----------------------------------------------------------------------------
|
|
|
|
# ATMEL Microcontroller Software Support
|
|
|
|
# ----------------------------------------------------------------------------
|
|
|
|
# Copyright (c) 2010, Atmel Corporation
|
|
|
|
#
|
|
|
|
# All rights reserved.
|
|
|
|
#
|
|
|
|
# Redistribution and use in source and binary forms, with or without
|
|
|
|
# modification, are permitted provided that the following conditions are met:
|
|
|
|
#
|
|
|
|
# - Redistributions of source code must retain the above copyright notice,
|
|
|
|
# this list of conditions and the disclaimer below.
|
|
|
|
#
|
|
|
|
# Atmel's name may not be used to endorse or promote products derived from
|
|
|
|
# this software without specific prior written permission.
|
|
|
|
#
|
|
|
|
# DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
|
|
|
|
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
|
|
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
|
|
|
|
# DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
|
|
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
|
|
|
# OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
|
|
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
|
|
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
|
|
|
# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
# ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
# Makefile for compiling the Getting Started with SAM3S Microcontrollers project
|
|
|
|
|
2021-03-05 10:32:45 +00:00
|
|
|
GIT_VERSION=$(shell $(TOP)/git-version-gen $(TOP)/.tarball-version)
|
2014-11-28 10:02:16 +00:00
|
|
|
#-------------------------------------------------------------------------------
|
|
|
|
# User-modifiable options
|
|
|
|
#-------------------------------------------------------------------------------
|
|
|
|
|
2020-04-03 16:28:31 +00:00
|
|
|
# verbosity
|
|
|
|
V ?= 0
|
|
|
|
ifneq ("$(V)","0")
|
|
|
|
SILENT :=
|
|
|
|
else
|
|
|
|
SILENT := @
|
|
|
|
endif
|
|
|
|
|
2014-11-28 10:02:16 +00:00
|
|
|
# Chip & board used for compilation
|
|
|
|
# (can be overriden by adding CHIP=chip and BOARD=board to the command-line)
|
2017-02-27 19:31:09 +00:00
|
|
|
CHIP ?= sam3s4
|
|
|
|
BOARD ?= qmod
|
2019-12-06 19:07:06 +00:00
|
|
|
APP ?= dfu
|
2014-11-28 10:02:16 +00:00
|
|
|
|
|
|
|
# Defines which are the available memory targets for the SAM3S-EK board.
|
2019-12-06 19:07:06 +00:00
|
|
|
ifeq ($(APP), dfu)
|
DFU: add DFU application
this adds the DFU as application, allowing to flash the bootloader.
a USB DFU alternative is added to flash the bootloader partition.
when the DFU is started as bootloader, the partition/alternative
to flash the bootloader is marked as "not available", and
ineffective.
the same happens for the application partition when DFU is started
as application.
this distinction is make at compile time, not at runtime, because
of size restrictions (the bootloader was already close to the
16 kB limit).
*_dfu_flash.bin should not be mixed with *_dfu_dfu.bin.
*_dfu_dfu.bin should be flashed as application using the already
existing DFU bootloader.
once this images is started (as application), the *_dfu_flash.bin
should be flashed as bootloader using the DFU application.
once the DFU bootloader has been flashed, soft resetting
(not re-powering) will cause the bootloader to start, allowing to
flash the application with a normal image (e.g. not DFU),
replacing the DFU application.
this switch to DFU only happens after downloading (e.g. flashing).
it is planned to have the DFU application erase itself after
flashing, but this is currently not implemented.
Change-Id: Ic273bb593a7669111b0219fe301d7897419167c8
2019-12-11 16:04:21 +00:00
|
|
|
MEMORIES ?= flash dfu
|
2021-09-26 15:24:49 +00:00
|
|
|
TRACE_LEVEL ?= 0
|
2019-12-06 19:07:06 +00:00
|
|
|
else
|
|
|
|
MEMORIES ?= dfu
|
|
|
|
endif
|
2014-11-28 10:02:16 +00:00
|
|
|
|
2019-08-01 15:17:18 +00:00
|
|
|
# Output directories and filename
|
|
|
|
OUTPUT = $(BOARD)-$(APP)
|
2014-11-28 10:02:16 +00:00
|
|
|
BIN = bin
|
2017-02-27 19:31:09 +00:00
|
|
|
OBJ = obj/$(BOARD)
|
2014-11-28 10:02:16 +00:00
|
|
|
|
|
|
|
#-------------------------------------------------------------------------------
|
|
|
|
# Tools
|
|
|
|
#-------------------------------------------------------------------------------
|
|
|
|
|
2017-02-27 12:53:17 +00:00
|
|
|
AT91LIB = ./atmel_softpack_libraries
|
|
|
|
|
|
|
|
AT91LIB_USB_COMMON_CORE_PATH = $(AT91LIB)/usb/common/core
|
|
|
|
AT91LIB_USB_CORE_PATH = $(AT91LIB)/usb/device/core
|
|
|
|
AT91LIB_USB_DFU_PATH = $(AT91LIB)/usb/device/dfu
|
2015-01-03 21:22:36 +00:00
|
|
|
|
2014-11-28 10:02:16 +00:00
|
|
|
# Tool suffix when cross-compiling
|
|
|
|
CROSS_COMPILE = arm-none-eabi-
|
|
|
|
|
2021-10-20 14:42:36 +00:00
|
|
|
USE_CLANG ?= 0
|
|
|
|
ifneq ("$(USE_CLANG)","0")
|
|
|
|
# --target=thumbv7m-none-eabi
|
|
|
|
CC = clang
|
|
|
|
LD = ld.lld
|
|
|
|
SIZE = llvm-size
|
|
|
|
LIBS = -nostdlib
|
|
|
|
else
|
2014-11-28 10:02:16 +00:00
|
|
|
CC = $(CROSS_COMPILE)gcc
|
|
|
|
LD = $(CROSS_COMPILE)ld
|
|
|
|
SIZE = $(CROSS_COMPILE)size
|
2021-10-20 14:42:36 +00:00
|
|
|
LIBS = -Wl,--start-group -lgcc -Wl,--end-group -nostdlib
|
|
|
|
endif
|
|
|
|
|
2014-11-28 10:02:16 +00:00
|
|
|
STRIP = $(CROSS_COMPILE)strip
|
|
|
|
OBJCOPY = $(CROSS_COMPILE)objcopy
|
|
|
|
GDB = $(CROSS_COMPILE)gdb
|
|
|
|
NM = $(CROSS_COMPILE)nm
|
|
|
|
|
2016-03-19 20:37:55 +00:00
|
|
|
TOP=..
|
|
|
|
|
2017-02-27 21:58:59 +00:00
|
|
|
#-------------------------------------------------------------------------------
|
|
|
|
# Files
|
|
|
|
#-------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
# Directories where source files can be found
|
|
|
|
|
|
|
|
USB_PATHS = $(AT91LIB_USB_CORE_PATH) $(AT91LIB_USB_DFU_PATH) $(AT91LIB_USB_COMMON_CORE_PATH)
|
|
|
|
|
|
|
|
VPATH += $(USB_PATHS)
|
|
|
|
VPATH += $(AT91LIB)/libchip_sam3s/source/ $(AT91LIB)/libchip_sam3s/cmsis
|
|
|
|
VPATH += libboard/common/source libboard/$(BOARD)/source
|
|
|
|
VPATH += libcommon/source
|
2017-02-27 22:20:38 +00:00
|
|
|
VPATH += libosmocore/source
|
2017-02-27 21:58:59 +00:00
|
|
|
VPATH += apps/$(APP)
|
|
|
|
|
|
|
|
# Objects built from C source files
|
|
|
|
C_OSMOCORE = $(notdir $(wildcard libosmocore/source/*.c))
|
|
|
|
C_LIBCHIP = $(notdir $(wildcard $(AT91LIB)/libchip_sam3s/source/*.c) $(wildcard $(AT91LIB)/libchip_sam3s/cmsis/*.c))
|
|
|
|
|
|
|
|
C_LIBUSB = USBDescriptors.c USBRequests.c USBD.c USBDCallbacks.c USBDDriver.c USBDDriverCallbacks.c
|
2017-03-06 08:28:13 +00:00
|
|
|
C_LIBUSB_RT = dfu.c dfu_runtime.c
|
2017-02-27 21:58:59 +00:00
|
|
|
C_LIBUSB_DFU = dfu.c dfu_desc.c dfu_driver.c
|
2020-01-11 11:31:51 +00:00
|
|
|
C_LIBCOMMON = string.c stdio.c fputs.c usb_buf.c ringbuffer.c pseudo_talloc.c host_communication.c \
|
2020-08-05 09:59:26 +00:00
|
|
|
main_common.c stack_check.c
|
2017-02-27 21:58:59 +00:00
|
|
|
|
|
|
|
C_BOARD = $(notdir $(wildcard libboard/common/source/*.c))
|
2019-02-07 16:42:29 +00:00
|
|
|
C_BOARD += $(notdir $(wildcard libboard/$(BOARD)/source/*.c))
|
2017-02-27 21:58:59 +00:00
|
|
|
|
|
|
|
C_APPLEVEL = $(notdir $(wildcard apps/$(APP)/*.c))
|
|
|
|
|
|
|
|
C_FILES = $(C_OSMOCORE) $(C_LIBCHIP) $(C_LIBUSB) $(C_LIBCOMMON) $(C_BOARD) $(C_APPLEVEL)
|
|
|
|
|
|
|
|
-include apps/$(APP)/Makefile
|
|
|
|
|
|
|
|
C_OBJECTS = $(C_FILES:%.c=%.o)
|
|
|
|
|
|
|
|
# Trace level used for compilation
|
|
|
|
# (can be overriden by adding TRACE_LEVEL=#number to the command-line)
|
|
|
|
# TRACE_LEVEL_DEBUG 5
|
|
|
|
# TRACE_LEVEL_INFO 4
|
|
|
|
# TRACE_LEVEL_WARNING 3
|
|
|
|
# TRACE_LEVEL_ERROR 2
|
|
|
|
# TRACE_LEVEL_FATAL 1
|
|
|
|
# TRACE_LEVEL_NO_TRACE 0
|
|
|
|
TRACE_LEVEL ?= 4
|
|
|
|
|
2019-05-23 15:33:45 +00:00
|
|
|
# allow asserting the peer SAM3S ERASE signal to completely erase the flash
|
|
|
|
# only applicable for qmod board
|
|
|
|
ALLOW_PEER_ERASE?=0
|
|
|
|
|
2017-02-27 21:58:59 +00:00
|
|
|
#CFLAGS+=-DUSB_NO_DEBUG=1
|
|
|
|
|
|
|
|
# Optimization level, put in comment for debugging
|
2021-10-20 14:42:36 +00:00
|
|
|
ifneq ("$(USE_CLANG)","0")
|
|
|
|
OPTIMIZATION ?= -Oz
|
|
|
|
else
|
2017-02-27 22:24:22 +00:00
|
|
|
OPTIMIZATION ?= -Os
|
2021-10-20 14:42:36 +00:00
|
|
|
endif
|
2017-02-27 21:58:59 +00:00
|
|
|
|
2014-11-28 10:02:16 +00:00
|
|
|
# Flags
|
2017-02-27 12:53:17 +00:00
|
|
|
INCLUDES_USB = -I$(AT91LIB)/usb/include -I$(AT91LIB)
|
2016-02-28 18:32:36 +00:00
|
|
|
|
2017-02-27 12:53:17 +00:00
|
|
|
INCLUDES = $(INCLUDES_USB)
|
|
|
|
INCLUDES += -I$(AT91LIB)/libchip_sam3s -I$(AT91LIB)/libchip_sam3s/include
|
|
|
|
INCLUDES += -I$(AT91LIB)/libchip_sam3s/cmsis
|
|
|
|
INCLUDES += -Ilibboard/common/include -Ilibboard/$(BOARD)/include
|
|
|
|
INCLUDES += -Ilibcommon/include
|
|
|
|
INCLUDES += -Ilibosmocore/include
|
|
|
|
INCLUDES += -Isrc_simtrace -Iinclude
|
2017-03-05 09:16:25 +00:00
|
|
|
INCLUDES += -Iapps/$(APP)
|
2014-11-28 10:02:16 +00:00
|
|
|
|
2021-10-20 14:42:36 +00:00
|
|
|
ifneq ("$(USE_CLANG)","0")
|
|
|
|
CFLAGS += -Wno-unknown-warning-option -Wno-empty-body -fno-exceptions -fno-unwind-tables --config armv7em_soft_nofp_nosys
|
|
|
|
else
|
|
|
|
CFLAGS += -Wno-suggest-attribute=noreturn --param max-inline-insns-single=500
|
|
|
|
endif
|
2018-08-26 07:53:13 +00:00
|
|
|
CFLAGS += -Wall -Wchar-subscripts -Wcomment -Wimplicit-int -Wformat=2
|
2014-11-28 10:02:16 +00:00
|
|
|
CFLAGS += -Werror-implicit-function-declaration -Wmain -Wparentheses
|
2015-01-03 21:22:36 +00:00
|
|
|
CFLAGS += -Wsequence-point -Wreturn-type -Wswitch -Wtrigraphs #-Wunused
|
2017-11-28 19:47:23 +00:00
|
|
|
CFLAGS += -Wuninitialized -Wunknown-pragmas -Wfloat-equal #-Wundef
|
2014-11-28 10:02:16 +00:00
|
|
|
CFLAGS += -Wshadow -Wpointer-arith -Wbad-function-cast -Wwrite-strings
|
2017-11-28 19:47:23 +00:00
|
|
|
CFLAGS += -Waggregate-return #-Wsign-compare
|
2015-01-03 21:22:36 +00:00
|
|
|
CFLAGS += -Wmissing-format-attribute -Wno-deprecated-declarations
|
2015-04-07 18:13:44 +00:00
|
|
|
CFLAGS += #-Wpacked
|
2017-05-07 09:20:24 +00:00
|
|
|
CFLAGS += -Wredundant-decls -Wnested-externs #-Winline -Wlong-long
|
2014-11-28 10:02:16 +00:00
|
|
|
CFLAGS += -Wunreachable-code
|
2016-03-03 16:48:32 +00:00
|
|
|
#CFLAGS += -Wcast-align
|
2016-02-29 13:08:12 +00:00
|
|
|
#CFLAGS += -std=c11
|
2021-10-20 14:42:36 +00:00
|
|
|
#CFLAGS += -Wmissing-noreturn
|
2015-01-27 13:56:33 +00:00
|
|
|
#CFLAGS += -Wconversion
|
2015-01-27 13:40:31 +00:00
|
|
|
CFLAGS += -Wno-unused-but-set-variable -Wno-unused-variable
|
2021-10-20 14:42:36 +00:00
|
|
|
|
2014-11-28 10:02:16 +00:00
|
|
|
|
|
|
|
# -mlong-calls -Wall
|
|
|
|
#CFLAGS += -save-temps -fverbose-asm
|
|
|
|
#CFLAGS += -Wa,-a,-ad
|
2020-04-03 19:33:30 +00:00
|
|
|
CFLAGS += -D__ARM -fno-builtin
|
2021-10-20 14:42:36 +00:00
|
|
|
CFLAGS += -mcpu=cortex-m3 -mthumb # -mfix-cortex-m3-ldrd
|
2021-10-04 16:02:29 +00:00
|
|
|
CFLAGS += -ffunction-sections -g $(OPTIMIZATION) $(INCLUDES) -D$(CHIP) -DTRACE_LEVEL=$(TRACE_LEVEL) -DALLOW_PEER_ERASE=$(ALLOW_PEER_ERASE)
|
2017-03-02 22:16:01 +00:00
|
|
|
CFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\"
|
|
|
|
CFLAGS += -DBOARD=\"$(BOARD)\" -DBOARD_$(BOARD)
|
|
|
|
CFLAGS += -DAPPLICATION=\"$(APP)\" -DAPPLICATION_$(APP)
|
2021-04-08 09:58:59 +00:00
|
|
|
|
|
|
|
# Disable stack protector by default (OS#5081)
|
|
|
|
ifeq ($(STACK_PROTECTOR), 1)
|
|
|
|
CFLAGS += -fstack-protector
|
|
|
|
else
|
|
|
|
CFLAGS += -fno-stack-protector
|
|
|
|
endif
|
|
|
|
|
2014-11-28 10:02:16 +00:00
|
|
|
ASFLAGS = -mcpu=cortex-m3 -mthumb -Wall -g $(OPTIMIZATION) $(INCLUDES) -D$(CHIP) -D__ASSEMBLY__
|
2021-10-28 16:32:42 +00:00
|
|
|
LDFLAGS = -mcpu=cortex-m3 -mthumb -Wl,--check-sections -Wl,--gc-sections -Wl,--entry=ResetException -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--no-undefined $(LIB)
|
2021-10-20 14:42:36 +00:00
|
|
|
ifeq ("$(USE_CLANG)","0")
|
|
|
|
LDFLAGS += -Wl,--warn-section-align -Wl,--print-memory-usage
|
|
|
|
endif
|
2014-11-28 10:02:16 +00:00
|
|
|
#LD_OPTIONAL=-Wl,--print-gc-sections -Wl,--stats
|
|
|
|
|
2019-08-01 15:17:18 +00:00
|
|
|
# Append BIN directories to output filename
|
2014-11-28 10:02:16 +00:00
|
|
|
OUTPUT := $(BIN)/$(OUTPUT)
|
|
|
|
|
|
|
|
#-------------------------------------------------------------------------------
|
|
|
|
# Rules
|
|
|
|
#-------------------------------------------------------------------------------
|
|
|
|
|
2021-07-16 13:09:50 +00:00
|
|
|
all: $(BIN) $(OBJ) $(MEMORIES)
|
2014-11-28 10:02:16 +00:00
|
|
|
|
2017-05-05 20:29:15 +00:00
|
|
|
combined: $(OUTPUT)-combined.bin
|
|
|
|
|
|
|
|
$(BIN)/$(BOARD)-dfu-flash-padded.bin: $(BIN)/$(BOARD)-dfu-flash.bin
|
|
|
|
dd if=/dev/zero bs=16384 count=1 of=$@
|
|
|
|
dd if=$< conv=notrunc of=$@
|
|
|
|
|
|
|
|
$(OUTPUT)-combined.bin: $(BIN)/$(BOARD)-dfu-flash-padded.bin $(OUTPUT)-dfu.bin
|
|
|
|
cat $^ > $@
|
|
|
|
|
2021-07-16 13:09:50 +00:00
|
|
|
$(BIN) $(OBJ): apps/$(APP)/usb_strings_generated.h
|
2018-06-29 19:43:42 +00:00
|
|
|
mkdir -p $@
|
2014-11-28 10:02:16 +00:00
|
|
|
|
2017-03-05 09:16:25 +00:00
|
|
|
usbstring/usbstring: usbstring/usbstring.c
|
|
|
|
gcc $^ -o $@
|
|
|
|
|
2019-12-06 18:17:53 +00:00
|
|
|
.PHONY: apps/$(APP)/usb_strings.txt.patched
|
|
|
|
apps/$(APP)/usb_strings.txt.patched: apps/$(APP)/usb_strings.txt
|
|
|
|
sed "s/PRODUCT_STRING/$(shell cat libboard/$(BOARD)/product_string.txt)/" $< > $@
|
|
|
|
|
|
|
|
apps/$(APP)/usb_strings_generated.h: apps/$(APP)/usb_strings.txt.patched usbstring/usbstring
|
2017-03-05 09:16:25 +00:00
|
|
|
cat $< | usbstring/usbstring > $@
|
|
|
|
|
2014-11-28 10:02:16 +00:00
|
|
|
define RULES
|
|
|
|
C_OBJECTS_$(1) = $(addprefix $(OBJ)/$(1)_, $(C_OBJECTS))
|
|
|
|
ASM_OBJECTS_$(1) = $(addprefix $(OBJ)/$(1)_, $(ASM_OBJECTS))
|
2021-10-28 16:03:39 +00:00
|
|
|
EXTRA_OBJECTS_$(1) = $(addprefix $(OBJ)/$(1)_, $(EXTRA_OBJECTS))
|
2014-11-28 10:02:16 +00:00
|
|
|
|
2021-10-28 16:03:39 +00:00
|
|
|
build_$(1): $$(ASM_OBJECTS_$(1)) $$(C_OBJECTS_$(1)) $$(EXTRA_OBJECTS_$(1))
|
|
|
|
$(SILENT)$(CC) $(CFLAGS) $(LDFLAGS) $(LD_OPTIONAL) -T"libboard/common/resources/$(CHIP)/$(1).ld" -Wl,-Map,$(OUTPUT)-$(1).map -o $(OUTPUT)-$(1).elf $$^ $(LIBS)
|
|
|
|
$(SILENT)$(NM) $(OUTPUT)-$(1).elf >$(OUTPUT)-$(1).elf.txt
|
|
|
|
$(SILENT)$(OBJCOPY) -O binary $(OUTPUT)-$(1).elf $(OUTPUT)-$(1).bin
|
|
|
|
$(SILENT)$(SIZE) $$^ $(OUTPUT)-$(1).elf
|
2014-11-28 10:02:16 +00:00
|
|
|
|
|
|
|
$$(C_OBJECTS_$(1)): $(OBJ)/$(1)_%.o: %.c Makefile $(OBJ) $(BIN)
|
2015-04-07 18:36:23 +00:00
|
|
|
@echo [COMPILING $$<]
|
2021-10-20 14:42:36 +00:00
|
|
|
$(SILENT)$(CC) $(CFLAGS) -DENVIRONMENT_$(1) -DENVIRONMENT=\"$(1)\" -c -o $$@ $$<
|
2014-11-28 10:02:16 +00:00
|
|
|
|
|
|
|
$$(ASM_OBJECTS_$(1)): $(OBJ)/$(1)_%.o: %.S Makefile $(OBJ) $(BIN)
|
|
|
|
@echo [ASSEMBLING $$@]
|
2021-10-28 16:03:39 +00:00
|
|
|
$(SILENT)$(CC) $(ASFLAGS) -DENVIRONMENT_$(1) -DENVIRONMENT=\"$(1)\" -c -o $$@ $$<
|
2014-11-28 10:02:16 +00:00
|
|
|
|
|
|
|
debug_$(1): $(1)
|
|
|
|
$(GDB) -x "$(BOARD_LIB)/resources/gcc/$(BOARD)_$(1).gdb" -ex "reset" -readnow -se $(OUTPUT)-$(1).elf
|
|
|
|
endef
|
|
|
|
|
2021-10-28 16:03:39 +00:00
|
|
|
ALL_MEMORIES = dfu flash ram
|
|
|
|
$(foreach MEMORY, $(ALL_MEMORIES), $(eval $(call RULES,$(MEMORY))))
|
|
|
|
|
|
|
|
# files with those names do exist..
|
|
|
|
.PHONY: ram
|
|
|
|
.PHONY: dfu
|
|
|
|
.PHONY: flash
|
|
|
|
ram: build_ram
|
|
|
|
dfu: build_dfu
|
|
|
|
ifeq ($(APP), blupdate)
|
|
|
|
$(info updating updater section with padded bootloader file..)
|
|
|
|
$(SILENT)dd if=/dev/zero bs=16384 count=1 of=$(BIN)/$(BOARD)-dfu-flash-padded.bin
|
|
|
|
$(SILENT)dd if=$(BIN)/$(BOARD)-dfu-flash.bin conv=notrunc of=$(BIN)/$(BOARD)-dfu-flash-padded.bin
|
|
|
|
$(SILENT)$(OBJCOPY) --update-section .blupdate=bin/$(BOARD)-dfu-flash-padded.bin bin/$(BOARD)-blupdate-dfu.elf
|
|
|
|
$(SILENT)$(OBJCOPY) -O binary bin/$(BOARD)-blupdate-dfu.elf bin/$(BOARD)-blupdate-dfu.bin
|
|
|
|
endif
|
|
|
|
flash: build_flash
|
|
|
|
#alternate way of embedding: obj file
|
|
|
|
#ifeq ($(APP), dfu)
|
|
|
|
# $(info bootloader bin file to obj..)
|
|
|
|
# $(SILENT)$(OBJCOPY) --rename-section .data=.fwupdate -I binary -O elf32-littlearm bin/$(BOARD)-dfu-flash.bin $(OBJ)/flash_fwupdate.o
|
|
|
|
#endif
|
2014-11-28 10:02:16 +00:00
|
|
|
|
|
|
|
program:
|
2015-04-07 16:19:13 +00:00
|
|
|
openocd -f openocd/openocd.cfg -c "init" -c "halt" -c "flash write_bank 0 ./bin/project-flash.bin 0" -c "reset" -c "shutdown"
|
2014-11-28 10:02:16 +00:00
|
|
|
|
2015-04-07 22:10:50 +00:00
|
|
|
SERIAL ?= /dev/ttyUSB0
|
|
|
|
log:
|
2019-12-02 18:25:55 +00:00
|
|
|
stty -F $(SERIAL) 921600
|
2015-04-13 20:09:50 +00:00
|
|
|
lsof $(SERIAL) && echo "log is already opened" || ( sed -u "s/\r//" $(SERIAL) | ts )
|
2015-04-07 22:10:50 +00:00
|
|
|
|
2014-11-28 10:02:16 +00:00
|
|
|
clean:
|
2019-12-06 18:17:53 +00:00
|
|
|
-rm -f apps/$(APP)/usb_strings.txt.patched
|
2017-05-07 09:20:40 +00:00
|
|
|
-rm -fR $(OBJ)/*.o $(BIN)/*.bin $(BIN)/*.elf $(BIN)/*.elf.txt $(BIN)/*.map $(BIN)/*.lst `find . -name \*.p`
|
2018-08-26 07:23:54 +00:00
|
|
|
|
|
|
|
install:
|
|
|
|
mkdir -p $(DESTDIR)/usr/share/simtrace2
|
|
|
|
cp $(BIN)/*.bin $(BIN)/*.elf $(BIN)/*.elf.txt $(BIN)/*.map $(DESTDIR)/usr/share/simtrace2
|