Skip to content

Commit 2037467

Browse files
authored
Update tinyusb library to compatible with 1.2.0 (arduino#303)
* more Adafruit_TinyUSB include * add metro m0 m4 with tinyusb to ci * correct fqbn * support ci with tinyusb variant bump zeroDMA and fix warnings with USBHost library example * install missing libraries * more libraries * update tinyusb library to 1.2.0 increase version to 1.7.3
1 parent 4e51791 commit 2037467

File tree

9 files changed

+34
-113
lines changed

9 files changed

+34
-113
lines changed

.github/workflows/githubci.yml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ jobs:
1919
- 'pyportal_m4'
2020
- 'pyportal_m4_titano'
2121
- 'feather_m4_can'
22+
- 'metro_m0:usbstack=tinyusb'
23+
- 'metro_m4:speed=120,usbstack=tinyusb'
2224

2325
runs-on: ubuntu-latest
2426

@@ -30,14 +32,9 @@ jobs:
3032

3133
- name: Checkout code
3234
uses: actions/checkout@v2
35+
with:
36+
submodules: 'true'
3337

34-
- name: Checkout submodules
35-
shell: bash
36-
run: |
37-
auth_header="$(git config --local --get http.https://github.com/.extraheader)"
38-
git submodule sync --recursive
39-
git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive
40-
4138
- name: Install Arduino CLI and Tools
4239
run: |
4340
# make all our directories we need for files and libraries
@@ -52,7 +49,6 @@ jobs:
5249
env:
5350
BSP_URL: https://adafruit.github.io/arduino-board-index/package_adafruit_index.json
5451
BSP_PATH: .arduino15/packages/adafruit/hardware/samd
55-
LIB_DEPS: FlashStorage SD
5652
run: |
5753
arduino-cli config init
5854
arduino-cli core update-index
@@ -63,7 +59,7 @@ jobs:
6359
BSP_VERSION=`eval ls $HOME/$BSP_PATH`
6460
rm -r $HOME/$BSP_PATH/*
6561
ln -s $GITHUB_WORKSPACE $HOME/$BSP_PATH/$BSP_VERSION
66-
arduino-cli lib install $LIB_DEPS
62+
arduino-cli lib install "Adafruit NeoPixel" "Adafruit seesaw Library" "Adafruit SPIFlash" "FlashStorage" "MIDI Library" "SD" "SdFat - Adafruit Fork"
6763
6864
- name: Build examples
6965
run: python3 extras/build_all.py ${{ matrix.board }}

cores/arduino/tusb_config.h

Lines changed: 0 additions & 93 deletions
This file was deleted.

extras/build_all.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,13 @@
1515
fail_count = 0
1616
skip_count = 0
1717

18-
build_format = '| {:20} | {:35} | {:18} | {:6} |'
19-
build_separator = '-' * 83
18+
build_format = '| {:25} | {:35} | {:18} | {:6} |'
19+
build_separator = '-' * 88
2020

2121
FQBN_PREFIX='adafruit:samd:adafruit_'
2222

23-
default_boards = [ 'metro_m0', 'metro_m4', 'circuitplayground_m0', 'feather_m4_can' ]
23+
#default_boards = [ 'metro_m0', 'metro_m4', 'circuitplayground_m0', 'feather_m4_can', 'metro_m0:usbstack=tinyusb', 'metro_m4:speed=120,usbstack=tinyusb' ]
24+
default_boards = [ 'metro_m0', 'metro_m0:usbstack=tinyusb' ]
2425
build_boards = []
2526

2627
# build all variants if input not existed
@@ -37,18 +38,14 @@ def build_examples(variant):
3738

3839
print('\n')
3940
print(build_separator)
40-
print('| {:^79} |'.format('Board ' + variant))
41+
print('| {:^84} |'.format('Board ' + variant))
4142
print(build_separator)
4243
print(build_format.format('Library', 'Example', '\033[39mResult\033[0m', 'Time'))
4344
print(build_separator)
4445

4546
fqbn = "{}{}".format(FQBN_PREFIX, variant)
4647

4748
for sketch in all_examples:
48-
# TODO skip TinyUSB library examples for now
49-
if "libraries/Adafruit_TinyUSB_Arduino" in sketch:
50-
continue
51-
5249
start_time = time.monotonic()
5350

5451
# Skip if contains: ".board.test.skip" or ".all.test.skip"
@@ -60,6 +57,14 @@ def build_examples(variant):
6057
elif glob.glob(sketchdir+"/.*.test.only") and not os.path.exists(sketchdir + '/.' + variant + '.test.only'):
6158
success = SKIPPED
6259
skip_count += 1
60+
elif 'usbstack=tinyusb' not in variant and "libraries/Adafruit_TinyUSB_Arduino" in sketch:
61+
# skip non-tinyusb variant for tinyusb examples
62+
success = SKIPPED
63+
skip_count += 1
64+
elif 'usbstack=tinyusb' in variant and "libraries/USBHost" in sketch:
65+
# skip -tinyusb variant for USBHost examples
66+
success = SKIPPED
67+
skip_count += 1
6368
else:
6469
build_result = subprocess.run("arduino-cli compile --warnings all --fqbn {} {}".format(fqbn, sketch), shell=True, stdout=PIPE, stderr=PIPE)
6570

libraries/Adafruit_TinyUSB_Arduino

libraries/I2S/src/I2S.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ static I2SDevice_SAMD21G18x i2sd(*I2S);
3737

3838
#include "I2S.h"
3939

40+
#ifdef USE_TINYUSB
41+
// For Serial when selecting TinyUSB
42+
#include <Adafruit_TinyUSB.h>
43+
#endif
44+
45+
4046
int I2SClass::_beginCount = 0;
4147

4248
I2SClass::I2SClass(uint8_t deviceIndex, uint8_t clockGenerator, uint8_t sdPin, uint8_t sckPin, uint8_t fsPin) :

libraries/Servo/src/samd/Servo.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@
2121
#include <Arduino.h>
2222
#include <Servo.h>
2323

24+
#ifdef USE_TINYUSB
25+
// For Serial when selecting TinyUSB
26+
#include <Adafruit_TinyUSB.h>
27+
#endif
28+
2429
#if defined(__SAMD51__)
2530
// Different prescalers depending on FCPU (avoid overflowing 16-bit counter)
2631
#if(F_CPU > 200000000)

libraries/USBHost/examples/USB_desc/USB_desc.ino

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ byte getconfdescr( byte addr, byte conf )
216216
uint16_t total_length;
217217
// FIXME -- no check of return code from usb.getConfDescr()
218218
rcode = usb.getConfDescr( addr, 0, 4, conf, buf ); //get total length
219+
(void) rcode;
219220
LOBYTE( total_length ) = buf[ 2 ];
220221
HIBYTE( total_length ) = buf[ 3 ];
221222
if( total_length > sizeof(buf)) { //check if total length is larger than buffer
@@ -224,6 +225,7 @@ byte getconfdescr( byte addr, byte conf )
224225
}
225226
// FIXME -- no check of return code from usb.getConfDescr()
226227
rcode = usb.getConfDescr( addr, 0, total_length, conf, buf ); //get the whole descriptor
228+
(void) rcode;
227229
while( buf_ptr < buf + total_length ) { //parsing descriptors
228230
descr_length = *( buf_ptr );
229231
descr_type = *( buf_ptr + 1 );

platform.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
# https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5---3rd-party-Hardware-specification
2121

2222
name=Adafruit SAMD (32-bits ARM Cortex-M0+ and Cortex-M4) Boards
23-
version=1.7.2
23+
version=1.7.3
2424

2525
# Compile variables
2626
# -----------------

0 commit comments

Comments
 (0)