drichmond / RISC-V-On-PYNQ

RISC-V Integration for PYNQ
Other
165 stars 57 forks source link

Error in test overlay in Packaging-An-Overlay/Installing the Tutorial Overlay #21

Open braziperjikolaei opened 3 years ago

braziperjikolaei commented 3 years ago

Hi dear all,

I try to implement picorv32 on PYNQ-Z1 using vivado 2019.2 I followed your instructions until Packaging an Overlay. Testing the Tutorial Overlay failed due to the same error mentioned in issue #20 . However I can install the Tutorial Overlay via pip3.6 install --upgrade /home/xilinx/RISC-V-On-PYNQ/ and first two commands produce no error:

from riscvonpynq.picorv32.tut.tutorial import TutorialOverlay
overlay = TutorialOverlay("tutorial.bit")

But the next command

%%riscvc test overlay.tutorialProcessor

int main(int argc, char ** argv){
    unsigned int * arr = (unsigned int *)argv[1];
    return arr[2];
}

give this error:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-3-ca02932444aa> in <module>()
----> 1 get_ipython().run_cell_magic('riscvc', 'test overlay.tutorialProcessor', '\nint main(int argc, char ** argv){\n    unsigned int * arr = (unsigned int *)argv[1];\n    return arr[2];\n}')

/usr/lib/python3/dist-packages/IPython/core/interactiveshell.py in run_cell_magic(self, magic_name, line, cell)
   2115             magic_arg_s = self.var_expand(line, stack_depth)
   2116             with self.builtin_trap:
-> 2117                 result = fn(magic_arg_s, cell)
   2118             return result
   2119 

<decorator-gen-124> in riscvc(self, line, cell)

/usr/lib/python3/dist-packages/IPython/core/magic.py in <lambda>(f, *a, **k)
    186     # but it's overkill for just that one bit of state.
    187     def magic_deco(arg):
--> 188         call = lambda f, *a, **k: f(*a, **k)
    189 
    190         if callable(arg):

/usr/local/lib/python3.6/dist-packages/riscvonpynq/magic/Magic.py in riscvc(self, line, cell)
     97         src_name = f'{program_name}.c'
     98 
---> 99         return self.__build(src_name, program_name, processor_name, Lang.C, cell)
    100 
    101     @cell_magic

/usr/local/lib/python3.6/dist-packages/riscvonpynq/magic/Magic.py in __build(self, src_name, program_name, processor_name, lang, cell)
    163         try:
    164             program = Program(tempdir, program_name, lang)
--> 165             program.build(processor)
    166         except RuntimeError as r:
    167             return HTML('<pre>Compilation of program {} FAILED\n {} </pre>'

/usr/local/lib/python3.6/dist-packages/riscvonpynq/Program.py in build(self, proc)
    129 
    130         """
--> 131         self.__compile_bin(proc)
    132         self.__compiled = True
    133         return os.path.join(self.__path, self.__bin_name)

/usr/local/lib/python3.6/dist-packages/riscvonpynq/Program.py in __compile_bin(self, proc)
    109         """
    110         bin_path = os.path.join(self.__path, self.__bin_name)
--> 111         make_args = ['make', "-C", proc.build_path, bin_path,
    112                      f'STKPTR={proc.stkptr}']
    113         result = run(make_args, stdout=PIPE, stderr=PIPE)

/usr/local/lib/python3.6/dist-packages/pynq/overlay.py in __getattr__(self, key)
    756         else:
    757             raise AttributeError(
--> 758                 "Could not find IP or hierarchy {} in overlay".format(key))
    759 
    760     def _keys(self):

AttributeError: Could not find IP or hierarchy build_path in overlay

I do appreciate if you could help me to solve this issue.

Kind regards Behnam

Alikhanum commented 1 year ago

Hello Behnam!

May I ask if you solved the issue? I am facing the same problem and get the following error:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-15-ca02932444aa> in <module>()
----> 1 get_ipython().run_cell_magic('riscvc', 'test overlay.tutorialProcessor', '\nint main(int argc, char ** argv){\n    unsigned int * arr = (unsigned int *)argv[1];\n    return arr[2];\n}')

/usr/lib/python3/dist-packages/IPython/core/interactiveshell.py in run_cell_magic(self, magic_name, line, cell)
   2115             magic_arg_s = self.var_expand(line, stack_depth)
   2116             with self.builtin_trap:
-> 2117                 result = fn(magic_arg_s, cell)
   2118             return result
   2119 

<decorator-gen-125> in riscvc(self, line, cell)

/usr/lib/python3/dist-packages/IPython/core/magic.py in <lambda>(f, *a, **k)
    186     # but it's overkill for just that one bit of state.
    187     def magic_deco(arg):
--> 188         call = lambda f, *a, **k: f(*a, **k)
    189 
    190         if callable(arg):

/usr/local/lib/python3.6/dist-packages/riscvonpynq/magic/Magic.py in riscvc(self, line, cell)
     97         src_name = f'{program_name}.c'
     98 
---> 99         return self.__build(src_name, program_name, processor_name, Lang.C, cell)
    100 
    101     @cell_magic

/usr/local/lib/python3.6/dist-packages/riscvonpynq/magic/Magic.py in __build(self, src_name, program_name, processor_name, lang, cell)
    163         try:
    164             program = Program(tempdir, program_name, lang)
--> 165             program.build(processor)
    166         except RuntimeError as r:
    167             return HTML('<pre>Compilation of program {} FAILED\n {} </pre>'

/usr/local/lib/python3.6/dist-packages/riscvonpynq/Program.py in build(self, proc)
    129 
    130         """
--> 131         self.__compile_bin(proc)
    132         self.__compiled = True
    133         return os.path.join(self.__path, self.__bin_name)

/usr/local/lib/python3.6/dist-packages/riscvonpynq/Program.py in __compile_bin(self, proc)
    109         """
    110         bin_path = os.path.join(self.__path, self.__bin_name)
--> 111         make_args = ['make', "-C", proc.build_path, bin_path,
    112                      f'STKPTR={proc.stkptr}']
    113         result = run(make_args, stdout=PIPE, stderr=PIPE)

/usr/local/lib/python3.6/dist-packages/pynq/overlay.py in __getattr__(self, key)
    930         else:
    931             raise AttributeError(
--> 932                 "Could not find IP or hierarchy {} in overlay".format(key))
    933 
    934     def _keys(self):

AttributeError: Could not find IP or hierarchy build_path in overlay

I would be grateful for your help Best Regards

thetushargoyal commented 8 months ago

Was this issue resolved? I'm trying to run the RISC-V Example Cores on my PYNQ Z2 with v2.5 img but getting the same error.

braziper commented 8 months ago

Was this issue resolved? I'm trying to run the RISC-V Example Cores on my PYNQ Z2 with v2.5 img but getting the same error.

If I remember correctly, I downgraded the PYNQ image on my board, to the version of the tutorial and it worked for me.

Alikhanum commented 7 months ago

If I remember correctly, I downgraded the PYNQ image on my board, to the version of the tutorial and it worked for me.

I did the same, it worked only when I installed the older version from the tutorial

thetushargoyal commented 7 months ago

@Alikhanum Which version did you install?