Skip to content

Commit

Permalink
Teensyduino 1.55 Compatibility (#24)
Browse files Browse the repository at this point in the history
* Teensyduino 1.55 Compatibility

* Update CI software versions

* Update Teensyduino version in README (1.55)

* Update TeensyLoader removal script

The postbuild hook is now "postbuild.1" instead of "postbuild.3". This switches to regex (0-9) to avoid this issue for the future, and will now throw a runtime error if the build hook is not successfully found and removed by the script.
  • Loading branch information
dmadison authored Oct 13, 2021
1 parent c6eecd2 commit 7b1deb6
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 27 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ name: build
on: [push, pull_request, workflow_dispatch]

env:
IDE_VERSION: 1.8.15
TEENSY_VERSION: 154
IDE_VERSION: 1.8.16
TEENSY_VERSION: 155
IDE_LOCATION: /usr/local/share/arduino

jobs:
Expand Down
14 changes: 11 additions & 3 deletions .github/workflows/remove_teensyloader.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
#!/usr/bin/python

import sys
import re

filepath = sys.argv[1]
lines = []
filepath = sys.argv[1] # path of the file to parse
lines = [] # list of lines from the file
removed = False # flag for if the line was removed from the file

with open(filepath, 'r') as f:
lines = f.readlines()

with open(filepath, 'w') as f:
# matching "postbuild" hooks of any number which call the "teensy_post_compile" application
pattern = re.compile("recipe\.hooks\.postbuild\.[0-9]\.pattern=\"{compiler\.path}teensy_post_compile\"")
for line in lines:
if not line.startswith("recipe.hooks.postbuild.3.pattern=\"{compiler.path}teensy_post_compile\""): # remove post-compile trigger
if not pattern.match(line):
f.write(line)
else:
print("Removing line '{}'".format(line.strip('\n')))
removed = True

if not removed:
raise RuntimeError("Did not find a matching line to remove in \"{}\"".format(filepath))
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This is meant to be used in conjunction with the [ArduinoXInput library](https:/

## Installation

You must have both [Arduino](https://www.arduino.cc/en/main/software) and [Teensyduino](https://www.pjrc.com/teensy/td_download.html) installed before proceeding. Double-check that your installed Teensyduino version matches the files provided in this repository. This repository is currently using version [**1.54**](https://www.pjrc.com/teensy/td_154). If you don't know your Teensyduino version, compile a blank sketch with a Teensy board selected and the Teensy Loader will open. In the Teensy Loader window select `Help -> About` and it will tell you the version number. If your version does not match you will have to reinstall or update the Teensyduino software.
You must have both [Arduino](https://www.arduino.cc/en/main/software) and [Teensyduino](https://www.pjrc.com/teensy/td_download.html) installed before proceeding. Double-check that your installed Teensyduino version matches the files provided in this repository. This repository is currently using version [**1.55**](https://www.pjrc.com/teensy/td_155). If you don't know your Teensyduino version, compile a blank sketch with a Teensy board selected and the Teensy Loader will open. In the Teensy Loader window select `Help -> About` and it will tell you the version number. If your version does not match you will have to reinstall or update the Teensyduino software.

Navigate to your Arduino installation directory and open up the 'hardware' folder. It is recommended that you make a backup of this folder before proceeding in case something goes wrong or if you want to revert the installation.

Expand Down
29 changes: 19 additions & 10 deletions teensy/avr/boards.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ menu.opt=Optimize
menu.keys=Keyboard Layout


# TODO: consider whether these compiler warnings are worthwhile
# -Wno-error=unused-function
# -Wno-error=unused-but-set-variable
# -Wno-error=unused-variable
# -Wno-unused-parameter
# -Wno-unused-but-set-parameter
# -Wno-sign-compare


teensy41.name=Teensy 4.1
#teensy41.upload.maximum_size=8126464
teensy41.build.board=TEENSY41
Expand All @@ -26,7 +35,7 @@ teensy41.build.flags.common=-g -Wall -ffunction-sections -fdata-sections -nostdl
teensy41.build.flags.dep=-MMD
teensy41.build.flags.optimize=-Os
teensy41.build.flags.cpu=-mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16
teensy41.build.flags.defs=-D__IMXRT1062__ -DTEENSYDUINO=154
teensy41.build.flags.defs=-D__IMXRT1062__ -DTEENSYDUINO=155
teensy41.build.flags.cpp=-std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing
teensy41.build.flags.c=
teensy41.build.flags.S=-x assembler-with-cpp
Expand Down Expand Up @@ -226,7 +235,7 @@ teensyMM.build.flags.common=-g -Wall -ffunction-sections -fdata-sections -nostdl
teensyMM.build.flags.dep=-MMD
teensyMM.build.flags.optimize=-Os
teensyMM.build.flags.cpu=-mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16
teensyMM.build.flags.defs=-D__IMXRT1062__ -DTEENSYDUINO=154
teensyMM.build.flags.defs=-D__IMXRT1062__ -DTEENSYDUINO=155
teensyMM.build.flags.cpp=-std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing
teensyMM.build.flags.c=
teensyMM.build.flags.S=-x assembler-with-cpp
Expand Down Expand Up @@ -426,7 +435,7 @@ teensy40.build.flags.common=-g -Wall -ffunction-sections -fdata-sections -nostdl
teensy40.build.flags.dep=-MMD
teensy40.build.flags.optimize=-Os
teensy40.build.flags.cpu=-mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16
teensy40.build.flags.defs=-D__IMXRT1062__ -DTEENSYDUINO=154
teensy40.build.flags.defs=-D__IMXRT1062__ -DTEENSYDUINO=155
teensy40.build.flags.cpp=-std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing
teensy40.build.flags.c=
teensy40.build.flags.S=-x assembler-with-cpp
Expand Down Expand Up @@ -622,7 +631,7 @@ teensy36.build.flags.common=-g -Wall -ffunction-sections -fdata-sections -nostdl
teensy36.build.flags.dep=-MMD
teensy36.build.flags.optimize=-Os
teensy36.build.flags.cpu=-mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -fsingle-precision-constant
teensy36.build.flags.defs=-D__MK66FX1M0__ -DTEENSYDUINO=154
teensy36.build.flags.defs=-D__MK66FX1M0__ -DTEENSYDUINO=155
teensy36.build.flags.cpp=-fno-exceptions -fpermissive -felide-constructors -std=gnu++14 -Wno-error=narrowing -fno-rtti
teensy36.build.flags.c=
teensy36.build.flags.S=-x assembler-with-cpp
Expand Down Expand Up @@ -834,7 +843,7 @@ teensy35.build.flags.common=-g -Wall -ffunction-sections -fdata-sections -nostdl
teensy35.build.flags.dep=-MMD
teensy35.build.flags.optimize=-Os
teensy35.build.flags.cpu=-mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -fsingle-precision-constant
teensy35.build.flags.defs=-D__MK64FX512__ -DTEENSYDUINO=154
teensy35.build.flags.defs=-D__MK64FX512__ -DTEENSYDUINO=155
teensy35.build.flags.cpp=-fno-exceptions -fpermissive -felide-constructors -std=gnu++14 -Wno-error=narrowing -fno-rtti
teensy35.build.flags.c=
teensy35.build.flags.S=-x assembler-with-cpp
Expand Down Expand Up @@ -1036,7 +1045,7 @@ teensy31.build.flags.common=-g -Wall -ffunction-sections -fdata-sections -nostdl
teensy31.build.flags.dep=-MMD
teensy31.build.flags.optimize=-Os
teensy31.build.flags.cpu=-mthumb -mcpu=cortex-m4 -fsingle-precision-constant
teensy31.build.flags.defs=-D__MK20DX256__ -DTEENSYDUINO=154
teensy31.build.flags.defs=-D__MK20DX256__ -DTEENSYDUINO=155
teensy31.build.flags.cpp=-fno-exceptions -fpermissive -felide-constructors -std=gnu++14 -Wno-error=narrowing -fno-rtti
teensy31.build.flags.c=
teensy31.build.flags.S=-x assembler-with-cpp
Expand Down Expand Up @@ -1249,7 +1258,7 @@ teensy30.build.flags.common=-g -Wall -ffunction-sections -fdata-sections -nostdl
teensy30.build.flags.dep=-MMD
teensy30.build.flags.optimize=-Os
teensy30.build.flags.cpu=-mthumb -mcpu=cortex-m4 -fsingle-precision-constant
teensy30.build.flags.defs=-D__MK20DX128__ -DTEENSYDUINO=154
teensy30.build.flags.defs=-D__MK20DX128__ -DTEENSYDUINO=155
teensy30.build.flags.cpp=-fno-exceptions -fpermissive -felide-constructors -std=gnu++14 -Wno-error=narrowing -fno-rtti
teensy30.build.flags.c=
teensy30.build.flags.S=-x assembler-with-cpp
Expand Down Expand Up @@ -1408,7 +1417,7 @@ teensyLC.build.command.size=arm-none-eabi-size
teensyLC.build.flags.common=-g -Wall -ffunction-sections -fdata-sections -nostdlib -mno-unaligned-access
teensyLC.build.flags.dep=-MMD
teensyLC.build.flags.cpu=-mthumb -mcpu=cortex-m0plus -fsingle-precision-constant
teensyLC.build.flags.defs=-D__MKL26Z64__ -DTEENSYDUINO=154
teensyLC.build.flags.defs=-D__MKL26Z64__ -DTEENSYDUINO=155
teensyLC.build.flags.cpp=-fno-exceptions -fpermissive -felide-constructors -std=gnu++14 -Wno-error=narrowing -fno-rtti
teensyLC.build.flags.c=
teensyLC.build.flags.S=-x assembler-with-cpp
Expand Down Expand Up @@ -1566,7 +1575,7 @@ teensypp2.build.flags.common=-g -Wall -ffunction-sections -fdata-sections
teensypp2.build.flags.dep=-MMD
teensypp2.build.flags.optimize=-Os
teensypp2.build.flags.cpu=-mmcu=at90usb1286
teensypp2.build.flags.defs=-DTEENSYDUINO=154 -DARDUINO_ARCH_AVR
teensypp2.build.flags.defs=-DTEENSYDUINO=155 -DARDUINO_ARCH_AVR
teensypp2.build.flags.cpp=-fno-exceptions -fpermissive -felide-constructors -std=gnu++11
teensypp2.build.flags.c=
teensypp2.build.flags.S=-x assembler-with-cpp
Expand Down Expand Up @@ -1683,7 +1692,7 @@ teensy2.build.flags.common=-g -Wall -ffunction-sections -fdata-sections
teensy2.build.flags.dep=-MMD
teensy2.build.flags.optimize=-Os
teensy2.build.flags.cpu=-mmcu=atmega32u4
teensy2.build.flags.defs=-DTEENSYDUINO=154 -DARDUINO_ARCH_AVR
teensy2.build.flags.defs=-DTEENSYDUINO=155 -DARDUINO_ARCH_AVR
teensy2.build.flags.cpp=-fno-exceptions -fpermissive -felide-constructors -std=gnu++11
teensy2.build.flags.c=
teensy2.build.flags.S=-x assembler-with-cpp
Expand Down
23 changes: 12 additions & 11 deletions teensy/avr/cores/teensy3/usb_serial.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,17 +76,18 @@ class usb_serial_class : public Stream
public:
constexpr usb_serial_class() {}
void begin(long) {
//uint32_t millis_begin = systick_millis_count;
//disabled for now - causes more trouble than it solves?
//while (!(*this)) {
// wait up to 2.5 seconds for Arduino Serial Monitor
// Yes, this is a long time, but some Windows systems open
// the port very slowly. This wait allows programs for
// Arduino Uno to "just work" (without forcing a reboot when
// the port is opened), and when no PC is connected the user's
// sketch still gets to run normally after this wait time.
//if ((uint32_t)(systick_millis_count - millis_begin) > 2500) break;
//}
uint32_t millis_begin = systick_millis_count;
while (!(*this)) {
uint32_t elapsed = systick_millis_count - millis_begin;
if (usb_configuration) {
// Wait up to 2 seconds for Arduino Serial Monitor
if (elapsed > 2000) break;
} else {
// But wait only 3/4 second if there is no sign the
// USB host has begun the USB enumeration process.
if (elapsed > 750) break;
}
}
}
void end() { /* TODO: flush output and shut down USB port */ };
virtual int available() { return usb_serial_available(); }
Expand Down

0 comments on commit 7b1deb6

Please sign in to comment.