tflite-micro: Couldn't open elf file generated by hello world example
Hey, so I was attempting to build the hello world example for RISC-V target and then use Spike to run the subsequent binary file. These are the commands I used to do this:
- git clone https://github.com/tensorflow/tflite-micro.git
- cd tflite-micro
- make -f tensorflow/lite/micro/tools/make/Makefile third_party_downloads
- Change the target from riscv32_mcu to mcu_riscv in /tensorflow/lite/micro/tools/make/mcu_riscv_makefile.inc and in /tensorflow/lite/micro/examples/hello_world/riscv32_mcu/Makefile.inc
- Moved the flags
-fnothreadsafe-staticsand-fno-use-cxa-atexitfrom PLATFORM FLAGS to CXX FLAGS in /tensorflow/lite/micro/tools/make/targets/mcu_riscv_makefile.inc - Changed -c11 to -gnu11 under CCFLAGS in /tensorflow/lite/micro/tools/make/Makefile
- Changed the functions fmin and fmax to min and max respectively in /tensorflow/lite/kernels/internal/min.h and /tensorflow/lite/kernels/internal/max.h.
- Run the command
make -f tensorflow/lite/micro/tools/make/Makefile TARGET=mcu_riscv TARGET_ARCH=riscv32_mcu hello_world_bin - Run the binary using Spike:
spike --isa=rv32imafdc pk tensorflow/lite/micro/tools/make/gen/mcu_riscv_riscv32_mcu_default/bin/hello_world
I’ve checked that the binary generated is indeed ELF 32-bit RISC-V executable, but still on running the final command, it shows
bbl loader couldn't open ELF program: tensorflow/lite/micro/tools/make/gen/mcu_riscv_riscv32_mcu_default/bin/hello_world!
Can anyone let me know what I’m doing wrong in this case??
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 17 (1 by maintainers)
Thanks, your makefile flags helped me to compile for my CV32E40P.
micro/tools/make/targets/mcu_riscv_makefile.inc: https://pastebin.com/BgqEq5i7 (noticed i removed the downloads too, you should have a riscv compiler in your path)make -f tensorflow/lite/micro/tools/make/Makefile TARGET=mcu_riscv TARGET_ARCH=riscv32_mcu hello_world_binif it doesn’t work it might be a compiler problem, maybe install on path the one that tflite micro downloads