andre1araujo / YOLO-on-PYNQ-Z2

This repository contains all the necessary material to implement a YOLOv3 object detection algorithm on the PYNQ-Z2 FPGA. There is a step-by-step tutorial associated so everyone can do it.
https://andre-araujo.gitbook.io/yolo-on-pynq-z2/
Apache License 2.0
27 stars 4 forks source link

Issue with Petalinux. #6

Closed MaRcOsss1 closed 2 months ago

MaRcOsss1 commented 3 months ago

Hi Andre, I am currently following your tutorial on GitBook to learn more about implementing Machine Learning on FPGA. I have reached the section titled "Implementing DPU on SD card" and encountered some difficulties progressing beyond this point. I have successfully completed all the previous steps correctly.

I am stuck at the step where it states: "On the final part, you have to place the path to the '.xsa' file... You will be presented with a nice little menu. Here is how you can work on this configuration interface." Below is the terminal log from my session:

aryan@petalinux:~$ cd pynqz2_dpu/ aryan@petalinux:~/pynqz2_dpu$ source /opt/petalinux/settings.sh PetaLinux environment set to '/opt/petalinux' INFO: Checking free disk space INFO: Checking installed tools INFO: Checking installed development libraries INFO: Checking network and other services WARNING: No tftp server found - please refer to "PetaLinux SDK Installation Guide" for its impact and solution aryan@petalinux:~/pynqz2_dpu$ petalinux-create --type project --template zynq --name pynqz2_dpu INFO: Create project: pynqz2_dpu INFO: New project successfully created in /home/aryan/pynqz2_dpu/pynqz2_dpu aryan@petalinux:~/pynqz2_dpu$ cd pynqz2_dpu/ aryan@petalinux:~/pynqz2_dpu/pynqz2_dpu$ petalinux-config --get-hw-description=/home/aryan/Desktop/oynqz2_dpu INFO: Getting hardware description... INFO: Rename pynqz2_dpu.xsa to system.xsa [INFO] generating Kconfig for project [INFO] menuconfig project ERROR: Failed to menu config project component ERROR: Failed to config project. ERROR: Get hw description Failed!. aryan@petalinux:~/pynqz2_dpu/pynqz2_dpu$

I am unsure why these errors are occurring. Could you help me identify any potential mistakes I might have made?

andre1araujo commented 3 months ago

Hello Shah Aryan! First of all, sorry for the late response. I am answering the question here because it might help other people. I am sorry you encountered that error. I was already looking for the problem online and was thinking it could be to version mismatch but I think I fount your problem. Take a look at the way you wrote the command:

Petalinux_Problem

As you can see, you put a "o" instead of a "p". It happens to the best of us ;) Let me know if that was the problem and don't hesitate in writting back to let me know! Good luck for your project! :)

MaRcOsss1 commented 3 months ago

Hi Andre,

Thank you for your reply. I apologize for any confusion caused. The folder name "oynq" is actually correct, as I mistakenly named it that way, and I neglected to specify this in the issue. The 'o' is correct, as I've named the folder as that. I am sorry for that. So the problem still pertains unfortunately.

You mentioned a potential version mismatch. Could you please clarify which versions I should be using? I have been following the versions specified in your tutorial. Should I consider using different versions?

Additionally, what other possible issues could be causing the errors I'm encountering?

andre1araujo commented 3 months ago

Hi again Aryan! Well, I believe you have everything right then. I suspect it is something simple. So, based on the commands you sent me, try to see if there is another "pynqz2_dpu" folder inside the "pynqz2_dpu" folder on the Desktop. If that is the case, I think you will have to do the command like this: petalinux-config --get-hw-description=/home/aryan/Desktop/pynqz2_dpu/pynqz2_dpu Before that, don't forget to execute source /opt/petalinux/settings.sh Try to see if this works. Reach back to me if the problem presists! Good luck!

MaRcOsss1 commented 3 months ago

I have to give the path to the XSA file there right? The xsa file is inside the folder "pynq_dpu" (or oynq_dpu as I've named it)that is on the desktop. Petalinux only requires the .xsa file right for this operation?

Also you can check the log that its renaming the .xsa file to something else and then the errors are coming. So far I've tried reinstalling the Petalinux, checking and verifying the DPU IP again and again. I couldn't figure where I'm making a mistake.

Do you know any alternative, so I can convert this .xsa file into a bootable file with the required libs , in case this issue doesn't get resolved?

andre1araujo commented 3 months ago

Well, if everything goes wrong, you can just download the SD card image file here and flash it on the micro SD card, following this part of the tutorial. The SD card image has the process you are doing already finished. Also, you can try to restart the Petalinux process and use my .xsa file I provided here and see if that solves the problem. I can try and look more into that problem but I don't have much experience with Petalinux. I followed the tutorial presented somewhere else. Just do not worry to much because the SD card image has everything ready! :)

MaRcOsss1 commented 3 months ago

Hey, sure I'll try that and let you know. Anyways you can see in my log that there's a warning " WARNING: No tftp server found". So I looked on Xilinx support documents and it said: image Do you have any idea what this is about?

andre1araujo commented 3 months ago

Hi! No, I don't really know what that is all about but you can just ignore it. It is not usefull for our application. On that description it mentions Microblaze. Microblaze is basically a microprocessor made in the FPGA. It is Xilinx property and it is more usefull for raw FPGA boards, unlike the PYNQ-Z2 that uses the FPGA and a ARM cortex A9 processor separatly (SoC - System on Chips).

MaRcOsss1 commented 3 months ago

Hey Andre I tried running your .XSA file in the petalinux but I ran into more errors. You can see the last part of log here:

aryan@petalinux:~/Desktop/dpu_integration/pynqz2_dpu$ petalinux-config --get-hw-description=/home/aryan/Desktop/pynqz2_dpu INFO: Getting hardware description... INFO: Rename pynqz2_dpu.xsa to system.xsa [INFO] generating Kconfig for project ERROR: [HDF 64-4] /home/aryan/Desktop/dpu_integration/pynqz2_dpu/project-spec/hw-description/system.xsa is not valid Hardware Handoff File ERROR: [Hsi 55-1451] Error: running open_hw_design. ERROR: Failed to generate /home/aryan/Desktop/dpu_integration/pynqz2_dpu/build/misc/config/Kconfig.syshw ERROR: Failed to Kconfig project ERROR: Failed to generate System hardware Kconfig file.

andre1araujo commented 3 months ago

Hello! It's weird it does not recognise the file. Obviously it worked for me back then. Try to use this one here. I had this one still in my Virtual Box environment so it should work. Let me know if it works! pynqz2_dpu_xsa.zip

MaRcOsss1 commented 3 months ago

Hey Andre, Its still not working, I wanted to learn the process but I think something's wrong with my petalinux or ubuntu. I am not sure whats the issue, do you know any alternate method I can use to turn my .xsa into or to generate bootable image files other than petalinux?

Log: aryan@petalinux:~/pynqz2_dpu1$ petalinux-config --get-hw-description=~/ INFO: Getting hardware description... INFO: Rename pynqz2_dpu.xsa to system.xsa [INFO] generating Kconfig for project [INFO] menuconfig project ERROR: Failed to menu config project component ERROR: Failed to config project. ERROR: Get hw description Failed!.

image image

andre1araujo commented 3 months ago

Hello Aryan! I don't think there is an alternative method for turning the Hardware design into a bootable SD card image. I think you can try one last thing, that is, instead of writting the path to the .xsa file, you write the path to the whole Vivado project. Could you do that? Bring all the files to Ubuntu and serve the corresponding path. Let me know if that works because I find this all very suspicious since the specs are the same according to the tutorial I built. Again, I am sorry for the inconvenience and I hope I could help. Good luck!

MaRcOsss1 commented 3 months ago

Hey Andre, Don't be sorry its not your fault, you have helped as much as you can from your end. I appreciate you giving efforts in solving my problem.

So all the vivado project files are already on the VM, and thats what I was doing till now, giving path to the whole folder which included my complete Vivado Project. image

I'll try doing that with your files, once and I will let you know.

Also I had posted the same query on Xilinx Forum and this is the response: image Do you have any idea regarding "supported host machine"? Is he referring to VM?

andre1araujo commented 3 months ago

Hello! The host machine is a reference to the Software you are using on the Virtual Machine. In your case it should be Ubuntu 18.04. On the user guide it says it only supports Ubuntu 18.04 or 16.04 if I am not mistaken. Then there is the Petalinux version which should also be compatible with the Vivado version. Hope this helps!

MaRcOsss1 commented 3 months ago

Hey Andre, I have disturbed you enough with petalinux but this is something I had to tell you, so as I said I was so done with the petalinux and the errors. So I deleted the petalinux compeletely, and downloaded the petalinux again, with its supported files and packages and I thought to give it a one last try following the tutorial, and guess what? It worked, no errors. I can continue learning the process finally. I wish I had deleted the petalinux and re-download it from scratch without wasting days behind this.

I am so sorry taking so much of your time and I am thankful to help me the best you can, You are really the best.

Also for this part of the tutorial , I have to Dual boot my PC right?

andre1araujo commented 3 months ago

Hello Aryan! That's a classisc engineer move haha. I am glad it worked. Sometimes we miss some details along the process and that is why your feedback is important: so I can correct the tutorial and give new guidelines to the readers. Sorry again I could not help perfectly!

About the Dual Boot, that is correct. The DNNDK tool is only supported in Ubuntu 16.04 or Ubuntu 18.04 (according to the user guide of course). If you have those versions of Ubuntu on a different computer you can use it but most people have Windows or a more recent version of Ubuntu so Dual Boot is necessary. I ended up not including the dual boot process on the tutorial because it can vary a little bit for each PC and I wouldn't want the responsibility if it went wrong. But there are plenty of tutorials online! Just be sure to make a copy of the most important files in case you lose the Windows partition by mistake. Good luck with the rest of the process! Be sure to report any questions or problems you encounter! :)

MaRcOsss1 commented 3 months ago

Hey Andre, I am not going to stop disturbing you until this project is over haha. I ran into porblem again I dont know what happened. So I have used the P7zip , copied the recipe modules, and tried to run petalinux-config -c rootfs but ran into the error : ERROR: Failed to create workspace directory ERROR: Failed to config rootfs.

And I have followed your tutorial line to line, step by step, I am doing nothing different. I had run this command before and it worked then, since then its not working, I had repeated all the steps from scratch and made a new folder but its not working.

The log: image image

andre1araujo commented 3 months ago

Hello! I don't know why it failed but generally is because something is missing. Or because you are unlucky haha. Anyway, did you do this part?

image

Find that specific file and add this echo 'IMAGE_INSTALL_append = "dpu"' on the last line of the document.

conf_file

If that was done, confirm that the files are on the correct place. Check these screenshots to see if the project organization is the same. I noticed the tutorial is quite confusing and should have some checkpoints to make sure the reader has everything together.

image

If any of these sugestions work, let me know. Otherwise it might be something more complicated. Good luck!

MaRcOsss1 commented 3 months ago

I dont have the 2 .bsp files you have in this folder, can that be a problem? image I dont seem to have recipes-kernel here...why is that? I copied the recipe modules already? image

andre1araujo commented 3 months ago

I don't think those files are the problem because they probably were product of future steps. Still, I am not sure. Try to restart the petalinux project. Close the VM and do cd Desktop/dpu_integration/pynqz2_dpu and source /opt/petalinux/settings.sh. Then do the petalinux-config -c rootfs again to see if works now. Sometimes if you inturrupt a process, it leaves some background tasks running. If the error pressists try to look on the log file to identify the error! Good luck!

MaRcOsss1 commented 3 months ago

haha Dude your'e the best , it worked, I restarted the VM and it worked, Thanks a lot, will go ahead with the next step now haha.

andre1araujo commented 3 months ago

Let's go! Let me know if there are any further issues!

yolovino1 commented 3 months ago

hello, Andre,I'm trying run your peoject ,but I'm having problem with the problem which keeps loading petalinux-config -c kernel but nothing happens. Does this program take so long to load, or is there something wrong with my other settings?

Pasted Graphic 12 Pasted Graphic 14

I followed your idea and set it up, but it still doesn't work.

Pasted Graphic 15
yolovino1 commented 3 months ago
Pasted Graphic 16

it works successful without realizing it

yolovino1 commented 3 months ago
Pasted Graphic 17

something went wrong again

andre1araujo commented 3 months ago
Pasted Graphic 17

something went wrong again

Hello! Can you specify the problem you are having? It looks like the file devtool-fragment.cfg exists there and you already pasted the code specified on the tutorial, even though you have the warning on top. Did you do the petalinux-build command after? Did it provide any errors? I need more information so I can try to help :)

yolovino1 commented 3 months ago

Thank you for your reply. I haven't executed the petalinux build command yet because the gedit project spec/meta user/recipes kernel/Linux/Linux xlnx/devtool fragment. cfg command couldn't pass. When I went to the file, I saw that I don't have the recipes kernel file below. I saw the question above. You mentioned restarting the virtual machine without the recipes kernel, cd Desktop/dpu_integration/pnqz2udpu, and source/opt/petalinux/settings. sh. Then execute petalinux config - c rootfs again, and I have executed all of them image It's just my sixth attempt at petalinux config - c kernel, image

image And I don't know exactly how to do this step and then enable it: Device Driver ->USB Support ->[*] USB Announce New Device

yolovino1 commented 3 months ago

image

image

image

image

DTG settings ->kernel startup parameters ->disable automatic generation of startup parameters, and there is no disable for automatic generation of startup parameter selection

image There is no module ->DPU selection here

andre1araujo commented 3 months ago

Okay, I think you forgot to start up Petalinux correctly again. You restart the Virtual Machine, do cd Desktop/dpu_integration/pnqz2_dpu and then source /opt/petalinux/settings.sh. This last command is very important and you have to do it everytime you restart the project because it starts the Petalinux correctly. After that, its better to start the process again just to make sure everything is correct. As for your last comment, if there is no DPU selection, I think its better to start again. Do these:

image

Continue the rest of the tutorial from there and it should work. I really think the problem was that after you restarted you did not activate Petalinux with source /opt/petalinux/settings.sh. Just make sure you follow the start and then let me know ehat problems you encounter! I am sorry for the inconvenience.

yolovino1 commented 3 months ago

OK, I followed your instructions and did the following, ![image](https://github.com/andre1araujo/YOLO-on-PYNQ-Z2/assets/167788524/75786571-ae5e-4a4f-a104-77 image image 在DTG Settings+Kernel Bootargs -disable generate boot args automaticallyI didn't see anything in heredisable generate boot args Automatically options, or Where do I need to go to set this to disable automatic generation of startup parameters image

andre1araujo commented 3 months ago

Press ENTER on "kernel bootargs" and then press "n" to disable "generate bootargs automaticaly". When I say enable you press "y", and disable you press "n". Can you do that?

yolovino1 commented 3 months ago

It's not like that, when you press kernel bootars, image

What appears is the image below, without the option to generate bootars automatically image

andre1araujo commented 3 months ago

Hi! Sorry for the delay response. That is not usual what you are encountering. Do you have the correct Petalinux version? Is the vivado project correct? You can try with my vivado project and see if it works now. It can be downloaded here. Good luck! Let me know if you got it working!

yolovino1 commented 3 months ago

Replace my file with yours,The following issue has occurred. My model is zynq7020, and I have checked the configuration settings according to my board's settings. The DDR3 model is NT5CC256M16, Parts, select "clg400" in the Package column XC7Z020 speed is -2 xc7z020clg400-2”,你的好像是7010的,speed is -1 ,

image

Petalinux version is 2019.2,vivado is base on you intruction

image image
andre1araujo commented 3 months ago

I don't see a reason why that is not working then. Even if your board is different than PYNQ-Z2, the project does not care about it since you are using the zynq template on Petalinux. It is weird it is not recognising the project I sent you because it worked for me obviously. Unfortunatly I don't know how I can helo you with this. All I can say is to try again, not forgeting to do the command source /opt/petalinux/settings.sh to start Petalinux. I am really sorry for the inconvenience. I hope you can reach the solution. In any case, report back to me when you try something else or get any progress!

yolovino1 commented 3 months ago

Can I skip this process if I have pynq z2 dpu.bsp? I couldn't find the file you sent in the GitHub file, which contains pynq z2 dpu.bsp

andre1araujo commented 3 months ago

I am not sure it will be enough to skip the process. I will send you the .bsp file anyway. Hope it helps. Let me know! pynq-z2-dpu.zip