From 756449794dc39d3897bc0fb7458907d0e30a4351 Mon Sep 17 00:00:00 2001 From: Advait Jain Date: Mon, 14 Dec 2020 14:13:51 -0800 Subject: [PATCH 01/14] Add check to ensure that files in tensorflow/lite/micro have proper license. Fixes http://b/175315163 --- .../lite/micro/tools/ci_build/test_all.sh | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tensorflow/lite/micro/tools/ci_build/test_all.sh b/tensorflow/lite/micro/tools/ci_build/test_all.sh index fd6b384eb9b6bd..97ffe0980ad839 100755 --- a/tensorflow/lite/micro/tools/ci_build/test_all.sh +++ b/tensorflow/lite/micro/tools/ci_build/test_all.sh @@ -33,6 +33,36 @@ if [ -d tensorflow/lite/micro/tools/make/downloads ]; then exit 1 fi +# explicitly call third_party_downloads since we need pigweed for the license +# and clang-format checks. +make -f tensorflow/lite/micro/tools/make/Makefile third_party_downloads + +# Check for license with the necessary exclusions. +tensorflow/lite/micro/tools/make/downloads/pigweed/pw_presubmit/py/pw_presubmit/pigweed_presubmit.py \ + tensorflow/lite/micro \ + -p copyright_notice \ + -e micro/tools/make/targets/ecm3531 \ + -e BUILD\ + -e leon_commands \ + -e Makefile \ + -e "\.bzl" \ + -e "\.cmd" \ + -e "\.cmd" \ + -e "\.conf" \ + -e "\.defaults" \ + -e "\.h5" \ + -e "\.ipynb" \ + -e "\.inc" \ + -e "\.lcf" \ + -e "\.ld" \ + -e "\.lds" \ + -e "\.projbuild" \ + -e "\.properties" \ + -e "\.resc" \ + -e "\.robot" \ + -e "\.txt" \ + -e "\.tpl" \ + --output-directory /tmp # We are moving away from having the downloads and installations be part of the # Makefile. As a result, we need to manually add the downloads in this script. From 7a60c64318cea23b1c2fe175d1ae8ceab9ccd797 Mon Sep 17 00:00:00 2001 From: Advait Jain Date: Mon, 14 Dec 2020 15:21:05 -0800 Subject: [PATCH 02/14] remove extra .cmd exclusion. --- tensorflow/lite/micro/tools/ci_build/test_all.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/tensorflow/lite/micro/tools/ci_build/test_all.sh b/tensorflow/lite/micro/tools/ci_build/test_all.sh index 97ffe0980ad839..76bf1a9d640eee 100755 --- a/tensorflow/lite/micro/tools/ci_build/test_all.sh +++ b/tensorflow/lite/micro/tools/ci_build/test_all.sh @@ -47,7 +47,6 @@ tensorflow/lite/micro/tools/make/downloads/pigweed/pw_presubmit/py/pw_presubmit/ -e Makefile \ -e "\.bzl" \ -e "\.cmd" \ - -e "\.cmd" \ -e "\.conf" \ -e "\.defaults" \ -e "\.h5" \ From 5f8e33f084ef968b06e304c3eead4ef6f5131a1d Mon Sep 17 00:00:00 2001 From: Advait Jain Date: Mon, 14 Dec 2020 16:16:33 -0800 Subject: [PATCH 03/14] Also add in presubmit check for clang-format. --- tensorflow/lite/micro/tools/ci_build/test_all.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tensorflow/lite/micro/tools/ci_build/test_all.sh b/tensorflow/lite/micro/tools/ci_build/test_all.sh index 76bf1a9d640eee..d997f0a509fef8 100755 --- a/tensorflow/lite/micro/tools/ci_build/test_all.sh +++ b/tensorflow/lite/micro/tools/ci_build/test_all.sh @@ -63,6 +63,14 @@ tensorflow/lite/micro/tools/make/downloads/pigweed/pw_presubmit/py/pw_presubmit/ -e "\.tpl" \ --output-directory /tmp +# Check that the TFLM-only code is clang-formatted We are currently ignoring +# Python files (with yapf as the formatter) because that needs additional setup. +tensorflow/lite/micro/tools/make/downloads/pigweed/pw_presubmit/py/pw_presubmit/format_code.py \ +  tensorflow/lite/micro \ +  -e "\.inc" \ +  -e "\.py" + + # We are moving away from having the downloads and installations be part of the # Makefile. As a result, we need to manually add the downloads in this script. # Once we move more than the renode downloads out of the Makefile, we should From 170afea2505407bc570fdff8c3a4cc569d2723bc Mon Sep 17 00:00:00 2001 From: Advait Jain Date: Mon, 14 Dec 2020 16:16:33 -0800 Subject: [PATCH 04/14] Also add in presubmit check for clang-format. --- tensorflow/lite/micro/tools/ci_build/test_all.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tensorflow/lite/micro/tools/ci_build/test_all.sh b/tensorflow/lite/micro/tools/ci_build/test_all.sh index 76bf1a9d640eee..d997f0a509fef8 100755 --- a/tensorflow/lite/micro/tools/ci_build/test_all.sh +++ b/tensorflow/lite/micro/tools/ci_build/test_all.sh @@ -63,6 +63,14 @@ tensorflow/lite/micro/tools/make/downloads/pigweed/pw_presubmit/py/pw_presubmit/ -e "\.tpl" \ --output-directory /tmp +# Check that the TFLM-only code is clang-formatted We are currently ignoring +# Python files (with yapf as the formatter) because that needs additional setup. +tensorflow/lite/micro/tools/make/downloads/pigweed/pw_presubmit/py/pw_presubmit/format_code.py \ +  tensorflow/lite/micro \ +  -e "\.inc" \ +  -e "\.py" + + # We are moving away from having the downloads and installations be part of the # Makefile. As a result, we need to manually add the downloads in this script. # Once we move more than the renode downloads out of the Makefile, we should From fcfcdf11f4e4ce5a6f9bdc6b4ffba3a650cf712e Mon Sep 17 00:00:00 2001 From: Advait Jain Date: Mon, 14 Dec 2020 21:34:50 -0800 Subject: [PATCH 05/14] add another exclusion. --- tensorflow/lite/micro/tools/ci_build/test_all.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tensorflow/lite/micro/tools/ci_build/test_all.sh b/tensorflow/lite/micro/tools/ci_build/test_all.sh index d997f0a509fef8..431bed65440a3d 100755 --- a/tensorflow/lite/micro/tools/ci_build/test_all.sh +++ b/tensorflow/lite/micro/tools/ci_build/test_all.sh @@ -55,6 +55,7 @@ tensorflow/lite/micro/tools/make/downloads/pigweed/pw_presubmit/py/pw_presubmit/ -e "\.lcf" \ -e "\.ld" \ -e "\.lds" \ + -e "\.patch" \ -e "\.projbuild" \ -e "\.properties" \ -e "\.resc" \ From b65ee709e914cf14c4454a86b06452526829dd66 Mon Sep 17 00:00:00 2001 From: Advait Jain Date: Mon, 14 Dec 2020 22:39:44 -0800 Subject: [PATCH 06/14] install clang-format on the TFLM docker image. --- tensorflow/tools/ci_build/Dockerfile.micro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tensorflow/tools/ci_build/Dockerfile.micro b/tensorflow/tools/ci_build/Dockerfile.micro index cf2d7155f94e59..3f07090802cc85 100644 --- a/tensorflow/tools/ci_build/Dockerfile.micro +++ b/tensorflow/tools/ci_build/Dockerfile.micro @@ -5,7 +5,7 @@ FROM python:3.9.0-buster LABEL maintainer="Pete Warden " -RUN apt-get update && apt-get install -y zip xxd +RUN apt-get update && apt-get install -y zip xxd clang-format RUN pip install six # Install Renode test dependencies RUN pip install pyyaml requests psutil robotframework==3.1 From 914da4dadd860311dad4b35c3a483caf83386a40 Mon Sep 17 00:00:00 2001 From: Advait Jain Date: Mon, 14 Dec 2020 23:06:45 -0800 Subject: [PATCH 07/14] workaround to use pigweed when we do not have a git repository. --- .../lite/micro/tools/ci_build/test_all.sh | 39 +-------- .../micro/tools/ci_build/test_with_pigweed.sh | 80 +++++++++++++++++++ 2 files changed, 82 insertions(+), 37 deletions(-) create mode 100755 tensorflow/lite/micro/tools/ci_build/test_with_pigweed.sh diff --git a/tensorflow/lite/micro/tools/ci_build/test_all.sh b/tensorflow/lite/micro/tools/ci_build/test_all.sh index 431bed65440a3d..ab1384119dd4de 100755 --- a/tensorflow/lite/micro/tools/ci_build/test_all.sh +++ b/tensorflow/lite/micro/tools/ci_build/test_all.sh @@ -33,44 +33,9 @@ if [ -d tensorflow/lite/micro/tools/make/downloads ]; then exit 1 fi -# explicitly call third_party_downloads since we need pigweed for the license -# and clang-format checks. -make -f tensorflow/lite/micro/tools/make/Makefile third_party_downloads - -# Check for license with the necessary exclusions. -tensorflow/lite/micro/tools/make/downloads/pigweed/pw_presubmit/py/pw_presubmit/pigweed_presubmit.py \ - tensorflow/lite/micro \ - -p copyright_notice \ - -e micro/tools/make/targets/ecm3531 \ - -e BUILD\ - -e leon_commands \ - -e Makefile \ - -e "\.bzl" \ - -e "\.cmd" \ - -e "\.conf" \ - -e "\.defaults" \ - -e "\.h5" \ - -e "\.ipynb" \ - -e "\.inc" \ - -e "\.lcf" \ - -e "\.ld" \ - -e "\.lds" \ - -e "\.patch" \ - -e "\.projbuild" \ - -e "\.properties" \ - -e "\.resc" \ - -e "\.robot" \ - -e "\.txt" \ - -e "\.tpl" \ - --output-directory /tmp - -# Check that the TFLM-only code is clang-formatted We are currently ignoring -# Python files (with yapf as the formatter) because that needs additional setup. -tensorflow/lite/micro/tools/make/downloads/pigweed/pw_presubmit/py/pw_presubmit/format_code.py \ -  tensorflow/lite/micro \ -  -e "\.inc" \ -  -e "\.py" +echo "Running formatting and license checks at `date`" +tensorflow/lite/micro/tools/ci_build/test_withpigweed.sh PRESUBMIT # We are moving away from having the downloads and installations be part of the # Makefile. As a result, we need to manually add the downloads in this script. diff --git a/tensorflow/lite/micro/tools/ci_build/test_with_pigweed.sh b/tensorflow/lite/micro/tools/ci_build/test_with_pigweed.sh new file mode 100755 index 00000000000000..d95bd6a6d94eeb --- /dev/null +++ b/tensorflow/lite/micro/tools/ci_build/test_with_pigweed.sh @@ -0,0 +1,80 @@ +#!/usr/bin/env bash +# Copyright 2019 The TensorFlow Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============================================================================== +# +# Tests the microcontroller code using native x86 execution. + +set -e + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +ROOT_DIR=${SCRIPT_DIR}/../../../../.. +cd "${ROOT_DIR}" + +source tensorflow/lite/micro/tools/ci_build/helper_functions.sh + +# explicitly call third_party_downloads since we need pigweed for the license +# and clang-format checks. +make -f tensorflow/lite/micro/tools/make/Makefile third_party_downloads + +# The pigweed scripts only work from a git repository and the Tensorflow CI +# infrastructure does not always guarantee that. As an ugly workaround, we +# create our own git repo when running on the CI servers. +pushd tensorflow/lite/micro/ +if [[ ${1} == "PRESUBMIT" ]]; then + git init . + git add * + git commit -a -m "Commit for a temporary repository." +fi + +# Check for license with the necessary exclusions. +tools/make/downloads/pigweed/pw_presubmit/py/pw_presubmit/pigweed_presubmit.py \ + . \ + -p copyright_notice \ + -e micro/tools/make/targets/ecm3531 \ + -e BUILD\ + -e leon_commands \ + -e Makefile \ + -e "\.bzl" \ + -e "\.cmd" \ + -e "\.conf" \ + -e "\.defaults" \ + -e "\.h5" \ + -e "\.ipynb" \ + -e "\.inc" \ + -e "\.lcf" \ + -e "\.ld" \ + -e "\.lds" \ + -e "\.patch" \ + -e "\.projbuild" \ + -e "\.properties" \ + -e "\.resc" \ + -e "\.robot" \ + -e "\.txt" \ + -e "\.tpl" \ + --output-directory /tmp + +# Check that the TFLM-only code is clang-formatted We are currently ignoring +# Python files (with yapf as the formatter) because that needs additional setup. +tools/make/downloads/pigweed/pw_presubmit/py/pw_presubmit/format_code.py \ +  . \ +  -e "\.inc" \ +  -e "\.py" + +popd +if [[ ${1} == "PRESUBMIT" ]]; then + rm -rf tensorflow/lite/micro/.git +fi + + From 40813ad37b5484d41a5478caa5a3bc8b635ca81c Mon Sep 17 00:00:00 2001 From: Advait Jain Date: Mon, 14 Dec 2020 23:10:08 -0800 Subject: [PATCH 08/14] small fix --- tensorflow/lite/micro/tools/ci_build/test_with_pigweed.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tensorflow/lite/micro/tools/ci_build/test_with_pigweed.sh b/tensorflow/lite/micro/tools/ci_build/test_with_pigweed.sh index d95bd6a6d94eeb..b8df837a6f2ccc 100755 --- a/tensorflow/lite/micro/tools/ci_build/test_with_pigweed.sh +++ b/tensorflow/lite/micro/tools/ci_build/test_with_pigweed.sh @@ -68,9 +68,9 @@ tools/make/downloads/pigweed/pw_presubmit/py/pw_presubmit/pigweed_presubmit.py \ # Check that the TFLM-only code is clang-formatted We are currently ignoring # Python files (with yapf as the formatter) because that needs additional setup. tools/make/downloads/pigweed/pw_presubmit/py/pw_presubmit/format_code.py \ -  . \ -  -e "\.inc" \ -  -e "\.py" + . \ + -e "\.inc" \ + -e "\.py" popd if [[ ${1} == "PRESUBMIT" ]]; then From b4efe0d7c58007c418b778905de4efbfcc3e9eac Mon Sep 17 00:00:00 2001 From: Advait Jain Date: Tue, 15 Dec 2020 07:44:19 -0800 Subject: [PATCH 09/14] fix typo --- tensorflow/lite/micro/tools/ci_build/test_all.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tensorflow/lite/micro/tools/ci_build/test_all.sh b/tensorflow/lite/micro/tools/ci_build/test_all.sh index ab1384119dd4de..d8c50e35e1dbd3 100755 --- a/tensorflow/lite/micro/tools/ci_build/test_all.sh +++ b/tensorflow/lite/micro/tools/ci_build/test_all.sh @@ -35,7 +35,7 @@ fi echo "Running formatting and license checks at `date`" -tensorflow/lite/micro/tools/ci_build/test_withpigweed.sh PRESUBMIT +tensorflow/lite/micro/tools/ci_build/test_with_pigweed.sh PRESUBMIT # We are moving away from having the downloads and installations be part of the # Makefile. As a result, we need to manually add the downloads in this script. From 9098df4d22467b500ac5ea4bdae3bb55e1d3fb1a Mon Sep 17 00:00:00 2001 From: Advait Jain Date: Tue, 15 Dec 2020 09:41:38 -0800 Subject: [PATCH 10/14] some more fixes for the local git repo for CI. --- tensorflow/lite/micro/tools/ci_build/test_all.sh | 7 ++----- .../ci_build/{test_with_pigweed.sh => test_code_style.sh} | 5 ++--- 2 files changed, 4 insertions(+), 8 deletions(-) rename tensorflow/lite/micro/tools/ci_build/{test_with_pigweed.sh => test_code_style.sh} (96%) diff --git a/tensorflow/lite/micro/tools/ci_build/test_all.sh b/tensorflow/lite/micro/tools/ci_build/test_all.sh index d8c50e35e1dbd3..110996cbcbb96f 100755 --- a/tensorflow/lite/micro/tools/ci_build/test_all.sh +++ b/tensorflow/lite/micro/tools/ci_build/test_all.sh @@ -25,17 +25,14 @@ cd "${ROOT_DIR}" pwd make -f tensorflow/lite/micro/tools/make/Makefile clean_downloads DISABLE_DOWNLOADS=true - - make -f tensorflow/lite/micro/tools/make/Makefile TAGS=cmsis-nn clean DISABLE_DOWNLOADS=true if [ -d tensorflow/lite/micro/tools/make/downloads ]; then echo "ERROR: Downloads directory should not exist, but it does." exit 1 fi - -echo "Running formatting and license checks at `date`" -tensorflow/lite/micro/tools/ci_build/test_with_pigweed.sh PRESUBMIT +echo "Running code style checks at `date`" +tensorflow/lite/micro/tools/ci_build/test_code_style.sh PRESUBMIT # We are moving away from having the downloads and installations be part of the # Makefile. As a result, we need to manually add the downloads in this script. diff --git a/tensorflow/lite/micro/tools/ci_build/test_with_pigweed.sh b/tensorflow/lite/micro/tools/ci_build/test_code_style.sh similarity index 96% rename from tensorflow/lite/micro/tools/ci_build/test_with_pigweed.sh rename to tensorflow/lite/micro/tools/ci_build/test_code_style.sh index b8df837a6f2ccc..a4bf62a959f424 100755 --- a/tensorflow/lite/micro/tools/ci_build/test_with_pigweed.sh +++ b/tensorflow/lite/micro/tools/ci_build/test_code_style.sh @@ -13,8 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================== -# -# Tests the microcontroller code using native x86 execution. set -e @@ -34,6 +32,8 @@ make -f tensorflow/lite/micro/tools/make/Makefile third_party_downloads pushd tensorflow/lite/micro/ if [[ ${1} == "PRESUBMIT" ]]; then git init . + git config user.email "tflm@google.com" + git config user.name "TensorflowLite Micro" git add * git commit -a -m "Commit for a temporary repository." fi @@ -77,4 +77,3 @@ if [[ ${1} == "PRESUBMIT" ]]; then rm -rf tensorflow/lite/micro/.git fi - From d59036012650d54c4719d37374798e07af090c01 Mon Sep 17 00:00:00 2001 From: Advait Jain Date: Tue, 15 Dec 2020 10:25:28 -0800 Subject: [PATCH 11/14] fix remaining issues and tested locally with the PRESUBMIT option. --- .../micro/tools/ci_build/test_code_style.sh | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/tensorflow/lite/micro/tools/ci_build/test_code_style.sh b/tensorflow/lite/micro/tools/ci_build/test_code_style.sh index a4bf62a959f424..7ba0a0e500a5e8 100755 --- a/tensorflow/lite/micro/tools/ci_build/test_code_style.sh +++ b/tensorflow/lite/micro/tools/ci_build/test_code_style.sh @@ -26,6 +26,10 @@ source tensorflow/lite/micro/tools/ci_build/helper_functions.sh # and clang-format checks. make -f tensorflow/lite/micro/tools/make/Makefile third_party_downloads +# Explicitly disable exit on error so that we can properly clean up the +# temporary git repository even when one of the scripts fail with an error code. +set +e + # The pigweed scripts only work from a git repository and the Tensorflow CI # infrastructure does not always guarantee that. As an ugly workaround, we # create our own git repo when running on the CI servers. @@ -35,14 +39,14 @@ if [[ ${1} == "PRESUBMIT" ]]; then git config user.email "tflm@google.com" git config user.name "TensorflowLite Micro" git add * - git commit -a -m "Commit for a temporary repository." + git commit -a -m "Commit for a temporary repository." > /dev/null fi # Check for license with the necessary exclusions. tools/make/downloads/pigweed/pw_presubmit/py/pw_presubmit/pigweed_presubmit.py \ . \ -p copyright_notice \ - -e micro/tools/make/targets/ecm3531 \ + -e tools/make/targets/ecm3531 \ -e BUILD\ -e leon_commands \ -e Makefile \ @@ -65,6 +69,8 @@ tools/make/downloads/pigweed/pw_presubmit/py/pw_presubmit/pigweed_presubmit.py \ -e "\.tpl" \ --output-directory /tmp +LICENSE_CHECK_RESULT=$? + # Check that the TFLM-only code is clang-formatted We are currently ignoring # Python files (with yapf as the formatter) because that needs additional setup. tools/make/downloads/pigweed/pw_presubmit/py/pw_presubmit/format_code.py \ @@ -72,8 +78,17 @@ tools/make/downloads/pigweed/pw_presubmit/py/pw_presubmit/format_code.py \ -e "\.inc" \ -e "\.py" +CLANG_FORMAT_RESULT=$? + popd if [[ ${1} == "PRESUBMIT" ]]; then rm -rf tensorflow/lite/micro/.git fi +# Re-enable exit on error now that we are done with the temporary git repo. +set -e + +if [[ ${LICENSE_CHECK_RESULT} != 0 || ${CLANG_FORMAT_RESULT} != 0 ]] +then + exit 1 +fi From 646b965857cd4cfef1c41e5fb893d08a70c977ce Mon Sep 17 00:00:00 2001 From: Advait Jain Date: Tue, 15 Dec 2020 11:53:42 -0800 Subject: [PATCH 12/14] Manually ignore some sections of the code. Currently we do not control the exact version of clang-format. In particular, the version on the docker image is old (clang-format-7). The current discrepancy is small but we can revisit later if this becomes a problem. --- .../micro/examples/micro_speech/nxp_k66f/audio_provider.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tensorflow/lite/micro/examples/micro_speech/nxp_k66f/audio_provider.cc b/tensorflow/lite/micro/examples/micro_speech/nxp_k66f/audio_provider.cc index aa47dc4fc00e85..6474f0f55ae429 100644 --- a/tensorflow/lite/micro/examples/micro_speech/nxp_k66f/audio_provider.cc +++ b/tensorflow/lite/micro/examples/micro_speech/nxp_k66f/audio_provider.cc @@ -31,6 +31,7 @@ limitations under the License. #include "fsl_sai_edma.h" // NOLINT #include "mbed.h" // NOLINT +// clang-format off // Compiler pragma for alignment of data to make efficient use of DMA #if (defined(__ICCARM__)) #if ((!(defined(FSL_FEATURE_HAS_NO_NONCACHEABLE_SECTION) && \ @@ -68,6 +69,7 @@ limitations under the License. #error Toolchain not supported. #define AT_NONCACHEABLE_SECTION_ALIGN(var, alignbytes) var #endif +// clang-format on namespace { @@ -243,7 +245,9 @@ status_t Da7212WriteRegister(uint8_t register_address, uint8_t register_data) { i2c_data.direction = kI2C_Write; i2c_data.subaddress = register_address; i2c_data.subaddressSize = 1; + // clang-format off i2c_data.data = (uint8_t* volatile)data; + // clang-format on i2c_data.dataSize = 1; i2c_data.flags = kI2C_TransferDefaultFlag; return I2C_MasterTransferBlocking(I2C1, &i2c_data); From 491e13a169242e3a68d2ead408653fc81e8a3de2 Mon Sep 17 00:00:00 2001 From: Advait Jain Date: Tue, 15 Dec 2020 13:04:01 -0800 Subject: [PATCH 13/14] use more recent clang-format on the docker image. --- .../micro/examples/micro_speech/nxp_k66f/audio_provider.cc | 4 ---- tensorflow/tools/ci_build/Dockerfile.micro | 3 ++- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/tensorflow/lite/micro/examples/micro_speech/nxp_k66f/audio_provider.cc b/tensorflow/lite/micro/examples/micro_speech/nxp_k66f/audio_provider.cc index 6474f0f55ae429..aa47dc4fc00e85 100644 --- a/tensorflow/lite/micro/examples/micro_speech/nxp_k66f/audio_provider.cc +++ b/tensorflow/lite/micro/examples/micro_speech/nxp_k66f/audio_provider.cc @@ -31,7 +31,6 @@ limitations under the License. #include "fsl_sai_edma.h" // NOLINT #include "mbed.h" // NOLINT -// clang-format off // Compiler pragma for alignment of data to make efficient use of DMA #if (defined(__ICCARM__)) #if ((!(defined(FSL_FEATURE_HAS_NO_NONCACHEABLE_SECTION) && \ @@ -69,7 +68,6 @@ limitations under the License. #error Toolchain not supported. #define AT_NONCACHEABLE_SECTION_ALIGN(var, alignbytes) var #endif -// clang-format on namespace { @@ -245,9 +243,7 @@ status_t Da7212WriteRegister(uint8_t register_address, uint8_t register_data) { i2c_data.direction = kI2C_Write; i2c_data.subaddress = register_address; i2c_data.subaddressSize = 1; - // clang-format off i2c_data.data = (uint8_t* volatile)data; - // clang-format on i2c_data.dataSize = 1; i2c_data.flags = kI2C_TransferDefaultFlag; return I2C_MasterTransferBlocking(I2C1, &i2c_data); diff --git a/tensorflow/tools/ci_build/Dockerfile.micro b/tensorflow/tools/ci_build/Dockerfile.micro index 3f07090802cc85..524ac640cc8a91 100644 --- a/tensorflow/tools/ci_build/Dockerfile.micro +++ b/tensorflow/tools/ci_build/Dockerfile.micro @@ -5,7 +5,8 @@ FROM python:3.9.0-buster LABEL maintainer="Pete Warden " -RUN apt-get update && apt-get install -y zip xxd clang-format +RUN apt-get update && apt-get install -y zip xxd +RUN pip install clang-format RUN pip install six # Install Renode test dependencies RUN pip install pyyaml requests psutil robotframework==3.1 From 8f623c21c4443769289f0d36ba68244b013d1b87 Mon Sep 17 00:00:00 2001 From: Advait Jain Date: Tue, 15 Dec 2020 14:19:57 -0800 Subject: [PATCH 14/14] get latest and greatest clang-format. --- tensorflow/tools/ci_build/Dockerfile.micro | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tensorflow/tools/ci_build/Dockerfile.micro b/tensorflow/tools/ci_build/Dockerfile.micro index 524ac640cc8a91..31229805ce9892 100644 --- a/tensorflow/tools/ci_build/Dockerfile.micro +++ b/tensorflow/tools/ci_build/Dockerfile.micro @@ -5,8 +5,14 @@ FROM python:3.9.0-buster LABEL maintainer="Pete Warden " -RUN apt-get update && apt-get install -y zip xxd -RUN pip install clang-format +RUN echo deb http://apt.llvm.org/buster/ llvm-toolchain-buster main > /etc/apt/sources.list.d/llvm.list +RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - + +RUN apt-get update + +RUN apt-get install -y zip xxd +RUN apt-get install -y clang-format + RUN pip install six # Install Renode test dependencies RUN pip install pyyaml requests psutil robotframework==3.1