Replace Leonardo detection with Caterina detection
Checks bootloader.path for "caterina"
This commit is contained in:
parent
5abf12bdb2
commit
ae3e5c78ac
2 changed files with 23 additions and 33 deletions
|
@ -450,17 +450,9 @@ endif
|
||||||
########################################################################
|
########################################################################
|
||||||
# Reset
|
# Reset
|
||||||
#
|
#
|
||||||
ifeq ($(BOARD_TAG),leonardo)
|
|
||||||
LEO_RESET = 1
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(BOARD_TAG),micro)
|
|
||||||
LEO_RESET = 1
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifndef RESET_CMD
|
ifndef RESET_CMD
|
||||||
ifdef LEO_RESET
|
ifneq ($(CATERINA),)
|
||||||
RESET_CMD = $(ARDMK_PATH)/ard-reset-arduino --leonardo \
|
RESET_CMD = $(ARDMK_PATH)/ard-reset-arduino --caterina \
|
||||||
$(ARD_RESET_OPTS) $(call get_arduino_port)
|
$(ARD_RESET_OPTS) $(call get_arduino_port)
|
||||||
else
|
else
|
||||||
RESET_CMD = $(ARDMK_PATH)/ard-reset-arduino \
|
RESET_CMD = $(ARDMK_PATH)/ard-reset-arduino \
|
||||||
|
@ -468,8 +460,8 @@ ifndef RESET_CMD
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(BOARD_TAG),leonardo)
|
ifneq ($(CATERINA),)
|
||||||
ERROR_ON_LEONARDO = $(error On leonardo, raw_xxx operation is not supported)
|
ERROR_ON_LEONARDO = $(error On Leonardo, raw_xxx operation is not supported)
|
||||||
else
|
else
|
||||||
ERROR_ON_LEONARDO =
|
ERROR_ON_LEONARDO =
|
||||||
endif
|
endif
|
||||||
|
@ -509,6 +501,9 @@ ifeq ($(strip $(NO_CORE)),)
|
||||||
VARIANT = $(shell $(PARSE_BOARD_CMD) $(BOARD_TAG) build.variant)
|
VARIANT = $(shell $(PARSE_BOARD_CMD) $(BOARD_TAG) build.variant)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# see if we are a caterina device like leonardo or micro
|
||||||
|
CATERINA = $(findstring caterina,$(shell $(PARSE_BOARD_CMD) $(BOARD_TAG) bootloader.path))
|
||||||
|
|
||||||
# processor stuff
|
# processor stuff
|
||||||
ifndef MCU
|
ifndef MCU
|
||||||
MCU = $(shell $(PARSE_BOARD_CMD) $(BOARD_TAG) build.mcu)
|
MCU = $(shell $(PARSE_BOARD_CMD) $(BOARD_TAG) build.mcu)
|
||||||
|
@ -518,15 +513,10 @@ ifeq ($(strip $(NO_CORE)),)
|
||||||
F_CPU = $(shell $(PARSE_BOARD_CMD) $(BOARD_TAG) build.f_cpu)
|
F_CPU = $(shell $(PARSE_BOARD_CMD) $(BOARD_TAG) build.f_cpu)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(VARIANT),leonardo)
|
ifneq ($(CATERINA),)
|
||||||
# USB IDs for the Leonardo
|
# USB IDs for the Leonardo
|
||||||
ifndef USB_VID
|
USB_VID = $(shell $(PARSE_BOARD_CMD) $(BOARD_TAG) build.vid 2>/dev/null)
|
||||||
USB_VID = $(shell $(PARSE_BOARD_CMD) $(BOARD_TAG) build.vid 2>/dev/null)
|
USB_PID = $(shell $(PARSE_BOARD_CMD) $(BOARD_TAG) build.pid 2>/dev/null)
|
||||||
endif
|
|
||||||
|
|
||||||
ifndef USB_PID
|
|
||||||
USB_PID = $(shell $(PARSE_BOARD_CMD) $(BOARD_TAG) build.pid 2>/dev/null)
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# normal programming info
|
# normal programming info
|
||||||
|
@ -750,7 +740,7 @@ CPPFLAGS += -mmcu=$(MCU) -DF_CPU=$(F_CPU) -DARDUINO=$(ARDUINO_VERSION) \
|
||||||
-ffunction-sections -fdata-sections
|
-ffunction-sections -fdata-sections
|
||||||
|
|
||||||
# USB IDs for the Leonardo
|
# USB IDs for the Leonardo
|
||||||
ifeq ($(VARIANT),leonardo)
|
ifneq ($(CATERINA),)
|
||||||
CPPFLAGS += -DUSB_VID=$(USB_VID) -DUSB_PID=$(USB_PID)
|
CPPFLAGS += -DUSB_VID=$(USB_VID) -DUSB_PID=$(USB_PID)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
|
@ -13,12 +13,12 @@ my %Opt =
|
||||||
);
|
);
|
||||||
|
|
||||||
GetOptions(\%Opt,
|
GetOptions(\%Opt,
|
||||||
"period=f", # width of reset pulse in seconds
|
"period=f", # width of reset pulse in seconds
|
||||||
"verbose!",
|
"verbose!",
|
||||||
"help!",
|
"help!",
|
||||||
"info!",
|
"info!",
|
||||||
"leonardo!",
|
"caterina!",
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($Opt{help} || $Opt{info})
|
if ($Opt{help} || $Opt{info})
|
||||||
{
|
{
|
||||||
|
@ -33,7 +33,7 @@ foreach my $dev (@ARGV)
|
||||||
my $p = Device::SerialPort->new($dev)
|
my $p = Device::SerialPort->new($dev)
|
||||||
or die "Unable to open $dev: $!\n";
|
or die "Unable to open $dev: $!\n";
|
||||||
|
|
||||||
if ($Opt{leonardo})
|
if ($Opt{caterina})
|
||||||
{
|
{
|
||||||
$p->baudrate(1200);
|
$p->baudrate(1200);
|
||||||
$p->write_settings;
|
$p->write_settings;
|
||||||
|
@ -86,7 +86,7 @@ ard-reset-arduino - Reset an Arduino
|
||||||
|
|
||||||
$ ard-reset-arduino --verbose --period=0.1 /dev/cu.usb*
|
$ ard-reset-arduino --verbose --period=0.1 /dev/cu.usb*
|
||||||
|
|
||||||
$ ard-reset-arduino --verbose --leonardo /dev/ttyUSB0
|
$ ard-reset-arduino --verbose --caterina /dev/ttyUSB0
|
||||||
|
|
||||||
=head1 DESCRIPTION
|
=head1 DESCRIPTION
|
||||||
|
|
||||||
|
@ -108,9 +108,9 @@ Watch what's going on on STDERR.
|
||||||
|
|
||||||
Specify the DTR pulse width in seconds.
|
Specify the DTR pulse width in seconds.
|
||||||
|
|
||||||
=item --leonardo
|
=item --caterina
|
||||||
|
|
||||||
Reset a Leonardo or Micro.
|
Reset a Leonardo, Micro, Robot or LilyPadUSB.
|
||||||
|
|
||||||
=back
|
=back
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue