From 3a54ca3e7d5efd7a443c354bd549ed3bc9f7e9ec Mon Sep 17 00:00:00 2001 From: hathach Date: Tue, 5 Nov 2019 16:34:41 +0700 Subject: [PATCH 1/9] Update issue templates --- .github/ISSUE_TEMPLATE/bug_report.md | 2 +- .github/ISSUE_TEMPLATE/feature_request.md | 2 +- .../ISSUE_TEMPLATE/questions-please-use-our-forum-support.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 90d542fc..c0da5fb9 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -1,7 +1,7 @@ --- name: Bug report about: Create a report to help us improve -title: "[Bug]" +title: '' labels: Bug assignees: '' diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index ae3f7c98..e74cb57f 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -1,7 +1,7 @@ --- name: Feature request about: Suggest an idea for this project -title: "[Feature]" +title: '' labels: Feature assignees: '' diff --git a/.github/ISSUE_TEMPLATE/questions-please-use-our-forum-support.md b/.github/ISSUE_TEMPLATE/questions-please-use-our-forum-support.md index c4148946..18c7bf76 100644 --- a/.github/ISSUE_TEMPLATE/questions-please-use-our-forum-support.md +++ b/.github/ISSUE_TEMPLATE/questions-please-use-our-forum-support.md @@ -2,7 +2,7 @@ name: Questions please use our forum support about: Don't open issue, post your question at forums.adafruit.com title: '' -labels: '' +labels: wontfix assignees: '' --- From 6031e4f2ccc1152e6b490ea9efe7c54ecda7b012 Mon Sep 17 00:00:00 2001 From: Henry Gabryjelski Date: Mon, 4 Nov 2019 20:10:54 -0800 Subject: [PATCH 2/9] Reduce build log output and add "/Wall" build jobs. Workaround for Arduino mDNS output noise using IPTABLES. See https://forum.arduino.cc/index.php?topic=469428.0 See https://github.com/per1234/arduino-ci-script/issues/1 Arduino IDE adds a lot of noise caused by network traffic (mDNS?), because it's listening for network-attached devices. Firewall it in the TravisCI environment to cleanup logs. Allow jobs with all warnings enabled to fail. This enables the build to occur, and review of warnings, without requiring these builds to be clean of warnings. Also, only outputs the error logs (not full build logs) for these build options. This is a critical step towards getting to 100% warning-free builds, without interrupting current processes. --- .travis.yml | 38 ++++++++++++++++++++++++++---- tools/build_all.py | 58 +++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 89 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 529a4e46..a5ecd7d2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,4 @@ +sudo: required language: c dist: xenial git: @@ -8,10 +9,28 @@ env: global: - BSP_PATH="$HOME/.arduino15/packages/adafruit/hardware/nrf52" jobs: - # Split into one job per board (aka variant) - - VARIANT="feather52840" - - VARIANT="cplaynrf52840" - - VARIANT="feather52832" + # empty env required, else allow_failures will SILENTY IGNORE matching against env... + - + +jobs: + fast_finish: true + include: + - name: "Feather 52840" + env: VARIANT="feather52840" + - name: "Feather 52840 (All warnings)" + env: ALL_WARNINGS="true" VARIANT="feather52840" + - name: "Circuit Playground 52840" + env: VARIANT="cplaynrf52840" + - name: "Circuit Playground 52840 (All warnings)" + env: ALL_WARNINGS="true" VARIANT="cplaynrf52840" + - name: "Feather 52832" + env: VARIANT="feather52832" + - name: "Feather 52832 (All warnings)" + env: ALL_WARNINGS="true" VARIANT="feather52832" + allow_failures: + - env: ALL_WARNINGS="true" VARIANT="feather52840" + - env: ALL_WARNINGS="true" VARIANT="cplaynrf52840" + - env: ALL_WARNINGS="true" VARIANT="feather52832" addons: apt: @@ -34,6 +53,17 @@ install: - rm -r $BSP_PATH/* - ln -s $TRAVIS_BUILD_DIR $BSP_PATH/$BSP_VERSION - arduino --install-library "Adafruit NeoPixel","Adafruit NeoMatrix","Adafruit GFX Library","Adafruit SSD1306","MIDI Library","Adafruit ILI9341","Adafruit HX8357 Library" + # TODO: find way to filter out the noisy mDNS output from arduino IDE... + # See https://forum.arduino.cc/index.php?topic=469428.0 + # See https://github.com/per1234/arduino-ci-script/issues/1 + # Arduino IDE adds a lot of noise caused by network traffic (mDNS?) + # The following lines attempt to firewall it to prevent polluted error logs.... + - sudo iptables -P INPUT DROP + - sudo iptables -P FORWARD DROP + - sudo iptables -P OUTPUT ACCEPT + - sudo iptables -A INPUT -i lo -j ACCEPT + - sudo iptables -A OUTPUT -o lo -j ACCEPT + - sudo iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT before_script: diff --git a/tools/build_all.py b/tools/build_all.py index f0d01f57..ab510ceb 100644 --- a/tools/build_all.py +++ b/tools/build_all.py @@ -8,6 +8,13 @@ travis = False if "TRAVIS" in os.environ and os.environ["TRAVIS"] == "true": travis = True +all_warnings = False +if "ALL_WARNINGS" in os.environ and os.environ["ALL_WARNINGS"] == "true": + all_warnings = True + +ENV_VARIABLE_NAME = 'VARIANT' + + exit_status = 0 success_count = 0 fail_count = 0 @@ -21,6 +28,25 @@ variants_dict = { 'feather52832': 'Feather nRF52832' } +# STDERR receives output that starts with the following text, none of which should be considered a warning or error... +output_to_ignore = ( + 'Picked up JAVA_TOOL_OPTIONS:', + 'Loading configuration...', + 'Initializing packages...', + 'Preparing boards...', + 'Verifying...', +) + +def errorOutputFilter(line): + if len(line) == 0: + return False + if line.isspace(): # Note: empty string does not match here! + return False + if line.startswith(output_to_ignore): # alternatively, can trim() each line, but that would create lots of short-lived strings... + return False + # TODO: additional items to remove? + return True + def build_examples(variant): global exit_status, success_count, fail_count, build_format, build_separator @@ -33,6 +59,10 @@ def build_examples(variant): print(build_separator) subprocess.run("arduino --board adafruit:nrf52:{}:softdevice={},debug=l0 --save-prefs".format(variant, 's140v6' if variant != 'feather52832' else 's132v6'), shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + + if all_warnings: + subprocess.run("arduino --pref 'compiler.warning_level=all' --save-prefs", shell=True, + stdout=subprocess.PIPE, stderr=subprocess.STDOUT) for sketch in glob.iglob('libraries/**/*.ino', recursive=True): start_time = time.monotonic() @@ -40,11 +70,28 @@ def build_examples(variant): if os.path.exists(os.path.dirname(sketch) + '/.skip') or os.path.exists(os.path.dirname(sketch) + '/.skip.' + variant): success = "skipped" else: - build_result = subprocess.run("arduino --verify {}".format(sketch), shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + # TODO - preferably, would have STDERR show up in **both** STDOUT and STDERR. + # preferably, would use Python logging handler to get both distinct outputs and one merged output + # for now, split STDERR when building with all warnings enabled, so can detect warning/error output. + if all_warnings: + build_result = subprocess.run("arduino --verify {}".format(sketch), shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + else: + build_result = subprocess.run("arduino --verify {}".format(sketch), shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + + # get stderr into a form where len(warningLines) indicates a true warning was output to stderr + warningLines = []; + if all_warnings and build_result.stderr: + tmpWarningLines = build_result.stderr.decode("utf-8").splitlines() + warningLines = list(filter(errorOutputFilter, (tmpWarningLines))) + if build_result.returncode != 0: exit_status = build_result.returncode success = "\033[31mfailed\033[0m " fail_count += 1 + elif len(warningLines) != 0: + exit_status = -1 + success = "\033[31mwarnings\033[0m " + fail_count += 1 else: success = "\033[32msucceeded\033[0m" success_count += 1 @@ -58,6 +105,12 @@ def build_examples(variant): if build_result.returncode != 0: print(build_result.stdout.decode("utf-8")) + if (build_result.stderr): + print(build_result.stderr.decode("utf-8")) + + if len(warningLines) != 0: + for line in warningLines: + print(line) if travis: print('travis_fold:end:build-{}\\r'.format(sketch)) @@ -65,7 +118,6 @@ def build_examples(variant): build_time = time.monotonic() -ENV_VARIABLE_NAME = 'VARIANT' # build only one variant if the environment variable is specified if (ENV_VARIABLE_NAME in os.environ): @@ -74,7 +126,7 @@ if (ENV_VARIABLE_NAME in os.environ): if (variant in variants_dict): build_examples(variant) else: - print('\033[31failed\033[0m - invalid variant name "{}"'.format(variant)) + print('\033[31INTERNAL ERR\033[0m - invalid variant name "{}"'.format(variant)) fail_count += 1 exit_status = -1 From 157ac1583498438c138201577a1ec0211d070cbb Mon Sep 17 00:00:00 2001 From: Henry Gabryjelski Date: Mon, 4 Nov 2019 22:37:27 -0800 Subject: [PATCH 3/9] Ensure print current sketch output only. When skipping a sketch, would previously show the build output from the prior sketch. This may also have caused a build error if the first sketch was skipped (unverified). --- tools/build_all.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tools/build_all.py b/tools/build_all.py index ab510ceb..38f1a293 100644 --- a/tools/build_all.py +++ b/tools/build_all.py @@ -103,14 +103,14 @@ def build_examples(variant): print((build_format + '| {:5.2f}s |').format(sketch.split(os.path.sep)[1], os.path.basename(sketch), success, build_duration)) - if build_result.returncode != 0: - print(build_result.stdout.decode("utf-8")) - if (build_result.stderr): - print(build_result.stderr.decode("utf-8")) - - if len(warningLines) != 0: - for line in warningLines: - print(line) + if success != "skipped": + if build_result.returncode != 0: + print(build_result.stdout.decode("utf-8")) + if (build_result.stderr): + print(build_result.stderr.decode("utf-8")) + if len(warningLines) != 0: + for line in warningLines: + print(line) if travis: print('travis_fold:end:build-{}\\r'.format(sketch)) From a441f0ececf4f4effa957db3be4a5047f12f46e7 Mon Sep 17 00:00:00 2001 From: Henry Gabryjelski Date: Thu, 7 Nov 2019 17:03:29 -0800 Subject: [PATCH 4/9] Reduce impact of firewall rules This modification reduces the IPTABLES rules to the minimum needed. Specifically, it does NOT create default rules, or edit any existing rules. Instead, it only adds rules to drop mDNS at 5353/udp, and to drop all incoming traffic that's addressed to the mDNS multicast IP address. --- .travis.yml | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/.travis.yml b/.travis.yml index a5ecd7d2..b864978e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -43,6 +43,10 @@ addons: confinement: classic install: + # Filter only mDNS / Bonjour traffic + - sudo iptables --insert INPUT --jump DROP --protocol udp --dport 5353 -m comment --comment "silently drop all 5353/udp input" + - sudo iptables --insert INPUT --jump DROP --destination 224.0.0.251 -m comment --comment "silently drop all mDNS ipv4 broadcast" + # Install the nRF52 support files for arduino - pip3 install --user adafruit-nrfutil - umake electronics arduino $HOME/arduino_ide - export PATH=$HOME/arduino_ide:$PATH @@ -53,17 +57,6 @@ install: - rm -r $BSP_PATH/* - ln -s $TRAVIS_BUILD_DIR $BSP_PATH/$BSP_VERSION - arduino --install-library "Adafruit NeoPixel","Adafruit NeoMatrix","Adafruit GFX Library","Adafruit SSD1306","MIDI Library","Adafruit ILI9341","Adafruit HX8357 Library" - # TODO: find way to filter out the noisy mDNS output from arduino IDE... - # See https://forum.arduino.cc/index.php?topic=469428.0 - # See https://github.com/per1234/arduino-ci-script/issues/1 - # Arduino IDE adds a lot of noise caused by network traffic (mDNS?) - # The following lines attempt to firewall it to prevent polluted error logs.... - - sudo iptables -P INPUT DROP - - sudo iptables -P FORWARD DROP - - sudo iptables -P OUTPUT ACCEPT - - sudo iptables -A INPUT -i lo -j ACCEPT - - sudo iptables -A OUTPUT -o lo -j ACCEPT - - sudo iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT before_script: From 404faa95856b2734e7ce904ce518b79027136f23 Mon Sep 17 00:00:00 2001 From: Henry Gabryjelski Date: Fri, 8 Nov 2019 00:44:51 -0800 Subject: [PATCH 5/9] Fix #378: [-Wunused-variable] --- .../examples/Central/central_throughput/central_throughput.ino | 1 + 1 file changed, 1 insertion(+) diff --git a/libraries/Bluefruit52Lib/examples/Central/central_throughput/central_throughput.ino b/libraries/Bluefruit52Lib/examples/Central/central_throughput/central_throughput.ino index ff505fbb..6dec27c9 100644 --- a/libraries/Bluefruit52Lib/examples/Central/central_throughput/central_throughput.ino +++ b/libraries/Bluefruit52Lib/examples/Central/central_throughput/central_throughput.ino @@ -133,6 +133,7 @@ void disconnect_callback(uint16_t conn_handle, uint8_t reason) void bleuart_rx_callback(BLEClientUart& uart_svc) { int count = uart_svc.available(); + (void)count; uart_svc.flush(); } From a5305b27b24c391cad34fbaec7e17328d354a580 Mon Sep 17 00:00:00 2001 From: Henry Gabryjelski Date: Fri, 8 Nov 2019 00:48:46 -0800 Subject: [PATCH 6/9] Fix #379 [-Wsign-compare] comparison between signed and unsigned integer expressions Fixed by using unsigned integers and adjusting check for first index. --- .../examples/Peripheral/blemidi/blemidi.ino | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/libraries/Bluefruit52Lib/examples/Peripheral/blemidi/blemidi.ino b/libraries/Bluefruit52Lib/examples/Peripheral/blemidi/blemidi.ino index 2dd581e2..d455b8c4 100644 --- a/libraries/Bluefruit52Lib/examples/Peripheral/blemidi/blemidi.ino +++ b/libraries/Bluefruit52Lib/examples/Peripheral/blemidi/blemidi.ino @@ -28,7 +28,7 @@ BLEMidi blemidi; MIDI_CREATE_BLE_INSTANCE(blemidi); // Variable that holds the current position in the sequence. -int position = 0; +unsigned int position = 0; // Store example melody as an array of note values byte note_sequence[] = { @@ -137,14 +137,10 @@ void loop() // Setup variables for the current and previous // positions in the note sequence. - int current = position; - int previous = position - 1; - + unsigned int current = position; // If we currently are at position 0, set the // previous position to the last note in the sequence. - if (previous < 0) { - previous = sizeof(note_sequence) - 1; - } + unsigned int previous = (current == 0) ? (sizeof(note_sequence)-1) : current - 1; // Send Note On for current position at full velocity (127) on channel 1. MIDI.sendNoteOn(note_sequence[current], 127, 1); From e77217c5bf21b04b63e0cf4a1a9326d93cc87660 Mon Sep 17 00:00:00 2001 From: Henry Gabryjelski Date: Fri, 8 Nov 2019 01:12:26 -0800 Subject: [PATCH 7/9] Fix #382: [-Wsign-compare] comparison between signed and unsigned integer expressions Use uint32_t to store timestamp instead of int32_t. Adjust comparison to use timestamp as a zero-basis. This also avoids a bugs where a record that is added just before millis() overflows would never be removed from the list. --- .../rssi_proximity_central/rssi_proximity_central.ino | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libraries/Bluefruit52Lib/examples/Projects/rssi_proximity/rssi_proximity_central/rssi_proximity_central.ino b/libraries/Bluefruit52Lib/examples/Projects/rssi_proximity/rssi_proximity_central/rssi_proximity_central.ino index 10e03f03..db77fb84 100644 --- a/libraries/Bluefruit52Lib/examples/Projects/rssi_proximity/rssi_proximity_central/rssi_proximity_central.ino +++ b/libraries/Bluefruit52Lib/examples/Projects/rssi_proximity/rssi_proximity_central/rssi_proximity_central.ino @@ -128,10 +128,10 @@ BLEUuid uuid = BLEUuid(CUSTOM_UUID); /* This struct is used to track detected nodes */ typedef struct node_record_s { - uint8_t addr[6]; // Six byte device address - int8_t rssi; // RSSI value - int32_t timestamp; // Timestamp for invalidation purposes - int8_t reserved; // Padding for word alignment + uint8_t addr[6]; // Six byte device address + int8_t rssi; // RSSI value + uint32_t timestamp; // Timestamp for invalidation purposes + int8_t reserved; // Padding for word alignment } node_record_t; node_record_t records[ARRAY_SIZE]; @@ -530,7 +530,7 @@ int invalidateRecords(void) { if (records[i].timestamp) // Ignore zero"ed records { - if (records[i].timestamp <= millis() - TIMEOUT_MS) + if (millis() - records[i].timestamp >= TIMEOUT_MS) { /* Record has expired, zero it out */ memset(&records[i], 0, sizeof(node_record_t)); From 8e3c1cb13c9479b1ceed320feaa70425fb0a537f Mon Sep 17 00:00:00 2001 From: Henry Gabryjelski Date: Fri, 8 Nov 2019 01:13:39 -0800 Subject: [PATCH 8/9] Fix #380 [-Wunused-variable] --- .../central_ti_sensortag_optical.ino | 3 --- 1 file changed, 3 deletions(-) diff --git a/libraries/Bluefruit52Lib/examples/Central/central_ti_sensortag_optical/central_ti_sensortag_optical.ino b/libraries/Bluefruit52Lib/examples/Central/central_ti_sensortag_optical/central_ti_sensortag_optical.ino index 2edaf871..38a2c0e3 100644 --- a/libraries/Bluefruit52Lib/examples/Central/central_ti_sensortag_optical/central_ti_sensortag_optical.ino +++ b/libraries/Bluefruit52Lib/examples/Central/central_ti_sensortag_optical/central_ti_sensortag_optical.ino @@ -167,9 +167,6 @@ void connect_callback(uint16_t conn_handle) Serial.print("Connect Callback, conn_handle: "); Serial.println( conn_handle ); - /* Complete Local Name */ - uint8_t buffer[BLE_GAP_ADV_SET_DATA_SIZE_MAX] = { 0 }; - // If Service is not found, disconnect and return Serial.print("Discovering Optical Service ... "); if ( !sensorTagOpticalService.discover(conn_handle) ) From 93e409ba386ec007e4521210d2010569a264a45d Mon Sep 17 00:00:00 2001 From: samveen Date: Mon, 16 Dec 2019 22:41:15 +0530 Subject: [PATCH 9/9] [tusb]fix typo in comment --- cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/class/hid/hid.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/class/hid/hid.h b/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/class/hid/hid.h index a3a9ffc8..cb5e6047 100644 --- a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/class/hid/hid.h +++ b/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/class/hid/hid.h @@ -180,7 +180,7 @@ typedef enum /// Standard HID Boot Protocol Keyboard Report. typedef struct TU_ATTR_PACKED { - uint8_t modifier; /**< Keyboard modifier (KEYBOARD_MODIFER_* masks). */ + uint8_t modifier; /**< Keyboard modifier (KEYBOARD_MODIFIER_* masks). */ uint8_t reserved; /**< Reserved for OEM use, always set to 0. */ uint8_t keycode[6]; /**< Key codes of the currently pressed keys. */ } hid_keyboard_report_t;