amiro-blt / Target / Modules / flash.mk @ d5a2a7ce
History | View | Annotate | Download (2.596 KB)
1 | 6ac03b0f | Thomas Schöpping | ################################################################################ |
---|---|---|---|
2 | # AMiRo-BLT is the bootloader and flashing toolchain for the base version of # |
||
3 | # the Autonomous Mini Robot (AMiRo). It is based on OpenBLT developed by # |
||
4 | # Feaser (see <http://feaser.com/en/openblt.php>). # |
||
5 | 94886d84 | Thomas Schöpping | # Copyright (C) 2016..2020 Thomas Schöpping et al. # |
6 | 6ac03b0f | Thomas Schöpping | # # |
7 | # This program is free software: you can redistribute it and/or modify # |
||
8 | # it under the terms of the GNU General Public License as published by # |
||
9 | # the Free Software Foundation, either version 3 of the License, or # |
||
10 | # (at your option) any later version. # |
||
11 | # # |
||
12 | # This program is distributed in the hope that it will be useful, # |
||
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of # |
||
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # |
||
15 | # GNU General Public License for more details. # |
||
16 | # # |
||
17 | # You should have received a copy of the GNU General Public License # |
||
18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. # |
||
19 | # # |
||
20 | # This research/work was supported by the Cluster of Excellence Cognitive # |
||
21 | # Interaction Technology 'CITEC' (EXC 277) at Bielefeld University, which is # |
||
22 | # funded by the German Research Foundation (DFG). # |
||
23 | ################################################################################ |
||
24 | |||
25 | |||
26 | |||
27 | 9ed9243f | Thomas Schöpping | STM32FLASH := $(dir $(lastword $(MAKEFILE_LIST)))../../Host/Source/stm32flash/stm32flash |
28 | 69661903 | Thomas Schöpping | ifeq ($(OS),Windows_NT) |
29 | STM32FLASH_PORT ?= COM5 |
||
30 | else |
||
31 | 03906dc3 | Thomas Schöpping | # 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 |
||
44 | 69661903 | Thomas Schöpping | endif |
45 | BAUDRATE = 115200 |
||
46 | BINARY = $(BIN_PATH)/$(PROJ_NAME).hex |
||
47 | GPIO_ENTER_SEQUENCE = "rts,-dtr,-rts" |
||
48 | GPIO_EXIT_SEQUENCE = "rts,dtr,-rts" |
||
49 | |||
50 | flash: $(BINARY) |
||
51 | @echo +++ Flashing |
||
52 | $(STM32FLASH) $(STM32FLASH_PORT) -i $(GPIO_ENTER_SEQUENCE):$(GPIO_EXIT_SEQUENCE) -R -b $(BAUDRATE) -w $(BINARY) |