mirror of
https://github.com/apache/nuttx.git
synced 2026-06-05 07:12:54 +08:00
photon: add DOWNLOAD function to upload firmware through DFU
This commit is contained in:
committed by
Gregory Nutt
parent
a76266106a
commit
e1a4e88a55
@@ -313,6 +313,25 @@ config UIMAGE_ENTRY_POINT
|
|||||||
hex "uImage entry point"
|
hex "uImage entry point"
|
||||||
default 0x0
|
default 0x0
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
menuconfig DFU_BINARY
|
||||||
|
bool "DFU binary format"
|
||||||
|
select RAW_BINARY
|
||||||
|
---help---
|
||||||
|
Create the dfu binary used with dfu-utils.
|
||||||
|
|
||||||
|
if DFU_BINARY
|
||||||
|
|
||||||
|
config DFU_BASE
|
||||||
|
hex "Address DFU image is loaded to"
|
||||||
|
|
||||||
|
config DFU_VID
|
||||||
|
hex "VID to use for DFU image"
|
||||||
|
|
||||||
|
config DFU_PID
|
||||||
|
hex "PID to use for DFU image"
|
||||||
|
|
||||||
endif
|
endif
|
||||||
endmenu # Binary Output Formats
|
endmenu # Binary Output Formats
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,10 @@ CONFIG_INTELHEX_BINARY=y
|
|||||||
# CONFIG_MOTOROLA_SREC is not set
|
# CONFIG_MOTOROLA_SREC is not set
|
||||||
CONFIG_RAW_BINARY=y
|
CONFIG_RAW_BINARY=y
|
||||||
# CONFIG_UBOOT_UIMAGE is not set
|
# CONFIG_UBOOT_UIMAGE is not set
|
||||||
|
CONFIG_DFU_BINARY=y
|
||||||
|
CONFIG_DFU_BASE=0x8020000
|
||||||
|
CONFIG_DFU_VID=0x2b04
|
||||||
|
CONFIG_DFU_PID=0xd006
|
||||||
|
|
||||||
#
|
#
|
||||||
# Customize Header Files
|
# Customize Header Files
|
||||||
|
|||||||
@@ -68,6 +68,9 @@ NM = $(ARCROSSDEV)nm
|
|||||||
OBJCOPY = $(CROSSDEV)objcopy
|
OBJCOPY = $(CROSSDEV)objcopy
|
||||||
OBJDUMP = $(CROSSDEV)objdump
|
OBJDUMP = $(CROSSDEV)objdump
|
||||||
|
|
||||||
|
DFUSUFFIX = dfu-suffix
|
||||||
|
DFUUTIL = dfu-util
|
||||||
|
|
||||||
ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
|
ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
|
||||||
ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
|
ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
|
||||||
|
|
||||||
@@ -114,3 +117,20 @@ HOSTCC = gcc
|
|||||||
HOSTINCLUDES = -I.
|
HOSTINCLUDES = -I.
|
||||||
HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -Wundef -g -pipe
|
HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -Wundef -g -pipe
|
||||||
HOSTLDFLAGS =
|
HOSTLDFLAGS =
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_DFU_BINARY),y)
|
||||||
|
|
||||||
|
define DOWNLOAD
|
||||||
|
$(Q) echo "DFUSUFFIX: $(1).dfu"
|
||||||
|
$(Q) $(OBJCOPY) $(OBJCOPYARGS) -O binary $(1) $(1).dfu
|
||||||
|
$(Q) $(DFUSUFFIX) -v $(subst 0x,,$(CONFIG_DFU_VID)) -p $(subst 0x,,$(CONFIG_DFU_PID)) -a $(1).dfu
|
||||||
|
$(Q) $(DFUUTIL) -d $(CONFIG_DFU_VID):$(CONFIG_DFU_PID) -a 0 -s $(CONFIG_DFU_BASE) -D $(1).dfu
|
||||||
|
endef
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
define DOWNLOAD
|
||||||
|
$(Q) $(ECHO) "Photon firmware upload through JTAG is not supported"
|
||||||
|
endef
|
||||||
|
|
||||||
|
endif
|
||||||
Reference in New Issue
Block a user