iree-org / iree-bare-metal-arm Goto Github PK
View Code? Open in Web Editor NEWExample for running IREE in a bare-metal Arm environment.
Example for running IREE in a bare-metal Arm environment.
Issue when compiling with ARM GUN Toolchain 13.2 rel1
Compiling options :
export CUSTOM_ARM_LINKER_FLAGS=""
export PATH_TO_LINKER_SCRIPT="`realpath ../build_tools/stm32f407xg-cmsis.ld`"
export PATH_TO_IREE_HOST_BIN_DIR="`realpath ../build-iree-host-tools/bin`"
cmake -GNinja \
-DBUILD_WITH_CMSIS=ON \
-DCMAKE_TOOLCHAIN_FILE="`realpath ../build_tools/cmake/arm-none-eabi-gcc.cmake`" \
-DARM_TOOLCHAIN_ROOT="${PATH_TO_ARM_TOOLCHAIN}" \
-DARM_CPU="cortex-m4" \
-DARM_TARGET="STM32F407" \
-DIREE_ERROR_ON_MISSING_SUBMODULES=OFF \
-DIREE_HAL_DRIVER_LOCAL_SYNC=ON \
-DIREE_HAL_EXECUTABLE_LOADER_EMBEDDED_ELF=ON \
-DIREE_HAL_EXECUTABLE_LOADER_VMVX_MODULE=ON \
-DIREE_HOST_BIN_DIR="${PATH_TO_IREE_HOST_BIN_DIR}" \
-DCUSTOM_ARM_LINKER_FLAGS="${CUSTOM_ARM_LINKER_FLAGS}" \
-DLINKER_SCRIPT="${PATH_TO_LINKER_SCRIPT}" \
-DUSE_UART2=ON \
..
log :
[3/129] Building C object third_party/iree/runtim...ns_ukernel_ukernel_noweak.objects.dir/mmt4d.c.obj
FAILED: third_party/iree/runtime/src/iree/builtins/ukernel/CMakeFiles/iree_builtins_ukernel_ukernel_noweak.objects.dir/mmt4d.c.obj
PATH/Toolchain/arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi/bin/arm-none-eabi-gcc -DFLATCC_USE_GENERIC_ALIGNED_ALLOC -DIREE_PLATFORM_GENERIC -DIREE_STATUS_FEATURES=0 -DIREE_SYNCHRONIZATION_DISABLE_UNSAFE=1 -isystem PATH/Documents/MLIR/iree-bare-metal-arm/third_party/iree -isystem PATH/Documents/MLIR/iree-bare-metal-arm/build/third_party/iree -isystem PATH/Documents/MLIR/iree-bare-metal-arm/third_party/iree/runtime/src/iree/.. -isystem PATH/Documents/MLIR/iree-bare-metal-arm/build/third_party/iree/runtime/src/iree/.. -mthumb -march=armv7e-m -mfloat-abi=hard -mfpu=fpv4-sp-d16 -DIREE_TIME_NOW_FN="{ return 0; }" -DIREE_WAIT_UNTIL_FN=wait_until -Wl,--gc-sections -ffunction-sections -fdata-sections -Wno-char-subscripts -Wno-format -Wno-implicit-function-declaration -Wno-unused-variable -fPIC -fvisibility=hidden -Wall -Werror -Wno-address-of-packed-member -Wno-comment -Wno-format-zero-length -Wno-uninitialized -Wno-pointer-sign -Wno-sign-compare -Wno-unused-function -fmacro-prefix-map=PATH/Documents/MLIR/iree-bare-metal-arm/third_party/iree=iree -std=gnu11 -MD -MT third_party/iree/runtime/src/iree/builtins/ukernel/CMakeFiles/iree_builtins_ukernel_ukernel_noweak.objects.dir/mmt4d.c.obj -MF third_party/iree/runtime/src/iree/builtins/ukernel/CMakeFiles/iree_builtins_ukernel_ukernel_noweak.objects.dir/mmt4d.c.obj.d -o third_party/iree/runtime/src/iree/builtins/ukernel/CMakeFiles/iree_builtins_ukernel_ukernel_noweak.objects.dir/mmt4d.c.obj -c PATH/Documents/MLIR/iree-bare-metal-arm/third_party/iree/runtime/src/iree/builtins/ukernel/mmt4d.c
In file included from PATH/Documents/MLIR/iree-bare-metal-arm/third_party/iree/runtime/src/iree/builtins/ukernel/mmt4d.h:10,
from PATH/Documents/MLIR/iree-bare-metal-arm/third_party/iree/runtime/src/iree/builtins/ukernel/mmt4d.c:7:
PATH/Documents/MLIR/iree-bare-metal-arm/third_party/iree/runtime/src/iree/builtins/ukernel/common.h: In function 'iree_uk_f16_to_f32':
PATH/Documents/MLIR/iree-bare-metal-arm/third_party/iree/runtime/src/iree/builtins/ukernel/common.h:791:3: error: '_Float16' is not supported on this target
791 | _Float16 builtin_float16_value;
| ^~~~~~~~
PATH/Documents/MLIR/iree-bare-metal-arm/third_party/iree/runtime/src/iree/builtins/ukernel/common.h: In function 'iree_uk_f32_to_f16':
PATH/Documents/MLIR/iree-bare-metal-arm/third_party/iree/runtime/src/iree/builtins/ukernel/common.h:803:3: error: '_Float16' is not supported on this target
803 | _Float16 builtin_float16_value = (_Float16)value;
| ^~~~~~~~
PATH/Documents/MLIR/iree-bare-metal-arm/third_party/iree/runtime/src/iree/builtins/ukernel/common.h:803:37: error: '_Float16' is not supported on this target
803 | _Float16 builtin_float16_value = (_Float16)value;
| ```
A reuse-action should be added to the repository. reuse lint
should run on every pull request and the check must be added to the branch protection rule.
I try building iree bare metal arm on Ubuntu 22.04. IREE is obtained using the snapshot method described in the Getting Started.md
Compiling options
export CUSTOM_ARM_LINKER_FLAGS=""
export PATH_TO_LINKER_SCRIPT="`realpath ../build_tools/stm32f407xg-cmsis.ld`"
export PATH_TO_IREE_HOST_BIN_DIR="`realpath ../build-iree-host-tools/bin`"
cmake -GNinja \
-DBUILD_WITH_CMSIS=ON \
-DCMAKE_TOOLCHAIN_FILE="`realpath ../build_tools/cmake/arm-none-eabi-gcc.cmake`" \
-DARM_TOOLCHAIN_ROOT="${PATH_TO_ARM_TOOLCHAIN}" \
-DARM_CPU="cortex-m4" \
-DARM_TARGET="STM32F407" \
-DIREE_ERROR_ON_MISSING_SUBMODULES=OFF \
-DIREE_HAL_DRIVER_LOCAL_SYNC=ON \
-DIREE_HAL_EXECUTABLE_LOADER_EMBEDDED_ELF=ON \
-DIREE_HAL_EXECUTABLE_LOADER_VMVX_MODULE=ON \
-DIREE_HOST_BIN_DIR="${PATH_TO_IREE_HOST_BIN_DIR}" \
-DCUSTOM_ARM_LINKER_FLAGS="${CUSTOM_ARM_LINKER_FLAGS}" \
-DLINKER_SCRIPT="${PATH_TO_LINKER_SCRIPT}" \
-DUSE_UART2=ON \
..
Same issues with 11.3 and 12.3, some warnings
log with 11.3 rel1
[0/2] Re-checking globbed directories...
[129/129] Linking C executable samples/simple_embedding/sample_vmvx_sync.elf
PATH/Toolchain/arm-gnu-toolchain-11.3.rel1-x86_64-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/11.3.1/../../../../arm-none-eabi/bin/ld: PATH/Toolchain/arm-gnu-toolchain-11.3.rel1-x86_64-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/11.3.1/../../../../arm-none-eabi/lib/thumb/v7e-m+fp/hard/libc.a(libc_a-closer.o): in function `_close_r':
/data/jenkins/workspace/GNU-toolchain/arm-11/src/newlib-cygwin/newlib/libc/reent/closer.c:47: warning: _close is not implemented and will always fail
PATH/Toolchain/arm-gnu-toolchain-11.3.rel1-x86_64-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/11.3.1/../../../../arm-none-eabi/bin/ld: PATH/Toolchain/arm-gnu-toolchain-11.3.rel1-x86_64-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/11.3.1/../../../../arm-none-eabi/lib/thumb/v7e-m+fp/hard/libc.a(libc_a-fstatr.o): in function `_fstat_r':
/data/jenkins/workspace/GNU-toolchain/arm-11/src/newlib-cygwin/newlib/libc/reent/fstatr.c:55: warning: _fstat is not implemented and will always fail
PATH/Toolchain/arm-gnu-toolchain-11.3.rel1-x86_64-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/11.3.1/../../../../arm-none-eabi/bin/ld: PATH/Toolchain/arm-gnu-toolchain-11.3.rel1-x86_64-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/11.3.1/../../../../arm-none-eabi/lib/thumb/v7e-m+fp/hard/libc.a(libc_a-signalr.o): in function `_getpid_r':
/data/jenkins/workspace/GNU-toolchain/arm-11/src/newlib-cygwin/newlib/libc/reent/signalr.c:83: warning: _getpid is not implemented and will always fail
PATH/Toolchain/arm-gnu-toolchain-11.3.rel1-x86_64-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/11.3.1/../../../../arm-none-eabi/bin/ld: PATH/Toolchain/arm-gnu-toolchain-11.3.rel1-x86_64-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/11.3.1/../../../../arm-none-eabi/lib/thumb/v7e-m+fp/hard/libc.a(libc_a-isattyr.o): in function `_isatty_r':
/data/jenkins/workspace/GNU-toolchain/arm-11/src/newlib-cygwin/newlib/libc/reent/isattyr.c:52: warning: _isatty is not implemented and will always fail
PATH/Toolchain/arm-gnu-toolchain-11.3.rel1-x86_64-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/11.3.1/../../../../arm-none-eabi/bin/ld: PATH/Toolchain/arm-gnu-toolchain-11.3.rel1-x86_64-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/11.3.1/../../../../arm-none-eabi/lib/thumb/v7e-m+fp/hard/libc.a(libc_a-signalr.o): in function `_kill_r':
/data/jenkins/workspace/GNU-toolchain/arm-11/src/newlib-cygwin/newlib/libc/reent/signalr.c:53: warning: _kill is not implemented and will always fail
PATH/Toolchain/arm-gnu-toolchain-11.3.rel1-x86_64-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/11.3.1/../../../../arm-none-eabi/bin/ld: PATH/Toolchain/arm-gnu-toolchain-11.3.rel1-x86_64-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/11.3.1/../../../../arm-none-eabi/lib/thumb/v7e-m+fp/hard/libc.a(libc_a-lseekr.o): in function `_lseek_r':
/data/jenkins/workspace/GNU-toolchain/arm-11/src/newlib-cygwin/newlib/libc/reent/lseekr.c:49: warning: _lseek is not implemented and will always fail
PATH/Toolchain/arm-gnu-toolchain-11.3.rel1-x86_64-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/11.3.1/../../../../arm-none-eabi/bin/ld: PATH/Toolchain/arm-gnu-toolchain-11.3.rel1-x86_64-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/11.3.1/../../../../arm-none-eabi/lib/thumb/v7e-m+fp/hard/libc.a(libc_a-readr.o): in function `_read_r':
/data/jenkins/workspace/GNU-toolchain/arm-11/src/newlib-cygwin/newlib/libc/reent/readr.c:49: warning: _read is not implemented and will always fail
log with 12.3rel1 :
[0/2] Re-checking globbed directories...
[129/129] Linking C executable samples/simple_embedding/sample_vmvx_sync.elf
PATH/Toolchain/arm-gnu-toolchain-12.3.rel1-x86_64-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld: PATH/Toolchain/arm-gnu-toolchain-12.3.rel1-x86_64-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/lib/thumb/v7e-m+fp/hard/libc.a(libc_a-closer.o): in function `_close_r':
closer.c:(.text._close_r+0xc): warning: _close is not implemented and will always fail
PATH/Toolchain/arm-gnu-toolchain-12.3.rel1-x86_64-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld: PATH/Toolchain/arm-gnu-toolchain-12.3.rel1-x86_64-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/lib/thumb/v7e-m+fp/hard/libc.a(libc_a-fstatr.o): in function `_fstat_r':
fstatr.c:(.text._fstat_r+0x12): warning: _fstat is not implemented and will always fail
PATH/Toolchain/arm-gnu-toolchain-12.3.rel1-x86_64-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld: PATH/Toolchain/arm-gnu-toolchain-12.3.rel1-x86_64-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/lib/thumb/v7e-m+fp/hard/libc.a(libc_a-signalr.o): in function `_getpid_r':
signalr.c:(.text._getpid_r+0x0): warning: _getpid is not implemented and will always fail
PATH/Toolchain/arm-gnu-toolchain-12.3.rel1-x86_64-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld: PATH/Toolchain/arm-gnu-toolchain-12.3.rel1-x86_64-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/lib/thumb/v7e-m+fp/hard/libc.a(libc_a-isattyr.o): in function `_isatty_r':
isattyr.c:(.text._isatty_r+0xc): warning: _isatty is not implemented and will always fail
PATH/Toolchain/arm-gnu-toolchain-12.3.rel1-x86_64-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld: PATH/Toolchain/arm-gnu-toolchain-12.3.rel1-x86_64-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/lib/thumb/v7e-m+fp/hard/libc.a(libc_a-signalr.o): in function `_kill_r':
signalr.c:(.text._kill_r+0x12): warning: _kill is not implemented and will always fail
PATH/Toolchain/arm-gnu-toolchain-12.3.rel1-x86_64-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld: PATH/Toolchain/arm-gnu-toolchain-12.3.rel1-x86_64-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/lib/thumb/v7e-m+fp/hard/libc.a(libc_a-lseekr.o): in function `_lseek_r':
lseekr.c:(.text._lseek_r+0x14): warning: _lseek is not implemented and will always fail
PATH/Toolchain/arm-gnu-toolchain-12.3.rel1-x86_64-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld: PATH/Toolchain/arm-gnu-toolchain-12.3.rel1-x86_64-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/lib/thumb/v7e-m+fp/hard/libc.a(libc_a-readr.o): in function `_read_r':
readr.c:(.text._read_r+0x14): warning: _read is not implemented and will always fail
PATH/Toolchain/arm-gnu-toolchain-12.3.rel1-x86_64-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld: warning: samples/simple_embedding/sample_vmvx_sync.elf has a LOAD segment with RWX permissions
Hello!
Although the build and the renode test is done successfully for the target STM32F407, when I do the build and test with renode for the STM32L476 target the build is done successfuly but when I test with renode I get the error below:
19:01:35.7345 [WARNING] sysbus: [cpu: 0x0] ReadByte from non existing peripheral at 0x0.
19:01:35.7346 [ERROR] cpu: CPU abort [PC=0x0]: Trying to execute code outside RAM or ROM at 0x00000000.
The target is build with this:
cmake -GNinja
-DBUILD_WITH_CMSIS=ON
-DCMAKE_TOOLCHAIN_FILE="realpath/iree-bare-metal-arm/build_tools/cmake/arm-none-eabi-gcc.cmake"
-DARM_TOOLCHAIN_ROOT="realpath/opt/gcc-arm-none-eabi"
-DARM_CPU="cortex-m4"
-DARM_TARGET="STM32L476"
-DIREE_ERROR_ON_MISSING_SUBMODULES=OFF
-DIREE_HAL_DRIVER_LOCAL_SYNC=ON
-DIREE_HAL_EXECUTABLE_LOADER_EMBEDDED_ELF=ON
-DIREE_HAL_EXECUTABLE_LOADER_VMVX_MODULE=ON
-DIREE_HOST_BIN_DIR="/realpath/iree-bare-metal-arm/build-iree-host-install/bin"
-DCUSTOM_ARM_LINKER_FLAGS=""
-DLINKER_SCRIPT="realpath/iree-bare-metal-arm/build_tools/stm32l476xg-cmsis.ld"
-DUSE_UART2=ON
..
cmake --build . --target sample_vmvx_sync
then I started renode and included resc file and loaded the elf file.
(monitor) include @/home/gbouzikas/Thesis/iree-bare-metal-arm/third_party/renode/stm32l476.resc
(STM32F407) sysbus LoadELF @/home/gbouzikas/Thesis/iree-bare-metal-arm/build/samples/simple_embedding/sample_vmvx_sync.elf
(STM32F407) start
And then I get this:
Starting emulation...
19:01:35.6314 [INFO] cpu: Guessing VectorTableOffset value to be 0x8000000.
19:01:35.6344 [INFO] cpu: Setting initial values: PC = 0x8071C4D, SP = 0x20018000.
19:01:35.6357 [INFO] STM32L476: Machine started.
19:01:35.7111 [INFO] usart2: [host: 9.44s (+9.44s)|virt: 0.2ms (+0.2ms)] Running simple_embedding...
19:01:35.7345 [WARNING] sysbus: [cpu: 0x0] ReadByte from non existing peripheral at 0x0.
19:01:35.7346 [ERROR] cpu: CPU abort [PC=0x0]: Trying to execute code outside RAM or ROM at 0x00000000.
Update Renode to release v1.14.0.
When trying to build host tools with ninja:
CMake Error at build_tools/third_party/flatcc/CMakeLists.txt:54 (add_executable):
The install of the iree-flatcc-cli target requires changing an RPATH from
the build tree, but this is not supported with the Ninja generator unless
on an ELF-based platform. The CMAKE_BUILD_WITH_INSTALL_RPATH variable may
be set to avoid this relinking step.
The Arm GNU Toolchain should be updated to version 12.3.Rel1.
Hello! When I try to cmake --build . --target sample_vmvx_sync I get an error about "IREE system clock needs to be set up for your platform". In more details:
realpath/iree-bare-metal-arm/third_party/iree/runtime/src/iree/base/time.c: In function ‘iree_time_now’:
realpath/iree-bare-metal-arm/third_party/iree/runtime/src/iree/base/time.c:39:2: error: #error "IREE system clock needs to be set up for your platform"
39 | #error "IREE system clock needs to be set up for your platform"
| ^~~~~
realpath/iree-bare-metal-arm/iree-bare-metal-arm/third_party/iree/runtime/src/iree/base/time.c:41:1: error: control reaches end of non-void function [-Werror=return-type]
41 | }
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.