From 6bb481c58b27b3fc99c0d8fc71b9d58f13e8b0ba Mon Sep 17 00:00:00 2001
From: Amedeo Cavallo <amedeo.cavallo96@gmail.com>
Date: Mon, 15 Jun 2020 11:56:50 +0200
Subject: [PATCH] C linkage for stm32l4HAL target

C linkage for output retargeting on stm32l4HAL target
---
 tensorflow/lite/micro/stm32f4HAL/debug_log.cc | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/tensorflow/lite/micro/stm32f4HAL/debug_log.cc b/tensorflow/lite/micro/stm32f4HAL/debug_log.cc
index 4be3b40e782..90dd7cfd787 100644
--- a/tensorflow/lite/micro/stm32f4HAL/debug_log.cc
+++ b/tensorflow/lite/micro/stm32f4HAL/debug_log.cc
@@ -22,6 +22,10 @@ limitations under the License.
 
 extern UART_HandleTypeDef DEBUG_UART_HANDLE;
 
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
 #ifdef __GNUC__
 int __io_putchar(int ch) {
   HAL_UART_Transmit(&DEBUG_UART_HANDLE, (uint8_t *)&ch, 1, HAL_MAX_DELAY);
@@ -36,4 +40,8 @@ int fputc(int ch, FILE *f) {
 }
 #endif /* __GNUC__ */
 
-extern "C" void DebugLog(const char *s) { fprintf(stderr, "%s", s); }
+void DebugLog(const char *s) { fprintf(stderr, "%s", s); }
+
+#ifdef __cplusplus
+}
+#endif