Skip to content

Commit

Permalink
misc: Fix build.
Browse files Browse the repository at this point in the history
  • Loading branch information
iabdalkader committed Jul 14, 2024
1 parent a9c444f commit b70eef8
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 11 deletions.
13 changes: 9 additions & 4 deletions .github/workflows/tflm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ on:

jobs:
build-tflm:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04

strategy:
matrix:
Expand Down Expand Up @@ -53,8 +53,7 @@ jobs:

- name: '🩹 Apply patches'
run: |
cd tflite-micro
git apply --verbose ${GITHUB_WORKSPACE}/patches/tflite_micro.patch
git apply --verbose --directory=tflite-micro ${GITHUB_WORKSPACE}/patches/tflite_micro.patch
- name: '♻ Caching dependencies'
uses: actions/[email protected]
Expand All @@ -67,9 +66,15 @@ jobs:
if: steps.cache.outputs.cache-hit != 'true'
run: source tools/ci.sh && ci_install_arm_gcc

- name: '🐍 Set up Python'
uses: actions/setup-python@v5
with:
cache: 'pip'
python-version: "3.12.4"

- name: '🛠 Install dependencies'
run: |
python -m pip install --upgrade pip numpy==1.24 Pillow==10.3
python -m pip install --upgrade pip numpy==1.26.4 Pillow==10.4.0
- name: '🏗 Build TFLM'
run: |
Expand Down
20 changes: 13 additions & 7 deletions tools/ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
TFLM_REPO_PATH=tflite-micro
TOOLCHAIN_PATH=${HOME}/cache/gcc
export PATH=${TOOLCHAIN_PATH}/bin:${PATH}
TOOLCHAIN_URL="https://developer.arm.com/-/media/Files/downloads/gnu/13.2.rel1/binrel/arm-gnu-toolchain-13.2.rel1-x86_64-arm-none-eabi.tar.xz"
TOOLCHAIN_URL="https://developer.arm.com/-/media/Files/downloads/gnu/13.3.rel1/binrel/arm-gnu-toolchain-13.3.rel1-x86_64-arm-none-eabi.tar.xz"

ci_install_arm_gcc() {
mkdir -p ${TOOLCHAIN_PATH}
Expand Down Expand Up @@ -39,13 +39,19 @@ ci_build_target() {
ETHOSU_CONFIG="-DNPU_QCONFIG=0 -DNPU_REGIONCFG_0=0 -DAXI_LIMIT0_MAX_BEATS_BYTES=1 -DAXI_LIMIT0_MEM_TYPE=2 -DAXI_LIMIT1_MAX_BEATS_BYTES=1 -DAXI_LIMIT1_MEM_TYPE=2 -DAXI_LIMIT2_MAX_BEATS_BYTES=1 -DAXI_LIMIT2_MEM_TYPE=2 -DAXI_LIMIT3_MAX_BEATS_BYTES=1 -DAXI_LIMIT3_MEM_TYPE=2"

pushd ${TFLM_REPO_PATH}
echo "make -j$(nproc) -f tensorflow/lite/micro/tools/make/Makefile \
TARGET=cortex_m_generic TARGET_ARCH=${TARGET_ARCH} CO_PROCESSOR=${TARGET_COPROC} \
${TARGET_ARGS} OPTIMIZED_KERNEL_DIR=${TARGET_KERNEL} CORE_OPTIMIZATION_LEVEL=-O2 \
KERNEL_OPTIMIZATION_LEVEL=-O2 THIRD_PARTY_KERNEL_OPTIMIZATION_LEVEL=-O2 \
TARGET_TOOLCHAIN_ROOT=${TOOLCHAIN_PATH}/bin/ TARGET_TOOLCHAIN_PREFIX=arm-none-eabi- \
ETHOSU_EXTRA_CFLAGS=${ETHOSU_CONFIG} BUILD_TYPE=${TARGET_BUILD} MICROLITE_LIB_NAME=libtflm.a microlite"

make -j$(nproc) -f tensorflow/lite/micro/tools/make/Makefile \
TARGET=cortex_m_generic TARGET_ARCH=${TARGET_ARCH} \
CO_PROCESSOR=${TARGET_COPROC} ${TARGET_ARGS} ETHOSU_EXTRA_CFLAGS="${ETHOSU_CONFIG}" \
OPTIMIZED_KERNEL_DIR=${TARGET_KERNEL} CORE_OPTIMIZATION_LEVEL=-O2 \
KERNEL_OPTIMIZATION_LEVEL=-O2 THIRD_PARTY_KERNEL_OPTIMIZATION_LEVEL=-O2 \
TARGET_TOOLCHAIN_ROOT=${TOOLCHAIN_PATH}/bin/ TARGET_TOOLCHAIN_PREFIX=arm-none-eabi- \
BUILD_TYPE=${TARGET_BUILD} MICROLITE_LIB_NAME=libtflm.a microlite
TARGET=cortex_m_generic TARGET_ARCH=${TARGET_ARCH} CO_PROCESSOR=${TARGET_COPROC} \
${TARGET_ARGS} OPTIMIZED_KERNEL_DIR=${TARGET_KERNEL} CORE_OPTIMIZATION_LEVEL=-O2 \
KERNEL_OPTIMIZATION_LEVEL=-O2 THIRD_PARTY_KERNEL_OPTIMIZATION_LEVEL=-O2 \
TARGET_TOOLCHAIN_ROOT=${TOOLCHAIN_PATH}/bin/ TARGET_TOOLCHAIN_PREFIX=arm-none-eabi- \
ETHOSU_EXTRA_CFLAGS="${ETHOSU_CONFIG}" BUILD_TYPE=${TARGET_BUILD} MICROLITE_LIB_NAME=libtflm.a microlite
popd
mv ${TFLM_REPO_PATH}/gen/*/lib/libtflm.a libtflm-${TARGET_NAME}-${TARGET_BUILD}.a
}
Expand Down

0 comments on commit b70eef8

Please sign in to comment.