Skip to content

Commit 13063c8

Browse files
author
Michael O'Cleirigh
committed
Remove git submodules in favour of shallow checkout approach
Instead of using submodules create a script that will make a shallow git clone of the dependency repos: 1. ulab 2. micropython 3. tflite-micro-esp-examples 4. tflite-micro (for non esp32 boards) Pin the versions to the latest releases of each dependency. ulab: 6.0.12 micropython: master esp32-tflite: v1.0.0 tflite-micro: <undefined> tflite-micro doesn't tag releases so its undefined to be the latest commit on the tip of the main branch. use latest micropython to get upgrade to idf 5.0.2
1 parent 02bc31b commit 13063c8

23 files changed

+154
-340
lines changed

.github/workflows/build_esp32.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
- name: Setup IDF
5050
# if: steps.cache-esp-idf.outputs.cache-hit != 'true'
5151
run: |
52-
source ./micropython/tools/ci.sh && ci_esp32_setup_helper v4.3.1
52+
source ./micropython/tools/ci.sh && ci_esp32_idf50_setup
5353
- name: Cache tflm
5454
id: cache-tflm
5555
uses: actions/cache@v2

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@
22
build
33
lib/*.a
44
micropython-modules/microlite/tflm
5+
dependencies
6+
esp-idf

.gitmodules

Lines changed: 0 additions & 15 deletions
This file was deleted.

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,5 +63,6 @@
6363
}
6464
],
6565
"cortex-debug.variableUseNaturalFormat": false,
66-
"cmake.configureOnOpen": false
66+
"cmake.configureOnOpen": false,
67+
"git.ignoreLimitWarning": true
6768
}

boards/esp32/MICROLITE/CMakeLists.txt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
# Top-level cmake file for building MicroPython on ESP32.
22
# Nothing in here needs to be customised, it will work for any board.
33

4-
cmake_minimum_required(VERSION 3.12)
4+
cmake_minimum_required(VERSION 3.16)
55

66
# Set the location of MicroPython, the esp32 port, and the board directory.
77
get_filename_component(PROJECT_DIR "../../.." ABSOLUTE)
8-
set(MICROPY_PORT_DIR ${PROJECT_DIR}/micropython/ports/esp32)
8+
set(MICROPY_PORT_DIR ${PROJECT_DIR}/dependencies/micropython/ports/esp32)
99
get_filename_component(MICROPY_BOARD_DIR "." ABSOLUTE)
1010

1111
message (STATUS "PROJECT_DIR=${PROJECT_DIR}")
1212
message (STATUS "MICROPY_PORT_DIR=${MICROPY_PORT_DIR}")
1313
message (STATUS "MICROPY_BOARD_DIR=${MICROPY_BOARD_DIR}")
1414

15+
set(EXTRA_COMPONENT_DIRS ../../../dependencies/tflite-micro-esp-examples/components)
16+
1517
# Define the output sdkconfig so it goes in the build directory.
1618
set(SDKCONFIG ${CMAKE_BINARY_DIR}/sdkconfig)
1719

@@ -29,4 +31,4 @@ set(SDKCONFIG_DEFAULTS ${CMAKE_BINARY_DIR}/sdkconfig.combined)
2931

3032
# Include main IDF cmake file and define the project.
3133
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
32-
project(micropython)
34+
project(micropython)

boards/esp32/MICROLITE/main/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ get_filename_component(CURRENT_DIR "." ABSOLUTE)
44

55
message(STATUS "microlite/main/cmake: CURRENT_DIR=${CURRENT_DIR}")
66

7-
get_filename_component(MICROPY_DIR "../../../../micropython" ABSOLUTE)
7+
get_filename_component(MICROPY_DIR "../../../../dependencies/micropython" ABSOLUTE)
88

99

1010
message (STATUS "microlite/main/cmake: MICROPY_DIR=${MICROPY_DIR}")
1111

1212
set(PROJECT_DIR ${MICROPY_DIR}/ports/esp32)
13-
include(${PROJECT_DIR}/main/CMakeLists.txt)
13+
include(${PROJECT_DIR}/main_esp32/CMakeLists.txt)

micropython

Lines changed: 0 additions & 1 deletion
This file was deleted.

micropython-modules/microlite/micropython-error-reporter.cpp

Lines changed: 0 additions & 57 deletions
This file was deleted.

micropython-modules/microlite/micropython-error-reporter.h

Lines changed: 0 additions & 57 deletions
This file was deleted.

micropython-modules/microlite/micropython_esp.cmake

Lines changed: 76 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,82 @@
1-
# File to contain all the source list for Espressif boards to build
1+
#
2+
# This file is part of the Tensorflow Micropython Examples Project.
3+
#
4+
# The MIT License (MIT)
5+
#
6+
# Copyright (c) 2021 Michael O'Cleirigh
7+
#
8+
# Permission is hereby granted, free of charge, to any person obtaining a copy
9+
# of this software and associated documentation files (the "Software"), to deal
10+
# in the Software without restriction, including without limitation the rights
11+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12+
# copies of the Software, and to permit persons to whom the Software is
13+
# furnished to do so, subject to the following conditions:
14+
#
15+
# The above copyright notice and this permission notice shall be included in
16+
# all copies or substantial portions of the Software.
17+
#
18+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24+
# THE SOFTWARE.
25+
#/
226

3-
if(IDF_TARGET STREQUAL "esp32")
4-
set(MICROLITE_PLATFORM "ESP32")
5-
endif()
27+
add_library(microlite INTERFACE)
628

7-
if(IDF_TARGET STREQUAL "esp32s2")
8-
set(MICROLITE_PLATFORM "ESP32S2")
9-
endif()
29+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
30+
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++")
1031

11-
if(IDF_TARGET STREQUAL "esp32s3")
12-
set(MICROLITE_PLATFORM "ESP32S3")
13-
endif()
32+
set (COMPONENTS esp-tflite-micro)
1433

15-
if(IDF_TARGET STREQUAL "esp32c3")
16-
set(MICROLITE_PLATFORM "ESP32C3")
17-
endif()
34+
target_sources(microlite INTERFACE
35+
# microlite micropython module sources
36+
${CMAKE_CURRENT_LIST_DIR}/tensorflow-microlite.c
37+
${CMAKE_CURRENT_LIST_DIR}/audio_frontend.c
38+
${CMAKE_CURRENT_LIST_DIR}/openmv-libtf.cpp
39+
)
1840

19-
if (MICROLITE_PLATFORM STREQUAL "ESP32" OR
20-
MICROLITE_PLATFORM STREQUAL "ESP32S3" OR
21-
MICROLITE_PLATFORM STREQUAL "ESP32C3" OR
22-
MICROLITE_PLATFORM STREQUAL "ESP32S2")
41+
get_filename_component(TENSORFLOW_DIR ${CMAKE_CURRENT_LIST_DIR}/../../dependencies/tflite-micro-esp-examples/components/esp-tflite-micro ABSOLUTE)
42+
get_filename_component(TENSORFLOW_THIRD_PARTY_DIR ${CMAKE_CURRENT_LIST_DIR}/../../dependencies/tflite-micro-esp-examples/components/esp-tflite-micro/third_party ABSOLUTE)
43+
44+
set (FLATBUFFERS_DIR ${TENSORFLOW_THIRD_PARTY_DIR}/flatbuffers/include)
45+
set (GEMMLOWP_DIR ${TENSORFLOW_THIRD_PARTY_DIR}/gemmlowp)
46+
set (KISSFFT_DIR ${TENSORFLOW_THIRD_PARTY_DIR}/kissfft)
47+
set (RUY_DIR ${TENSORFLOW_THIRD_PARTY_DIR}/ruy)
48+
49+
# ESP32
50+
target_include_directories(microlite INTERFACE
51+
${CMAKE_CURRENT_LIST_DIR}
52+
${TENSORFLOW_DIR}
53+
${FLATBUFFERS_DIR}
54+
${GEMMLOWP_DIR}
55+
${KISSFFT_DIR}
56+
${RUY_DIR}
57+
)
58+
59+
target_compile_definitions(microlite INTERFACE
60+
MODULE_MICROLITE_ENABLED=1
61+
TF_LITE_STATIC_MEMORY=1
62+
TF_LITE_MCU_DEBUG_LOG
63+
NDEBUG
64+
)
65+
66+
target_compile_options(microlite INTERFACE
67+
-Wno-error
68+
-Wno-error=float-conversion
69+
-Wno-error=nonnull
70+
-Wno-error=double-promotion
71+
-Wno-error=pointer-arith
72+
-Wno-error=unused-const-variable
73+
-Wno-error=sign-compare
74+
-Wno-error=stringop-overflow
75+
-fno-exceptions
76+
-O3
77+
-Wno-error=maybe-uninitialized
78+
)
79+
80+
81+
target_link_libraries(usermod INTERFACE microlite)
2382

24-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
25-
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++")
26-
set(ESP_NN_DIR "${CMAKE_CURRENT_LIST_DIR}/../../tflm_esp_kernels/components/esp-nn")
27-
set(ESP_NN_SRCS
28-
"${ESP_NN_DIR}/src/activation_functions/esp_nn_relu_ansi.c"
29-
"${ESP_NN_DIR}/src/basic_math/esp_nn_add_ansi.c"
30-
"${ESP_NN_DIR}/src/basic_math/esp_nn_mul_ansi.c"
31-
"${ESP_NN_DIR}/src/convolution/esp_nn_conv_ansi.c"
32-
"${ESP_NN_DIR}/src/convolution/esp_nn_conv_opt.c"
33-
"${ESP_NN_DIR}/src/convolution/esp_nn_depthwise_conv_ansi.c"
34-
"${ESP_NN_DIR}/src/convolution/esp_nn_depthwise_conv_opt.c"
35-
"${ESP_NN_DIR}/src/fully_connected/esp_nn_fully_connected_ansi.c"
36-
"${ESP_NN_DIR}/src/softmax/esp_nn_softmax_ansi.c"
37-
"${ESP_NN_DIR}/src/softmax/esp_nn_softmax_opt.c"
38-
"${ESP_NN_DIR}/src/pooling/esp_nn_avg_pool_ansi.c"
39-
"${ESP_NN_DIR}/src/pooling/esp_nn_max_pool_ansi.c"
40-
)
41-
if(CONFIG_IDF_TARGET_ESP32S3)
42-
list(APPEND ESP_NN_SRCS
43-
"${ESP_NN_DIR}/src/common/esp_nn_common_functions_esp32s3.S"
44-
"${ESP_NN_DIR}/src/common/esp_nn_multiply_by_quantized_mult_esp32s3.S"
45-
"${ESP_NN_DIR}/src/common/esp_nn_multiply_by_quantized_mult_ver1_esp32s3.S"
46-
"${ESP_NN_DIR}/src/activation_functions/esp_nn_relu_s8_esp32s3.S"
47-
"${ESP_NN_DIR}/src/basic_math/esp_nn_add_s8_esp32s3.S"
48-
"${ESP_NN_DIR}/src/basic_math/esp_nn_mul_s8_esp32s3.S"
49-
"${ESP_NN_DIR}/src/convolution/esp_nn_conv_esp32s3.c"
50-
"${ESP_NN_DIR}/src/convolution/esp_nn_depthwise_conv_s8_esp32s3.c"
51-
"${ESP_NN_DIR}/src/convolution/esp_nn_conv_s16_mult8_esp32s3.S"
52-
"${ESP_NN_DIR}/src/convolution/esp_nn_conv_s8_mult8_1x1_esp32s3.S"
53-
"${ESP_NN_DIR}/src/convolution/esp_nn_conv_s16_mult4_1x1_esp32s3.S"
54-
"${ESP_NN_DIR}/src/convolution/esp_nn_conv_s8_filter_aligned_input_padded_esp32s3.S"
55-
"${ESP_NN_DIR}/src/convolution/esp_nn_depthwise_conv_s8_mult1_3x3_padded_esp32s3.S"
56-
"${ESP_NN_DIR}/src/convolution/esp_nn_depthwise_conv_s16_mult1_esp32s3.S"
57-
"${ESP_NN_DIR}/src/convolution/esp_nn_depthwise_conv_s16_mult1_3x3_esp32s3.S"
58-
"${ESP_NN_DIR}/src/convolution/esp_nn_depthwise_conv_s16_mult1_3x3_no_pad_esp32s3.S"
59-
"${ESP_NN_DIR}/src/convolution/esp_nn_depthwise_conv_s16_mult8_3x3_esp32s3.S"
60-
"${ESP_NN_DIR}/src/convolution/esp_nn_depthwise_conv_s16_mult4_esp32s3.S"
61-
"${ESP_NN_DIR}/src/convolution/esp_nn_depthwise_conv_s16_mult8_esp32s3.S"
62-
"${ESP_NN_DIR}/src/fully_connected/esp_nn_fully_connected_s8_esp32s3.S"
63-
"${ESP_NN_DIR}/src/pooling/esp_nn_max_pool_s8_esp32s3.S"
64-
"${ESP_NN_DIR}/src/pooling/esp_nn_avg_pool_s8_esp32s3.S")
65-
endif()
66-
set(ESP_NN_INC ${ESP_NN_DIR}/include ${ESP_NN_DIR}/src/common)
67-
endif()

0 commit comments

Comments
 (0)