Statistics
| Branch: | Tag: | Revision:

amiro-os / bootloader / bootloader.mk @ e545e620

History | View | Annotate | Download (3.32 KB)

1
################################################################################
2
# AMiRo-OS is an operating system designed for the Autonomous Mini Robot       #
3
# (AMiRo) platform.                                                            #
4
# Copyright (C) 2016..2018  Thomas Schöpping et al.                            #
5
#                                                                              #
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
# the path to this makefile
27
BOOTLOADER_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
28

    
29
# the interface for the bootloader
30
BOOTLOADERINC = $(BOOTLOADER_DIR)AMiRo-BLT/Target/Source/AMiRo
31

    
32
include $(BOOTLOADER_DIR)AMiRo-BLT/Target/Modules/moduleids.mk
33

    
34
# some flashing parameters
35
ifeq ($(OS),Windows_NT)
36
	FLASH_PORT ?= COM4
37
else
38
	FLASH_PORT ?= /dev/ttyUSB0
39
endif
40
FLASH_BAUDRATE ?= 115200
41

    
42
# set the flashing tool, the command to call it, arguments, and file extensions
43
ifneq ($(wildcard $(BOOTLOADER_DIR)AMiRo-BLT/Host/Source/SerialBoot/build/SerialBoot),)
44
	# if AMiRo-BLT project is available, use SerialBoot
45
	FLASHTOOL = SerialBoot
46
	FLASHTOOL_CMD = $(BOOTLOADER_DIR)AMiRo-BLT/Host/Source/SerialBoot/build/SerialBoot
47
	FLASHTOOL_EXT = srec
48
	ifdef PROJECT
49
		FLASHTOOL_ARGS = -d$(FLASH_PORT) -b$(FLASH_BAUDRATE) $(foreach module,$(FLASH_MODULES),-T$($(module)_ID_HEX) build/$(module).$(FLASHTOOL_EXT))
50
	else
51
		FLASHTOOL_ARGS = -d$(FLASH_PORT) -b$(FLASH_BAUDRATE) $(foreach module,$(FLASH_MODULES),-T$($(module)_ID_HEX) $(FLASH_DIR)$(module)/build/$(module).$(FLASHTOOL_EXT))
52
	endif
53
else
54
	# the default tool to use is stm32flash
55
	ifneq ($(words $(FLASH_MODULES)),1)
56
		FLASH_MODULES := $(firstword $(FLASH_MODULES))
57
	endif
58
	FLASHTOOL = stm32flash
59
	FLASHTOOL_CMD = stm32flash
60
	FLASHTOOL_EXT = hex
61
	ifdef PROJECT
62
		FLASHTOOL_ARGS = $(FLASH_PORT) -i "rts,-dtr,-rts":"rts,dtr,-rts" -R -b $(FLASH_BAUDRATE) -w build/$(FLASH_MODULES).$(FLASHTOOL_EXT)
63
	else
64
		FLASHTOOL_ARGS = $(FLASH_PORT) -i "rts,-dtr,-rts":"rts,dtr,-rts" -R -b $(FLASH_BAUDRATE) -w $(FLASH_MODULES)/build/$(FLASH_MODULES).$(FLASHTOOL_EXT)
65
	endif
66
endif
67