Statistics
| Branch: | Tag: | Revision:

amiro-os / bootloader / bootloader.mk @ 47e89ebf

History | View | Annotate | Download (3.31 KB)

1 e545e620 Thomas Schöpping
################################################################################
2
# AMiRo-OS is an operating system designed for the Autonomous Mini Robot       #
3
# (AMiRo) platform.                                                            #
4 84f0ce9e Thomas Schöpping
# Copyright (C) 2016..2019  Thomas Schöpping et al.                            #
5 e545e620 Thomas Schöpping
#                                                                              #
6
# This program is free software: you can redistribute it and/or modify         #
7
# it under the terms of the GNU General Public License as published by         #
8
# the Free Software Foundation, either version 3 of the License, or            #
9
# (at your option) any later version.                                          #
10
#                                                                              #
11
# This program is distributed in the hope that it will be useful,              #
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of               #
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                #
14
# GNU General Public License for more details.                                 #
15
#                                                                              #
16
# You should have received a copy of the GNU General Public License            #
17
# along with this program.  If not, see <http://www.gnu.org/licenses/>.        #
18
#                                                                              #
19
# This research/work was supported by the Cluster of Excellence Cognitive      #
20
# Interaction Technology 'CITEC' (EXC 277) at Bielefeld University, which is   #
21
# funded by the German Research Foundation (DFG).                              #
22
################################################################################
23
24
25
26 efe86ca9 Thomas Schöpping
# path to this makefile
27 4c72a54c Thomas Schöpping
AMIROOS_BOOTLOADER_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
28 e545e620 Thomas Schöpping
29 4c72a54c Thomas Schöpping
# set AMiRo-BLT path variable
30
AMIROBLT := $(AMIROOS_BOOTLOADER_DIR)AMiRo-BLT
31 e545e620 Thomas Schöpping
32 4c72a54c Thomas Schöpping
# include paths
33
AMIROOS_BOOTLOADER_INC = $(AMIROBLT)/Target/Source/AMiRo
34
35
# load module ID constants
36
include $(AMIROBLT)/Target/Modules/moduleids.mk
37 e545e620 Thomas Schöpping
38
# some flashing parameters
39
ifeq ($(OS),Windows_NT)
40
	FLASH_PORT ?= COM4
41
else
42 27e4a312 Thomas Schöpping
	# check whether /dev/ttyAMiRo0 exists
43
	ifeq (,$(wildcard /dev/ttyAMiRo0))
44
		# check whether /dev/ttyUSB0 exists
45
		ifeq (,$(wildcard /dev/ttyUSB0))
46
			# set to /dev/ttyAMiRo0 for meaningful error message
47
			FLASH_PORT ?= /dev/ttyAMiRo0
48
		else
49
			# legacy support
50
			FLASH_PORT ?= /dev/ttyUSB0
51
		endif
52
	else
53
		FLASH_PORT ?= /dev/ttyAMiRo0
54
	endif
55 e545e620 Thomas Schöpping
endif
56
FLASH_BAUDRATE ?= 115200
57
58
# set the flashing tool, the command to call it, arguments, and file extensions
59 4c72a54c Thomas Schöpping
ifneq ($(wildcard $(AMIROBLT)/Host/Source/SerialBoot/build/SerialBoot),)
60 e545e620 Thomas Schöpping
	# if AMiRo-BLT project is available, use SerialBoot
61 4c72a54c Thomas Schöpping
	FLASHTOOL := SerialBoot
62
	FLASHTOOL_CMD := $(AMIROBLT)/Host/Source/SerialBoot/build/SerialBoot
63
	FLASHTOOL_EXT := srec
64 2f5f6722 Thomas Schöpping
	FLASHTOOL_ARGS = -d$(FLASH_PORT) -b$(FLASH_BAUDRATE) $(foreach module,$(FLASH_MODULES),-T$($(module)_ID_HEX) $(BUILDDIR)/$(module).$(FLASHTOOL_EXT))
65 e545e620 Thomas Schöpping
else
66
	# the default tool to use is stm32flash
67
	ifneq ($(words $(FLASH_MODULES)),1)
68
		FLASH_MODULES := $(firstword $(FLASH_MODULES))
69
	endif
70 4c72a54c Thomas Schöpping
	FLASHTOOL := stm32flash
71
	FLASHTOOL_CMD := stm32flash
72
	FLASHTOOL_EXT := hex
73 2f5f6722 Thomas Schöpping
	FLASHTOOL_ARGS = $(FLASH_PORT) -i "rts,-dtr,-rts":"rts,dtr,-rts" -R -b $(FLASH_BAUDRATE) -w $(BUILDDIR)/$(FLASH_MODULES).$(FLASHTOOL_EXT)
74 e545e620 Thomas Schöpping
endif