Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the issue #32041: Fix riscv32_mcu link failure in build period. #33972

Closed
wants to merge 8 commits into from
16 changes: 16 additions & 0 deletions tensorflow/lite/experimental/micro/arduino/abi.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/* 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.
==============================================================================*/

void* __dso_handle;
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
HELLO_WORLD_TEST_SRCS := \
HELLO_WORLD_TEST_SRCS += \
tensorflow/lite/experimental/micro/examples/hello_world/hello_world_test.cc \
tensorflow/lite/experimental/micro/examples/hello_world/sine_model_data.cc

Expand All @@ -13,12 +13,13 @@ OUTPUT_HANDLER_TEST_HDRS := \
tensorflow/lite/experimental/micro/examples/hello_world/output_handler.h \
tensorflow/lite/experimental/micro/examples/hello_world/constants.h

HELLO_WORLD_SRCS := \
HELLO_WORLD_SRCS += \
tensorflow/lite/experimental/micro/examples/hello_world/main.cc \
tensorflow/lite/experimental/micro/examples/hello_world/main_functions.cc \
tensorflow/lite/experimental/micro/examples/hello_world/sine_model_data.cc \
tensorflow/lite/experimental/micro/examples/hello_world/output_handler.cc \
tensorflow/lite/experimental/micro/examples/hello_world/constants.cc
tensorflow/lite/experimental/micro/examples/hello_world/constants.cc \
tensorflow/lite/experimental/micro/arduino/abi.cc

HELLO_WORLD_HDRS := \
tensorflow/lite/experimental/micro/examples/hello_world/sine_model_data.h \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,12 @@ GESTURE_PREDICTOR_TEST_HDRS := \
tensorflow/lite/experimental/micro/examples/magic_wand/constants.h \
tensorflow/lite/experimental/micro/examples/magic_wand/gesture_predictor.h \

magic_wand_TEST_SRCS := \
magic_wand_TEST_SRCS += \
tensorflow/lite/experimental/micro/examples/magic_wand/magic_wand_test.cc \
tensorflow/lite/experimental/micro/examples/magic_wand/magic_wand_model_data.cc \
tensorflow/lite/experimental/micro/examples/magic_wand/angle_micro_features_data.cc \
tensorflow/lite/experimental/micro/examples/magic_wand/circle_micro_features_data.cc
tensorflow/lite/experimental/micro/examples/magic_wand/circle_micro_features_data.cc \
tensorflow/lite/experimental/micro/arduino/abi.cc

magic_wand_TEST_HDRS := \
tensorflow/lite/experimental/micro/examples/magic_wand/magic_wand_model_data.h \
Expand All @@ -55,7 +56,8 @@ tensorflow/lite/experimental/micro/examples/magic_wand/constants.cc \
tensorflow/lite/experimental/micro/examples/magic_wand/magic_wand_model_data.cc \
tensorflow/lite/experimental/micro/examples/magic_wand/accelerometer_handler.cc \
tensorflow/lite/experimental/micro/examples/magic_wand/gesture_predictor.cc \
tensorflow/lite/experimental/micro/examples/magic_wand/output_handler.cc
tensorflow/lite/experimental/micro/examples/magic_wand/output_handler.cc \
tensorflow/lite/experimental/micro/arduino/abi.cc

magic_wand_HDRS := \
tensorflow/lite/experimental/micro/examples/magic_wand/main_functions.h \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,17 @@ third_party/kissfft/kiss_fft.h \
third_party/kissfft/_kiss_fft_guts.h \
third_party/kissfft/tools/kiss_fftr.h

MICRO_SPEECH_TEST_SRCS := \
MICRO_SPEECH_TEST_SRCS += \
tensorflow/lite/experimental/micro/examples/micro_speech/micro_speech_test.cc \
tensorflow/lite/experimental/micro/examples/micro_speech/micro_features/tiny_conv_micro_features_model_data.cc \
tensorflow/lite/experimental/micro/examples/micro_speech/micro_features/no_micro_features_data.cc \
tensorflow/lite/experimental/micro/examples/micro_speech/micro_features/yes_micro_features_data.cc
tensorflow/lite/experimental/micro/examples/micro_speech/micro_features/yes_micro_features_data.cc \
tensorflow/lite/experimental/micro/arduino/abi.cc

MICRO_SPEECH_TEST_HDRS := \
tensorflow/lite/experimental/micro/examples/micro_speech/micro_features/tiny_conv_micro_features_model_data.h \
tensorflow/lite/experimental/micro/examples/micro_speech/micro_features/no_micro_features_data.h \
tensorflow/lite/experimental/micro/examples/micro_speech/micro_features/yes_micro_features_data.h \
tensorflow/lite/experimental/micro/examples/micro_speech/micro_features/yes_micro_features_data.h

SIMPLE_FEATURES_GENERATOR_TEST_SRCS := \
tensorflow/lite/experimental/micro/examples/micro_speech/simple_features/simple_features_generator.cc \
Expand Down Expand Up @@ -183,7 +184,7 @@ tensorflow/lite/experimental/micro/examples/micro_speech/command_responder.cc
COMMAND_RESPONDER_TEST_HDRS := \
tensorflow/lite/experimental/micro/examples/micro_speech/command_responder.h

MICRO_SPEECH_SRCS := \
MICRO_SPEECH_SRCS += \
tensorflow/lite/experimental/micro/examples/micro_speech/main.cc \
tensorflow/lite/experimental/micro/examples/micro_speech/main_functions.cc \
tensorflow/lite/experimental/micro/examples/micro_speech/audio_provider.cc \
Expand All @@ -193,6 +194,7 @@ tensorflow/lite/experimental/micro/examples/micro_speech/micro_features/yes_micr
tensorflow/lite/experimental/micro/examples/micro_speech/micro_features/tiny_conv_micro_features_model_data.cc \
tensorflow/lite/experimental/micro/examples/micro_speech/recognize_commands.cc \
tensorflow/lite/experimental/micro/examples/micro_speech/command_responder.cc \
tensorflow/lite/experimental/micro/arduino/abi.cc \
$(MICRO_FEATURES_GENERATOR_SRCS)

MICRO_SPEECH_HDRS := \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ person_detection_MODEL_HDRS := \
tensorflow/lite/experimental/micro/examples/person_detection/model_settings.h \
tensorflow/lite/experimental/micro/examples/person_detection/person_detect_model_data.h

person_detection_TEST_SRCS := \
person_detection_TEST_SRCS += \
tensorflow/lite/experimental/micro/examples/person_detection/person_detection_test.cc \
$(MAKEFILE_DIR)/downloads/person_model_grayscale/no_person_image_data.cc \
$(MAKEFILE_DIR)/downloads/person_model_grayscale/person_image_data.cc \
tensorflow/lite/experimental/micro/arduino/abi.cc \
$(person_detection_MODEL_SRCS)

person_detection_TEST_HDRS := \
Expand All @@ -35,11 +36,12 @@ tensorflow/lite/experimental/micro/examples/person_detection/detection_responder
DETECTION_RESPONDER_TEST_HDRS := \
tensorflow/lite/experimental/micro/examples/person_detection/detection_responder.h

person_detection_SRCS := \
person_detection_SRCS += \
tensorflow/lite/experimental/micro/examples/person_detection/detection_responder.cc \
tensorflow/lite/experimental/micro/examples/person_detection/image_provider.cc \
tensorflow/lite/experimental/micro/examples/person_detection/main.cc \
tensorflow/lite/experimental/micro/examples/person_detection/main_functions.cc \
tensorflow/lite/experimental/micro/arduino/abi.cc \
$(person_detection_MODEL_SRCS)

person_detection_HDRS := \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ $(1)_LOCAL_SRCS := $$(call specialize,$$($(1)_LOCAL_SRCS))
ALL_SRCS += $$($(1)_LOCAL_SRCS)
$(1)_LOCAL_HDRS := $(3)
$(1)_LOCAL_OBJS := $$(addprefix $$(OBJDIR), \
$$(patsubst %.cc,%.o,$$(patsubst %.c,%.o,$$($(1)_LOCAL_SRCS))))
$$(patsubst %.S,%.o,$$(patsubst %.cc,%.o,$$(patsubst %.c,%.o,$$($(1)_LOCAL_SRCS)))))
$(1)_BINARY := $$(BINDIR)$(1)
$$($(1)_BINARY): $$($(1)_LOCAL_OBJS) $$(MICROLITE_LIB_PATH)
@mkdir -p $$(dir $$@)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,30 @@ ifeq ($(TARGET), riscv32_mcu)

MICROLITE_CC_SRCS += \
$(wildcard tensorflow/lite/experimental/micro/riscv32_mcu/*.cc)
MICRO_SPEECH_TEST_SRCS += \

# Wrap functions
MICRO_FE310_LIBWRAP_SRCS += \
$(wildcard $(MAKEFILE_DIR)/downloads/sifive_fe310_lib/bsp/libwrap/sys/*.c) \
$(wildcard $(MAKEFILE_DIR)/downloads/sifive_fe310_lib/bsp/libwrap/sys/*.cc) \
$(MAKEFILE_DIR)/downloads/sifive_fe310_lib/bsp/libwrap/misc/write_hex.c \
$(MAKEFILE_DIR)/downloads/sifive_fe310_lib/bsp/libwrap/stdlib/malloc.c \
$(MAKEFILE_DIR)/downloads/sifive_fe310_lib/bsp/libwrap/stdlib/malloc.c

MICRO_FE310_BSP_ENV_SRCS += \
$(MAKEFILE_DIR)/downloads/sifive_fe310_lib/bsp/env/start.S \
$(MAKEFILE_DIR)/downloads/sifive_fe310_lib/bsp/env/entry.S \
$(MAKEFILE_DIR)/downloads/sifive_fe310_lib/bsp/env/freedom-e300-hifive1/init.c

MICRO_SPEECH_TEST_SRCS += $(MICRO_FE310_LIBWRAP_SRCS) $(MICRO_FE310_BSP_ENV_SRCS)
MICRO_SPEECH_SRCS += $(MICRO_FE310_LIBWRAP_SRCS) $(MICRO_FE310_BSP_ENV_SRCS)

HELLO_WORLD_TEST_SRCS += $(MICRO_FE310_LIBWRAP_SRCS) $(MICRO_FE310_BSP_ENV_SRCS)
HELLO_WORLD_SRCS += $(MICRO_FE310_LIBWRAP_SRCS) $(MICRO_FE310_BSP_ENV_SRCS)

magic_wand_TEST_SRCS += $(MICRO_FE310_LIBWRAP_SRCS) $(MICRO_FE310_BSP_ENV_SRCS)
magic_wand_SRCS += $(MICRO_FE310_LIBWRAP_SRCS) $(MICRO_FE310_BSP_ENV_SRCS)

person_detection_TEST_HDRS += $(MICRO_FE310_LIBWRAP_SRCS) $(MICRO_FE310_BSP_ENV_SRCS)
person_detection_SRCS += $(MICRO_FE310_LIBWRAP_SRCS) $(MICRO_FE310_BSP_ENV_SRCS)

LIBWRAP_SYMS := malloc free \
open lseek read write fstat stat close link unlink \
execve fork getpid kill wait \
Expand All @@ -76,4 +92,4 @@ ifeq ($(TARGET), riscv32_mcu)
$(BINDIR)/%.bin: $(BINDIR)/%
@mkdir -p $(dir $@)
$(OBJCOPY) $< $@ -O binary
endif
endif