zangman / de10-nano

Absolute beginner's guide to the de10-nano
Apache License 2.0
202 stars 46 forks source link

DE0-Nano-SoC support? #14

Open Andy2No opened 2 years ago

Andy2No commented 2 years ago

How much work is needed to convert this to support the DE0-Nano-Soc?

Also, would it be possible to add a Discussion tab, to this repo? I have some questions, including this one, which are not related to bugs, so they don't really belong in the Issues section. I expect other people will have too.

The Discussion tab has the advantage that it remains visible even after questions are answered, as a supplement to the documentation, and is often participated in by people other than the content creator, so people can answer each other's questions, or share more information about it.

zangman commented 2 years ago

@Andy2No So sorry for the slow reply, I'm not sure why I didn't get notified for this.

How much work is needed to convert this to support the DE0-Nano-Soc?

If you mean adapting the content here to work with a DE0-Nano-Soc, I think that shouldn't be too difficult. I did use this blog post using the DE0 quite a bit and it was incredibly useful to me (I left a reference to the blog on the Simple hardware adder page).

However, if you mean the wiki itself, I think that would be a lot of work to re-write everything to support another board. If you have specific notes and gotchas related to the DE0 which could be relevant to any of the pages in this wiki, feel free to raise a PR and I'll be happy to take a look.

Also, would it be possible to add a Discussion tab, to this repo?

Done! I had no idea this was a thing and thank you for bringing it to my notice.

Andy2No commented 2 years ago

Just having the ability to build an SD image for the DE0-Nano-SoC would be fine. Having a ready built one to try it with would be nice too, but not essential.

They seem to be quite similar, apart from the actual chips used, which are both from the same family. The DE0-Nano-SoC lacks the HDMI connector, but is otherwise almost the same circuit board as the DE10-Nano.

The FPGA image that gets loaded when it boots would have to be compiled for the DE0-Nano-SoC, perhaps based on it's own Golden Hardware Reference Design. I understand the device tree may be different too.

Thanks for adding the Discussion tab. I think it might be a fairly new feature. I've been used to using it on earlephilhower's arduino-pico ( https://github.com/earlephilhower/arduino-pico ).

zangman commented 2 years ago

Just having the ability to build an SD image for the DE0-Nano-SoC would be fine. Having a ready built one to try it with would be nice too, but not essential.

Have you tried one of the images from releases page? They are so similar to each other that I wouldn't be surprised if it boots to shell prompt without any problems. In fact, if you look at the Appendix in the SD Card section you can see that we are in fact using the DE0's device tree because the DE10 device tree wasn't available at the time.

The DE0-Nano-SoC lacks the HDMI connector, but is otherwise almost the same circuit board as the DE10-Nano.

The images on the releases page don't use the HDMI anyways, there's no UI supported at the moment, so I don't think this should matter.

Andy2No commented 2 years ago

@zangman I hadn't tried the images because I wasn't expecting them to work, but I've now tried the v5.12 Debian image, and it does boot.

I'm able to do this, successfully, to turn the HPS LED on or off:

$ echo 100 > /sys/class/leds/hps_led0/brightness $ echo 0 > /sys/class/leds/hps_led0/brightness

I had seen that about it using the DE0-Nano-SoC device tree, but I'd also read issue #5 which left me wondering if I'd understood, because your last comment seemed to say something different:

In this section, we are just using the default build configuration for U-boot. This ends up using the device tree for de10.

zangman commented 2 years ago

Great to know that it at least boots out of the box! Thanks for confirming!

Regarding the my comment in #5, I did try to explain it in the appendix I linked to before.

When I'm referring to the device tree for de10, I mean that somebody went to the trouble to create a separate device tree file for the de10 and keep it separate from the de0 in u-boot. But nobody bothered to do it for the linux kernel. Which is why I just used whatever was available when building the image. It doesn't matter what the file is called, as long as the device tree correctly lists all the components for the OS to find.

u-boot has it's own kernel, drivers and device tree separate from the linux kernel. Which is why we use both device trees.

If you have the time I do encourage you to try building it from scratch and use the de0 device trees everywhere, it'll be a good learning experience.

Andy2No commented 2 years ago

Thanks. I'll build up to that. I don't currently have a PC with Linux on it, only cygwin, which I'm guessing wouldn't get me very far.

Andy2No commented 2 years ago

The v5.13 Arch ARM image also boots, and passes the same test with the HPS LED.

JDuchniewicz commented 2 years ago

Hi, I just discovered your amazing hub of resources (I found several other resources but none of them dug into such detail as yours). I am documenting a very similar process for De0-Nano SoC with up-to-date kernel/bootloader and rootfs here.

What do you think about me extending your work and PR'ing some of the content to this repo?

Ideally I would love to have one place where people can put different boards and keep it up to date 😄

This was motivated by me coming 2 years later to similar embedded project on the same board and finding that SO MUCH changed and yet again I had to dig into dark abyss of the Internet.

Andy2No commented 2 years ago

@JDuchniewicz You may want to look at robseb/rsYocto too (https://github.com/robseb/rsyocto).

Although there's a lot of documentation to wade through, which is a bit off putting, if you start with the ready made DE0-Nano-SoC image, and read the parts about loading an FPGA image from Linux (with FPGA-write), it's actually fairly easy to use, plus gcc is set up with all the include files and the library to compile the official soc fpga (hps fpga) examples, on the actual DE0-Nano-SoC, via SSH (using Tera Term or PuTTY)... presumably those can be added to this too, but I haven't yet looked into how.

I'm trying to read through both - this and rsYotocto, but it may take me a while to finish :)

zangman commented 2 years ago

@JDuchniewicz Great to see that you're documenting for the De0! I think we need more content like this to make it easier for folks to get started with SoCs :).

What do you think about me extending your work and PR'ing some of the content to this repo?

I'd love for you and others to contribute. I'm happy to include a new section/folder for the de0 if that makes sense to you? Keeping all this content in one place is definitely a good idea.

This was motivated by me coming 2 years later to similar embedded project on the same board and finding that SO MUCH changed and yet again I had to dig into dark abyss of the Internet.

This is definitely a major pain for these boards. I can't even begin to estimate the days I spent searching online for the smallest thing.