Revision 19d9fea2 Target/Modules/flash.mk

View differences:

Target/Modules/flash.mk
23 23
################################################################################
24 24

  
25 25

  
26

  
27
STM32FLASH := $(dir $(lastword $(MAKEFILE_LIST)))../../Host/Source/stm32flash/stm32flash
28
ifeq ($(OS),Windows_NT)
29
	STM32FLASH_PORT ?= COM5
26
# select a stm32flash installation
27
ifneq ($(wildcard $(dir $(lastword $(MAKEFILE_LIST)))../../Host/Source/stm32flash/stm32flash),)
28
  # perferably use a local installation, if such exists
29
  STM32FLASH := $(dir $(lastword $(MAKEFILE_LIST)))../../Host/Source/stm32flash/stm32flash
30 30
else
31
	# check whether /dev/ttyAMiRo0 exists
32
	ifeq (,$(wildcard /dev/ttyAMiRo0))
33
		# check whether /dev/ttyUSB0 exists
34
		ifeq (,$(wildcard /dev/ttyUSB0))
35
			# set to /dev/ttyAMiRo0 for meaningful error message
36
			STM32FLASH_PORT ?= /dev/ttyAMiRo0
37
		else
38
			# legacy support
39
			STM32FLASH_PORT ?= /dev/ttyUSB0
40
		endif
41
	else
42
		STM32FLASH_PORT ?= /dev/ttyAMiRo0
43
	endif
31
  # alternatively try a system installation
32
  STM32FLASH := stm32flash
33
endif
34

  
35
# set the STM32FLASH_PORT if no custom value has been specified
36
ifeq ($(STM32FLASH_PORT),)
37
  ifeq ($(OS),Windows_NT)
38
    STM32FLASH_PORT ?= COM5
39
  else
40
    # check whether /dev/ttyAMiRo0 exists
41
    ifeq ($(wildcard /dev/ttyAMiRo0),)
42
      # check whether /dev/ttyUSB0 exists
43
      ifeq ($(wildcard /dev/ttyUSB0),)
44
        # set to /dev/ttyAMiRo0 for meaningful error message
45
        STM32FLASH_PORT ?= /dev/ttyAMiRo0
46
      else
47
        # legacy support
48
        STM32FLASH_PORT ?= /dev/ttyUSB0
49
      endif
50
    else
51
      STM32FLASH_PORT ?= /dev/ttyAMiRo0
52
    endif
53
  endif
44 54
endif
45 55
BAUDRATE = 115200
46 56
BINARY = $(BIN_PATH)/$(PROJ_NAME).hex

Also available in: Unified diff