From 1f6a03d235d3e5ff095f54b060109d350a80f350 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5ns=20Nilsson?= Date: Mon, 7 Aug 2023 17:06:46 +0200 Subject: [PATCH 1/2] Fix armclang build issue --- tensorflow/lite/micro/cortex_m_generic/debug_log.cc | 8 ++++---- .../tools/make/targets/cortex_m_generic_makefile.inc | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/tensorflow/lite/micro/cortex_m_generic/debug_log.cc b/tensorflow/lite/micro/cortex_m_generic/debug_log.cc index 2c237fe63da..c399879f91f 100644 --- a/tensorflow/lite/micro/cortex_m_generic/debug_log.cc +++ b/tensorflow/lite/micro/cortex_m_generic/debug_log.cc @@ -16,6 +16,10 @@ limitations under the License. // Implementation for the DebugLog() function that prints to the debug logger on // an generic Cortex-M device. +#ifndef TF_LITE_STRIP_ERROR_STRINGS +#include "eyalroz_printf/src/printf/printf.h" +#endif + #ifdef __cplusplus extern "C" { #endif // __cplusplus @@ -24,10 +28,6 @@ extern "C" { #include "tensorflow/lite/micro/cortex_m_generic/debug_log_callback.h" -#ifndef TF_LITE_STRIP_ERROR_STRINGS -#include "eyalroz_printf/src/printf/printf.h" -#endif - static DebugLogCallback debug_log_callback = nullptr; namespace { diff --git a/tensorflow/lite/micro/tools/make/targets/cortex_m_generic_makefile.inc b/tensorflow/lite/micro/tools/make/targets/cortex_m_generic_makefile.inc index 0e034ad8168..bce3bc8d3ac 100644 --- a/tensorflow/lite/micro/tools/make/targets/cortex_m_generic_makefile.inc +++ b/tensorflow/lite/micro/tools/make/targets/cortex_m_generic_makefile.inc @@ -124,6 +124,7 @@ ifeq ($(TOOLCHAIN), armclang) LD := armlink FLAGS_ARMC = \ + -Wno-unknown-warning-option \ --target=arm-arm-none-eabi \ -mcpu=$(TARGET_ARCH) From f6e4228893eb1665a7a6af70984eb6da333d431f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5ns=20Nilsson?= Date: Tue, 8 Aug 2023 09:03:30 +0200 Subject: [PATCH 2/2] cortex_m_generic: use std lib instead of third party printf --- tensorflow/lite/micro/cortex_m_generic/debug_log.cc | 10 +++++----- .../tools/make/targets/cortex_m_generic_makefile.inc | 3 --- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/tensorflow/lite/micro/cortex_m_generic/debug_log.cc b/tensorflow/lite/micro/cortex_m_generic/debug_log.cc index c399879f91f..01294f1a3dc 100644 --- a/tensorflow/lite/micro/cortex_m_generic/debug_log.cc +++ b/tensorflow/lite/micro/cortex_m_generic/debug_log.cc @@ -16,10 +16,6 @@ limitations under the License. // Implementation for the DebugLog() function that prints to the debug logger on // an generic Cortex-M device. -#ifndef TF_LITE_STRIP_ERROR_STRINGS -#include "eyalroz_printf/src/printf/printf.h" -#endif - #ifdef __cplusplus extern "C" { #endif // __cplusplus @@ -28,6 +24,10 @@ extern "C" { #include "tensorflow/lite/micro/cortex_m_generic/debug_log_callback.h" +#ifndef TF_LITE_STRIP_ERROR_STRINGS +#include +#endif + static DebugLogCallback debug_log_callback = nullptr; namespace { @@ -49,7 +49,7 @@ void DebugLog(const char* format, va_list args) { constexpr int kMaxLogLen = 256; char log_buffer[kMaxLogLen]; - vsnprintf_(log_buffer, kMaxLogLen, format, args); + vsnprintf(log_buffer, kMaxLogLen, format, args); InvokeDebugLogCallback(log_buffer); #endif } diff --git a/tensorflow/lite/micro/tools/make/targets/cortex_m_generic_makefile.inc b/tensorflow/lite/micro/tools/make/targets/cortex_m_generic_makefile.inc index bce3bc8d3ac..c01ace09a57 100644 --- a/tensorflow/lite/micro/tools/make/targets/cortex_m_generic_makefile.inc +++ b/tensorflow/lite/micro/tools/make/targets/cortex_m_generic_makefile.inc @@ -124,7 +124,6 @@ ifeq ($(TOOLCHAIN), armclang) LD := armlink FLAGS_ARMC = \ - -Wno-unknown-warning-option \ --target=arm-arm-none-eabi \ -mcpu=$(TARGET_ARCH) @@ -205,5 +204,3 @@ ifneq ($(TARGET_ARCH), project_generation) $(TENSORFLOW_ROOT)tensorflow/lite/micro/examples/micro_speech/Makefile.inc MICRO_LITE_EXAMPLE_TESTS := $(filter-out $(EXCLUDED_EXAMPLE_TESTS), $(MICRO_LITE_EXAMPLE_TESTS)) endif - -include $(MAKEFILE_DIR)/ext_libs/eyalroz_printf.inc