riscv-software-src / riscv-pk

RISC-V Proxy Kernel
Other
579 stars 306 forks source link

Couldn't open ELF file using pk #248

Open iams07 opened 3 years ago

iams07 commented 3 years ago

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:

  1. git clone https://github.com/tensorflow/tflite-micro.git
  2. cd tflite-micro
  3. make -f tensorflow/lite/micro/tools/make/Makefile third_party_downloads
  4. 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
  5. Moved the flags -fnothreadsafe-statics and -fno-use-cxa-atexit from PLATFORM FLAGS to CXX FLAGS in /tensorflow/lite/micro/tools/make/targets/mcu_riscv_makefile.inc
  6. Changed -c11 to -gnu11 under CCFLAGS in /tensorflow/lite/micro/tools/make/Makefile
  7. 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.
  8. Run the command make -f tensorflow/lite/micro/tools/make/Makefile TARGET=mcu_riscv TARGET_ARCH=riscv32_mcu hello_world_bin
  9. 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??