Merge pull request #10269 from haslinghuis/fix-dfu-pack

Fix dfuse and python check
This commit is contained in:
Michael Keller 2020-10-18 19:26:27 +13:00 committed by GitHub
commit 785969031d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 39 additions and 79 deletions

View File

@ -6,24 +6,20 @@
# and the ARM toolchain installed to either the Taulabs/tools directory, their # and the ARM toolchain installed to either the Taulabs/tools directory, their
# respective default installation locations, or made available on the system path. # respective default installation locations, or made available on the system path.
# Check for and find Python 2 # First look for `python3`. If `which` doesn't return a null value, then it exists!
ifneq ($(shell which python3), "")
# Get Python version, separate major/minor/patch, then put into wordlist PYTHON:=python3
PYTHON_VERSION_=$(wordlist 2,4,$(subst ., ,$(shell python -V 2>&1))) else
# Get major version from aforementioned list # Get Python version, separate major/minor/patch, then put into wordlist
PYTHON_MAJOR_VERSION_=$(word 1,$(PYTHON_VERSION_)) PYTHON_VERSION_=$(wordlist 2,4,$(subst ., ,$(shell python -V 2>&1)))
# Just in case Make has some weird scope stuff # Get major version from aforementioned list
PYTHON=0 PYTHON_MAJOR_VERSION_=$(word 1,$(PYTHON_VERSION_))
# If the major Python version is the one we want.. # Just in case Make has some weird scope stuff
ifeq ($(PYTHON_MAJOR_VERSION_),2) PYTHON=0
# If the major Python version is the one we want..
ifeq ($(PYTHON_MAJOR_VERSION_),3)
# Then we can just use the normal Python executable # Then we can just use the normal Python executable
PYTHON:=python PYTHON:=python
else
# However, this isn't always the case..
# Let's look for `python2`. If `which` doesn't return a null value, then
# it exists!
ifneq ($(shell which python2), "")
PYTHON:=python2
else else
# And if it doesn't exist, let's use the default Python, and warn the user. # And if it doesn't exist, let's use the default Python, and warn the user.
# PYTHON NOT FOUND. # PYTHON NOT FOUND.

View File

@ -6,24 +6,20 @@
# ARM toolchain installed to either their respective default installation # ARM toolchain installed to either their respective default installation
# locations, the tools directory or made available on the system path. # locations, the tools directory or made available on the system path.
# Check for and find Python 2 # First look for `python3`. If `which` doesn't return a null value, then it exists!
ifneq ($(shell which python3), "")
# Get Python version, separate major/minor/patch, then put into wordlist PYTHON:=python3
PYTHON_VERSION_=$(wordlist 2,4,$(subst ., ,$(shell python -V 2>&1))) else
# Get major version from aforementioned list # Get Python version, separate major/minor/patch, then put into wordlist
PYTHON_MAJOR_VERSION_=$(word 1,$(PYTHON_VERSION_)) PYTHON_VERSION_=$(wordlist 2,4,$(subst ., ,$(shell python -V 2>&1)))
# Just in case Make has some weird scope stuff # Get major version from aforementioned list
PYTHON=0 PYTHON_MAJOR_VERSION_=$(word 1,$(PYTHON_VERSION_))
# If the major Python version is the one we want.. # Just in case Make has some weird scope stuff
ifeq ($(PYTHON_MAJOR_VERSION_),2) PYTHON=0
# If the major Python version is the one we want..
ifeq ($(PYTHON_MAJOR_VERSION_),3)
# Then we can just use the normal Python executable # Then we can just use the normal Python executable
PYTHON:=python PYTHON:=python
else
# However, this isn't always the case..
# Let's look for `python2`. If `which` doesn't return a null value, then
# it exists!
ifneq ($(shell which python2), "")
PYTHON:=python2
else else
# And if it doesn't exist, let's use the default Python, and warn the user. # And if it doesn't exist, let's use the default Python, and warn the user.
# PYTHON NOT FOUND. # PYTHON NOT FOUND.

View File

@ -196,38 +196,6 @@ stm32flash_clean:
@echo " CLEAN $(STM32FLASH_DIR)" @echo " CLEAN $(STM32FLASH_DIR)"
$(V1) [ ! -d "$(STM32FLASH_DIR)" ] || $(RM) -r "$(STM32FLASH_DIR)" $(V1) [ ! -d "$(STM32FLASH_DIR)" ] || $(RM) -r "$(STM32FLASH_DIR)"
DFUUTIL_DIR := $(TOOLS_DIR)/dfu-util
.PHONY: dfuutil_install
dfuutil_install: DFUUTIL_URL := http://dfu-util.sourceforge.net/releases/dfu-util-0.8.tar.gz
dfuutil_install: DFUUTIL_FILE := $(notdir $(DFUUTIL_URL))
dfuutil_install: | $(DL_DIR) $(TOOLS_DIR)
dfuutil_install: dfuutil_clean
# download the source
@echo " DOWNLOAD $(DFUUTIL_URL)"
$(V1) curl -L -k -o "$(DL_DIR)/$(DFUUTIL_FILE)" "$(DFUUTIL_URL)"
# extract the source
@echo " EXTRACT $(DFUUTIL_FILE)"
$(V1) [ ! -d "$(DL_DIR)/dfuutil-build" ] || $(RM) -r "$(DL_DIR)/dfuutil-build"
$(V1) mkdir -p "$(DL_DIR)/dfuutil-build"
$(V1) tar -C $(DL_DIR)/dfuutil-build -xf "$(DL_DIR)/$(DFUUTIL_FILE)"
# build
@echo " BUILD $(DFUUTIL_DIR)"
$(V1) mkdir -p "$(DFUUTIL_DIR)"
$(V1) ( \
cd $(DL_DIR)/dfuutil-build/dfu-util-0.8 ; \
./configure --prefix="$(DFUUTIL_DIR)" ; \
$(MAKE) ; \
$(MAKE) install ; \
)
.PHONY: dfuutil_clean
dfuutil_clean:
@echo " CLEAN $(DFUUTIL_DIR)"
$(V1) [ ! -d "$(DFUUTIL_DIR)" ] || $(RM) -r "$(DFUUTIL_DIR)"
# Set up uncrustify tools # Set up uncrustify tools
UNCRUSTIFY_DIR := $(TOOLS_DIR)/uncrustify-0.61 UNCRUSTIFY_DIR := $(TOOLS_DIR)/uncrustify-0.61
UNCRUSTIFY_BUILD_DIR := $(DL_DIR)/uncrustify UNCRUSTIFY_BUILD_DIR := $(DL_DIR)/uncrustify

View File

@ -135,7 +135,7 @@ if __name__=="__main__":
try: try:
address = address & 0xFFFFFFFF address = address & 0xFFFFFFFF
except ValueError: except ValueError:
print "Address %s invalid." % address print("Address %s invalid." % address)
sys.exit(1) sys.exit(1)
target.append({ 'address': address, 'data': ih.tobinstr(start=address, end=end-1)}) target.append({ 'address': address, 'data': ih.tobinstr(start=address, end=end-1)})