google / CFU-Playground

Want a faster ML processor? Do it yourself! -- A framework for playing with custom opcodes to accelerate TensorFlow Lite for Microcontrollers (TFLM). . . . . . Online tutorial: https://google.github.io/CFU-Playground/ For reference docs, see the link below.
http://cfu-playground.rtfd.io/
Apache License 2.0
452 stars 116 forks source link

How to use renode for other LiteX boards? #779

Open lzmz08 opened 1 year ago

lzmz08 commented 1 year ago

I am new to CFU and LiteX. I tried to run make renode for xilinx_zcu102 and diligent_pynq_z1 boards but both of them threw errors

zcu102 :

make renode TARGET=xilinx_zcu102
/home/v/Desktop/CFU-Playground/scripts/pyrun /home/v/Desktop/CFU-Playground/proj/proj_template/cfu_gen.py 
make -C /home/v/Desktop/CFU-Playground/soc -f /home/v/Desktop/CFU-Playground/soc/common_soc.mk litex-software
make[1]: Entering directory '/home/v/Desktop/CFU-Playground/soc'
MAKEFLAGS=-j8 /home/v/Desktop/CFU-Playground/scripts/pyrun ./common_soc.py --output-dir build/xilinx_zcu102.proj_template --csr-json build/xilinx_zcu102.proj_template/csr.json --cpu-cfu  /home/v/Desktop/CFU-Playground/proj/proj_template/cfu.v --uart-baudrate 1843200 --target xilinx_zcu102 
make_soc: cpu_variant is full+cfu
Variant "full+cfu" already known.
Traceback (most recent call last):
  File "/home/v/Desktop/CFU-Playground/soc/./common_soc.py", line 57, in <module>
    main()
  File "/home/v/Desktop/CFU-Playground/soc/./common_soc.py", line 53, in main
    workflow.run()
  File "/home/v/Desktop/CFU-Playground/soc/board_specific_workflows/general.py", line 124, in run
    soc = self.make_soc()
  File "/home/v/Desktop/CFU-Playground/soc/board_specific_workflows/general.py", line 86, in make_soc
    return self.soc_constructor(**base_soc_kwargs)
TypeError: BaseSoC.__init__() missing 1 required positional argument: 'sys_clk_freq'
make[1]: *** [/home/v/Desktop/CFU-Playground/soc/common_soc.mk:111: build/xilinx_zcu102.proj_template/software/bios/bios.bin] Error 1
make[1]: Leaving directory '/home/v/Desktop/CFU-Playground/soc'
make: *** [../proj.mk:311: litex-software] Error 2

pynq z1 :

make renode TARGET=digilent_pynq_z1
/home/v/Desktop/CFU-Playground/scripts/pyrun /home/v/Desktop/CFU-Playground/proj/proj_template/cfu_gen.py 
make -C /home/v/Desktop/CFU-Playground/soc -f /home/v/Desktop/CFU-Playground/soc/common_soc.mk litex-software
make[1]: Entering directory '/home/v/Desktop/CFU-Playground/soc'
make[1]: Nothing to be done for 'litex-software'.
make[1]: Leaving directory '/home/v/Desktop/CFU-Playground/soc'
Copying tflite-micro files
for d in tensorflow/lite tensorflow/lite/c tensorflow/lite/core/api tensorflow/lite/core/c tensorflow/lite/kernels tensorflow/lite/kernels/internal tensorflow/lite/kernels/internal/optimized tensorflow/lite/kernels/internal/reference tensorflow/lite/kernels/internal/reference/integer_ops tensorflow/lite/micro tensorflow/lite/micro/kernels tensorflow/lite/micro/memory_planner tensorflow/lite/micro/arena_allocator tensorflow/lite/micro/tflite_bridge tensorflow/lite/schema; do \
    mkdir -p /home/v/Desktop/CFU-Playground/proj/proj_template/build/src/$d; \
    /bin/cp -a `find /home/v/Desktop/CFU-Playground/third_party/tflite-micro/$d -maxdepth 1 -type f -not -name '*_test*' -regex '.*\.\(h\|c\|cc\)'` /home/v/Desktop/CFU-Playground/proj/proj_template/build/src/$d; \
done
/bin/cp -a /home/v/Desktop/CFU-Playground/third_party/tflite-micro/tensorflow/lite/micro/kernels/conv_test* /home/v/Desktop/CFU-Playground/proj/proj_template/build/src/tensorflow/lite/micro/kernels
/bin/cp -a /home/v/Desktop/CFU-Playground/third_party/tflite-micro/tensorflow/lite/micro/kernels/depthwise_conv_test* /home/v/Desktop/CFU-Playground/proj/proj_template/build/src/tensorflow/lite/micro/kernels
/bin/cp: missing destination file operand after '/home/v/Desktop/CFU-Playground/proj/proj_template/build/src/tensorflow/lite/micro/models'
Try '/bin/cp --help' for more information.
mkdir -p /home/v/Desktop/CFU-Playground/proj/proj_template/build/src/tensorflow/lite/micro/examples/person_detection
/bin/cp -a /home/v/Desktop/CFU-Playground/third_party/tflite-micro/tensorflow/lite/micro/examples/person_detection/model_settings* /home/v/Desktop/CFU-Playground/proj/proj_template/build/src/tensorflow/lite/micro/examples/person_detection
TfLM: copying selected third_party files
mkdir -p /home/v/Desktop/CFU-Playground/proj/proj_template/build/src/third_party/gemmlowp
/bin/cp -a /home/v/Desktop/CFU-Playground/third_party/tflite-micro/third_party/gemmlowp/fixedpoint /home/v/Desktop/CFU-Playground/proj/proj_template/build/src/third_party/gemmlowp
/bin/cp -a /home/v/Desktop/CFU-Playground/third_party/tflite-micro/third_party/gemmlowp/internal /home/v/Desktop/CFU-Playground/proj/proj_template/build/src/third_party/internal
mkdir -p /home/v/Desktop/CFU-Playground/proj/proj_template/build/src/third_party/flatbuffers/include
/bin/cp -a /home/v/Desktop/CFU-Playground/third_party/tflite-micro/third_party/flatbuffers/include/* /home/v/Desktop/CFU-Playground/proj/proj_template/build/src/third_party/flatbuffers/include
mkdir -p /home/v/Desktop/CFU-Playground/proj/proj_template/build/src/third_party/ruy/ruy/profiler
/bin/cp -a /home/v/Desktop/CFU-Playground/third_party/tflite-micro/third_party/ruy/ruy/profiler/instrumentation.h /home/v/Desktop/CFU-Playground/proj/proj_template/build/src/third_party/ruy/ruy/profiler
build-dir: copying source to build dir
/bin/cp -a /home/v/Desktop/CFU-Playground/common/*              /home/v/Desktop/CFU-Playground/proj/proj_template/build
/bin/cp -a /home/v/Desktop/CFU-Playground/third_party/mlcommons/*       /home/v/Desktop/CFU-Playground/proj/proj_template/build/src
/bin/cp -a /home/v/Desktop/CFU-Playground/third_party/SaxonSoc/riscv.h     /home/v/Desktop/CFU-Playground/proj/proj_template/build/src
/bin/cp -a /home/v/Desktop/CFU-Playground/third_party/litex-donut/donut.*     /home/v/Desktop/CFU-Playground/proj/proj_template/build/src
/bin/cp -a /home/v/Desktop/CFU-Playground/proj/proj_template/src/*                 /home/v/Desktop/CFU-Playground/proj/proj_template/build/src
/bin/rm -rf                      /home/v/Desktop/CFU-Playground/proj/proj_template/build/_*
make -C /home/v/Desktop/CFU-Playground/proj/proj_template/build all -j 8
make[1]: Entering directory '/home/v/Desktop/CFU-Playground/proj/proj_template/build'
  LD       software.elf
/home/v/riscv64-unknown-elf-gcc-10.1.0-2020.08.2-x86_64-linux-ubuntu14/bin/../lib/gcc/riscv64-unknown-elf/10.1.0/../../../../riscv64-unknown-elf/bin/ld:/home/v/Desktop/CFU-Playground/proj/proj_template/build/ld/linker.ld:20: warning: memory region `main_ram' not declared
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:166: software.elf] Error 1
make[1]: Leaving directory '/home/v/Desktop/CFU-Playground/proj/proj_template/build'
make: *** [../proj.mk:240: /home/v/Desktop/CFU-Playground/proj/proj_template/build/software.elf] Error 2
tcal-x commented 1 year ago

@lzmz08 , thank you for reporting this. I can reproduce the issue and see the same error. Currently my only guess is that the platform and target files for this board under litex-boards are set up slightly differently.